Browse Source

tests: P2P_FIND with freq parameter to scan a single channel

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
6d0b447464
2 changed files with 19 additions and 1 deletions
  1. 16 0
      tests/hwsim/test_p2p_autogo.py
  2. 3 1
      tests/hwsim/wpasupplicant.py

+ 16 - 0
tests/hwsim/test_p2p_autogo.py

@@ -606,3 +606,19 @@ def test_autogo_join_auto_go_neg_after_seeing_go(dev):
     dev[0].remove_group()
     dev[1].wait_go_ending_session()
     dev[1].flush_scan_cache()
+
+def test_go_search_non_social(dev):
+    """P2P_FIND with freq parameter to scan a single channel"""
+    addr0 = dev[0].p2p_dev_addr()
+    autogo(dev[0], freq=2422)
+    dev[1].p2p_find(freq=2422)
+    ev = dev[1].wait_event(["P2P-DEVICE-FOUND"], timeout=3.5)
+    if ev is None:
+        raise Exception("Did not find GO quickly enough")
+    dev[2].p2p_listen()
+    ev = dev[1].wait_event(["P2P-DEVICE-FOUND"], timeout=5)
+    if ev is None:
+        raise Exception("Did not find peer")
+    dev[2].p2p_stop_find()
+    dev[1].p2p_stop_find()
+    dev[0].remove_group()

+ 3 - 1
tests/hwsim/wpasupplicant.py

@@ -387,7 +387,7 @@ class WpaSupplicant:
         return self.global_request("P2P_LISTEN")
 
     def p2p_find(self, social=False, progressive=False, dev_id=None,
-                 dev_type=None, delay=None):
+                 dev_type=None, delay=None, freq=None):
         cmd = "P2P_FIND"
         if social:
             cmd = cmd + " type=social"
@@ -399,6 +399,8 @@ class WpaSupplicant:
             cmd = cmd + " dev_type=" + dev_type
         if delay:
             cmd = cmd + " delay=" + str(delay)
+        if freq:
+            cmd = cmd + " freq=" + str(freq)
         return self.global_request(cmd)
 
     def p2p_stop_find(self):