aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-11-06 09:30:02 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-06 09:30:02 -0800
commit3323fc74c5572ad84b1b458dfebfd9f47ecb0f47 (patch)
tree8686ac8a90e3bf6066715ddc1a25e86e6c361a6a
parentbaa1955ffef3a3a3fc398dc2cf8cdab9ce9f2e6a (diff)
parenta3bdc38a16e8424585c0f105c9c2ef77988989dc (diff)
downloadandroid_external_wpa_supplicant_8-3323fc74c5572ad84b1b458dfebfd9f47ecb0f47.tar.gz
android_external_wpa_supplicant_8-3323fc74c5572ad84b1b458dfebfd9f47ecb0f47.tar.bz2
android_external_wpa_supplicant_8-3323fc74c5572ad84b1b458dfebfd9f47ecb0f47.zip
Merge "P2P: Set p2p_scan_running based on driver scan request result"
-rw-r--r--src/p2p/p2p.c34
-rw-r--r--src/p2p/p2p.h7
-rw-r--r--wpa_supplicant/p2p_supplicant.c2
3 files changed, 28 insertions, 15 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index e8161f7f..3bc000aa 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -958,14 +958,8 @@ static void p2p_search(struct p2p_data *p2p)
p2p->num_req_dev_types, p2p->req_dev_types,
p2p->find_dev_id, pw_id);
if (res < 0) {
- p2p_dbg(p2p, "Scan request failed");
+ p2p_dbg(p2p, "Scan request schedule failed");
p2p_continue_find(p2p);
- } else {
- p2p_dbg(p2p, "Running p2p_scan");
- p2p->p2p_scan_running = 1;
- eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
- eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
- p2p, NULL);
}
}
@@ -978,6 +972,22 @@ static void p2p_find_timeout(void *eloop_ctx, void *timeout_ctx)
}
+void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status)
+{
+ if (status != 0) {
+ p2p_dbg(p2p, "Scan request failed");
+ /* Do continue find even for the first p2p_find_scan */
+ p2p_continue_find(p2p);
+ } else {
+ p2p_dbg(p2p, "Running p2p_scan");
+ p2p->p2p_scan_running = 1;
+ eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
+ eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
+ p2p, NULL);
+ }
+}
+
+
static int p2p_run_after_scan(struct p2p_data *p2p)
{
struct p2p_device *dev;
@@ -1108,17 +1118,11 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
return -1;
}
- if (res == 0) {
- p2p_dbg(p2p, "Running p2p_scan");
- p2p->p2p_scan_running = 1;
- eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
- eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
- p2p, NULL);
- } else if (p2p->p2p_scan_running) {
+ if (res != 0 && p2p->p2p_scan_running) {
p2p_dbg(p2p, "Failed to start p2p_scan - another p2p_scan was already running");
/* wait for the previous p2p_scan to complete */
res = 0; /* do not report failure */
- } else {
+ } else if (res != 0) {
p2p_dbg(p2p, "Failed to start p2p_scan");
p2p_set_state(p2p, P2P_IDLE);
eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 076a2ac1..284ad11a 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -949,6 +949,13 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
const u8 *dev_id, unsigned int search_delay);
/**
+ * p2p_notify_scan_trigger_status - Indicate scan trigger status
+ * @p2p: P2P module context from p2p_init()
+ * @status: 0 on success, -1 on failure
+ */
+void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status);
+
+/**
* p2p_stop_find - Stop P2P Find (Device Discovery)
* @p2p: P2P module context from p2p_init()
*/
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 878ff682..ddd245d3 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -269,9 +269,11 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
work->ctx = NULL;
if (ret) {
radio_work_done(work);
+ p2p_notify_scan_trigger_status(wpa_s->global->p2p, ret);
return;
}
+ p2p_notify_scan_trigger_status(wpa_s->global->p2p, ret);
os_get_reltime(&wpa_s->scan_trigger_time);
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
wpa_s->own_scan_requested = 1;