P2P: Add state info to global STATUS command

This can be used for debugging purposes to see what the current P2P
module state is.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-08-25 21:02:12 +03:00
parent ae8c27f79d
commit 4c559019bd
3 changed files with 27 additions and 2 deletions

View File

@ -137,6 +137,12 @@ static const char * p2p_state_txt(int state)
}
const char * p2p_get_state_txt(struct p2p_data *p2p)
{
return p2p_state_txt(p2p->state);
}
u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr)
{
struct p2p_device *dev = NULL;

View File

@ -1820,4 +1820,15 @@ struct wpabuf * wifi_display_encaps(struct wpabuf *subelems);
int p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int,
int max_disc_tu);
/**
* p2p_get_state_txt - Get current P2P state for debug purposes
* @p2p: P2P module context from p2p_init()
* Returns: Name of the current P2P module state
*
* It should be noted that the P2P module state names are internal information
* and subject to change at any point, i.e., this information should be used
* mainly for debugging purposes.
*/
const char * p2p_get_state_txt(struct p2p_data *p2p);
#endif /* P2P_H */

View File

@ -6047,9 +6047,17 @@ static int wpas_global_ctrl_iface_status(struct wpa_global *global,
end = buf + buflen;
#ifdef CONFIG_P2P
if (global->p2p) {
if (global->p2p && !global->p2p_disabled) {
ret = os_snprintf(pos, end - pos, "p2p_device_address=" MACSTR
"\n", MAC2STR(global->p2p_dev_addr));
"\n"
"p2p_state=%s\n",
MAC2STR(global->p2p_dev_addr),
p2p_get_state_txt(global->p2p));
if (ret < 0 || ret >= end - pos)
return pos - buf;
pos += ret;
} else if (global->p2p) {
ret = os_snprintf(pos, end - pos, "p2p_state=DISABLED\n");
if (ret < 0 || ret >= end - pos)
return pos - buf;
pos += ret;