diff --git a/wpa_supplicant/README-P2P b/wpa_supplicant/README-P2P index 08d39e246..7354bbf03 100644 --- a/wpa_supplicant/README-P2P +++ b/wpa_supplicant/README-P2P @@ -72,7 +72,8 @@ over the main control interface. Device Discovery p2p_find [timeout in seconds] [type=] \ - [dev_id=] [delay=] + [dev_id=] [dev_type=] \ + [delay=] The default behavior is to run a single full scan in the beginning and then scan only social channels. type=social will scan only social @@ -87,6 +88,10 @@ search for. The optional delay parameter can be used to request an extra delay to be used between search iterations (e.g., to free up radio resources for concurrent operations). +The optional dev_type option can be used to specify a single device type +(primary or secondary) to search for, e.g., +"p2p_find dev_type=1-0050F204-1". + p2p_listen [timeout in seconds] Start Listen-only state (become discoverable without searching for diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index b4dcb39c5..3f53691aa 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3652,6 +3652,7 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd) unsigned int timeout = atoi(cmd); enum p2p_discovery_type type = P2P_FIND_START_WITH_FULL; u8 dev_id[ETH_ALEN], *_dev_id = NULL; + u8 dev_type[WPS_DEV_TYPE_LEN], *_dev_type = NULL; char *pos; unsigned int search_delay; @@ -3668,6 +3669,14 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd) _dev_id = dev_id; } + pos = os_strstr(cmd, "dev_type="); + if (pos) { + pos += 9; + if (wps_dev_type_str2bin(pos, dev_type) < 0) + return -1; + _dev_type = dev_type; + } + pos = os_strstr(cmd, "delay="); if (pos) { pos += 6; @@ -3675,8 +3684,8 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd) } else search_delay = wpas_p2p_search_delay(wpa_s); - return wpas_p2p_find(wpa_s, timeout, type, 0, NULL, _dev_id, - search_delay); + return wpas_p2p_find(wpa_s, timeout, type, _dev_type != NULL, _dev_type, + _dev_id, search_delay); }