diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index cfbf1d06f..ed730222c 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -209,3 +209,26 @@ def test_discovery_dev_id_go(dev): ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2) if ev is None: raise Exception("P2P device not found") + +def test_discovery_social_plus_one(dev): + """P2P device discovery with social-plus-one""" + logger.info("Start autonomous GO " + dev[0].ifname) + dev[2].p2p_start_go(freq="2422") + go = dev[2].p2p_dev_addr() + dev[1].p2p_find(social=True) + dev[0].p2p_find(progressive=True) + ev = dev[0].wait_event(["P2P-DEVICE-FOUND"]) + if ev is None: + raise Exception("Peer not found") + ev = dev[0].wait_event(["P2P-DEVICE-FOUND"]) + if ev is None: + raise Exception("Peer not found") + ev = dev[1].wait_event(["P2P-DEVICE-FOUND"]) + if ev is None: + raise Exception("Peer not found") + dev[0].p2p_stop_find() + dev[1].p2p_stop_find() + if not dev[0].peer_known(go): + raise Exception("GO not found in progressive scan") + if dev[1].peer_known(go): + raise Exception("GO found in social-only scan") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index a8f3ccfdf..fceb056ba 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -330,10 +330,12 @@ class WpaSupplicant: def p2p_listen(self): return self.global_request("P2P_LISTEN") - def p2p_find(self, social=False, dev_id=None, dev_type=None): + def p2p_find(self, social=False, progressive=False, dev_id=None, dev_type=None): cmd = "P2P_FIND" if social: cmd = cmd + " type=social" + elif progressive: + cmd = cmd + " type=progressive" if dev_id: cmd = cmd + " dev_id=" + dev_id if dev_type: