OSDN Git Service

wpa_supplicant: Improve scan during p2p_find
authorDmitry Shmidt <dimitrysh@google.com>
Tue, 11 Sep 2012 21:36:56 +0000 (14:36 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Tue, 11 Sep 2012 21:36:56 +0000 (14:36 -0700)
Change-Id: I733b23c2b7a24cfa96fe6593adbcbeb7d0798002
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
wpa_supplicant/events.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/scan.c

index bb870c0..6be345d 100644 (file)
@@ -1074,11 +1074,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
        wpa_supplicant_notify_scanning(wpa_s, 0);
 
 #ifdef CONFIG_P2P
-#ifdef ANDROID_P2P
-       if (p2p_search_pending(wpa_s->global->p2p) && !wpa_s->global->p2p_disabled &&
-#else
        if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
-#endif
            wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) {
                wpa_s->p2p_cb_on_scan_complete = 0;
                if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) {
index 7afdfa5..469e383 100644 (file)
 #endif /* P2P_MAX_INITIAL_CONN_WAIT */
 
 #ifndef P2P_CONCURRENT_SEARCH_DELAY
-#ifdef ANDROID_P2P
-#define P2P_CONCURRENT_SEARCH_DELAY 0
-#else
 #define P2P_CONCURRENT_SEARCH_DELAY 500
-#endif
 #endif /* P2P_CONCURRENT_SEARCH_DELAY */
 
 enum p2p_group_removal_reason {
@@ -1200,7 +1196,6 @@ void wpas_dev_found(void *ctx, const u8 *addr,
 #define WFD_DEV_INFO_SIZE 9
        char wfd_dev_info_hex[2 * WFD_DEV_INFO_SIZE + 1];
        os_memset(wfd_dev_info_hex, 0, sizeof(wfd_dev_info_hex));
-
 #ifdef CONFIG_WIFI_DISPLAY
        if (info->wfd_subelems) {
                wpa_snprintf_hex(wfd_dev_info_hex, sizeof(wfd_dev_info_hex),
@@ -5340,7 +5335,12 @@ unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s)
                rn2 = ifs->driver->get_radio_name(ifs->drv_priv);
                if (!rn2 || os_strcmp(rn, rn2) != 0)
                        continue;
+#ifdef ANDROID_P2P
+               /* We need not delay the p2p_scan if STA is already connected */
+               if (ifs->wpa_state > WPA_SCANNING && ifs->wpa_state < WPA_COMPLETED) {
+#else
                if (ifs->wpa_state > WPA_SCANNING) {
+#endif
                        wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search "
                                "delay due to concurrent operation on "
                                "interface %s",
@@ -5377,7 +5377,7 @@ int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int freq)
                         * P2P Client, remove the interface depending up on the connection
                         * priority */
                        if(!wpas_is_p2p_prioritized(wpa_s)) {
-                               /* STA connection has priority over existing 
+                               /* STA connection has priority over existing
                                 * P2P connection. So remove the interface */
                                wpa_printf(MSG_DEBUG, "P2P: Removing P2P connection due to Single channel"
                                                "concurrent mode frequency conflict");
index d8db81f..d8b3139 100644 (file)
@@ -690,6 +690,12 @@ scan:
 
        if (ret) {
                wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate AP scan");
+#ifdef ANDROID_P2P
+               /* Restore back the wpa_s->scan_req if we failed the scan becoz of any reason */
+               wpa_msg(wpa_s, MSG_DEBUG, "Restoring back the wpa_s->scan_req "
+                       "to the original value %d", scan_req);
+               wpa_s->scan_req = scan_req;
+#endif
                if (prev_state != wpa_s->wpa_state)
                        wpa_supplicant_set_state(wpa_s, prev_state);
                wpa_supplicant_req_scan(wpa_s, 1, 0);