diff --git a/tests/hwsim/test_nfc_p2p.py b/tests/hwsim/test_nfc_p2p.py index 66de717f8..fc9d7b9dd 100644 --- a/tests/hwsim/test_nfc_p2p.py +++ b/tests/hwsim/test_nfc_p2p.py @@ -19,10 +19,10 @@ grpform_events = ["P2P-GROUP-STARTED", "WPS-FAIL"] def set_ip_addr_info(dev): - dev.request("SET ip_addr_go 192.168.42.1") - dev.request("SET ip_addr_mask 255.255.255.0") - dev.request("SET ip_addr_start 192.168.42.100") - dev.request("SET ip_addr_end 192.168.42.199") + dev.global_request("SET ip_addr_go 192.168.42.1") + dev.global_request("SET ip_addr_mask 255.255.255.0") + dev.global_request("SET ip_addr_start 192.168.42.100") + dev.global_request("SET ip_addr_end 192.168.42.199") def check_ip_addr(res): if 'ip_addr' not in res: @@ -41,35 +41,35 @@ def check_ip_addr(res): def test_nfc_p2p_go_neg(dev): """NFC connection handover to form a new P2P group (initiator becomes GO)""" set_ip_addr_info(dev[0]) - dev[0].request("SET p2p_go_intent 10") + dev[0].global_request("SET p2p_go_intent 10") logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[0].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=15) + ev = dev[0].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=1) + ev = dev[1].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -83,35 +83,35 @@ def test_nfc_p2p_go_neg(dev): def test_nfc_p2p_go_neg_reverse(dev): """NFC connection handover to form a new P2P group (responder becomes GO)""" set_ip_addr_info(dev[1]) - dev[0].request("SET p2p_go_intent 3") + dev[0].global_request("SET p2p_go_intent 3") logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[0].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=15) + ev = dev[0].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=1) + ev = dev[1].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -128,22 +128,22 @@ def test_nfc_p2p_initiator_go(dev): logger.info("Start autonomous GO") dev[0].p2p_start_go() logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[1].wait_event(["P2P-GROUP-STARTED"], timeout=15) + ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=15) if ev is None: raise Exception("Connection to the group timed out") res1 = dev[1].group_form_result(ev) @@ -158,22 +158,22 @@ def test_nfc_p2p_responder_go(dev): logger.info("Start autonomous GO") dev[1].p2p_start_go() logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[0].wait_event(["P2P-GROUP-STARTED"], timeout=15) + ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15) if ev is None: raise Exception("Connection to the group timed out") res0 = dev[0].group_form_result(ev) @@ -266,36 +266,36 @@ def test_nfc_p2p_static_handover_tagdev_client(dev): logger.info("Perform NFC connection handover") - res = dev[1].request("SET p2p_listen_reg_class 81") - res2 = dev[1].request("SET p2p_listen_channel 6") + res = dev[1].global_request("SET p2p_listen_reg_class 81") + res2 = dev[1].global_request("SET p2p_listen_channel 6") if "FAIL" in res or "FAIL" in res2: raise Exception("Could not set Listen channel") - pw = dev[1].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[1].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - res = dev[1].request("P2P_SET nfc_tag 1").rstrip() + res = dev[1].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") - res = dev[1].request("P2P_LISTEN") + res = dev[1].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") dev[1].dump_monitor() dev[0].dump_monitor() - dev[0].request("SET p2p_go_intent 10") - res = dev[0].request("WPS_NFC_TAG_READ " + sel) + dev[0].global_request("SET p2p_go_intent 10") + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel) if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[0].wait_event(grpform_events, timeout=15) + ev = dev[0].wait_global_event(grpform_events, timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(grpform_events, timeout=1) + ev = dev[1].wait_global_event(grpform_events, timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -313,37 +313,37 @@ def test_nfc_p2p_static_handover_tagdev_client_group_iface(dev): logger.info("Perform NFC connection handover") - res = dev[1].request("SET p2p_listen_reg_class 81") - res2 = dev[1].request("SET p2p_listen_channel 6") + res = dev[1].global_request("SET p2p_listen_reg_class 81") + res2 = dev[1].global_request("SET p2p_listen_channel 6") if "FAIL" in res or "FAIL" in res2: raise Exception("Could not set Listen channel") - pw = dev[1].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[1].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - dev[1].request("SET p2p_no_group_iface 0") - res = dev[1].request("P2P_SET nfc_tag 1").rstrip() + dev[1].global_request("SET p2p_no_group_iface 0") + res = dev[1].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") - res = dev[1].request("P2P_LISTEN") + res = dev[1].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") dev[1].dump_monitor() dev[0].dump_monitor() - dev[0].request("SET p2p_go_intent 10") - res = dev[0].request("WPS_NFC_TAG_READ " + sel) + dev[0].global_request("SET p2p_go_intent 10") + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel) if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[0].wait_event(grpform_events, timeout=15) + ev = dev[0].wait_global_event(grpform_events, timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(grpform_events, timeout=1) + ev = dev[1].wait_global_event(grpform_events, timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -361,36 +361,36 @@ def test_nfc_p2p_static_handover_tagdev_go(dev): logger.info("Perform NFC connection handover") - res = dev[1].request("SET p2p_listen_reg_class 81") - res2 = dev[1].request("SET p2p_listen_channel 6") + res = dev[1].global_request("SET p2p_listen_reg_class 81") + res2 = dev[1].global_request("SET p2p_listen_channel 6") if "FAIL" in res or "FAIL" in res2: raise Exception("Could not set Listen channel") - pw = dev[1].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[1].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - res = dev[1].request("P2P_SET nfc_tag 1").rstrip() + res = dev[1].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") - res = dev[1].request("P2P_LISTEN") + res = dev[1].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") dev[1].dump_monitor() dev[0].dump_monitor() - dev[0].request("SET p2p_go_intent 3") - res = dev[0].request("WPS_NFC_TAG_READ " + sel) + dev[0].global_request("SET p2p_go_intent 3") + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel) if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[0].wait_event(grpform_events, timeout=15) + ev = dev[0].wait_global_event(grpform_events, timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(grpform_events, timeout=1) + ev = dev[1].wait_global_event(grpform_events, timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -408,36 +408,36 @@ def test_nfc_p2p_static_handover_tagdev_go_forced_freq(dev): logger.info("Perform NFC connection handover") - res = dev[1].request("SET p2p_listen_reg_class 81") - res2 = dev[1].request("SET p2p_listen_channel 6") + res = dev[1].global_request("SET p2p_listen_reg_class 81") + res2 = dev[1].global_request("SET p2p_listen_channel 6") if "FAIL" in res or "FAIL" in res2: raise Exception("Could not set Listen channel") - pw = dev[1].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[1].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - res = dev[1].request("P2P_SET nfc_tag 1").rstrip() + res = dev[1].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") - res = dev[1].request("P2P_LISTEN") + res = dev[1].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") dev[1].dump_monitor() dev[0].dump_monitor() - dev[0].request("SET p2p_go_intent 3") - res = dev[0].request("WPS_NFC_TAG_READ " + sel + " freq=2442") + dev[0].global_request("SET p2p_go_intent 3") + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel + " freq=2442") if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[0].wait_event(grpform_events, timeout=15) + ev = dev[0].wait_global_event(grpform_events, timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(grpform_events, timeout=1) + ev = dev[1].wait_global_event(grpform_events, timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -496,29 +496,29 @@ def test_nfc_p2p_static_handover_join_tagdev_client(dev): logger.info("Start autonomous GO") dev[0].p2p_start_go() - dev[1].request("SET ignore_old_scan_res 1") - dev[2].request("SET ignore_old_scan_res 1") + dev[1].global_request("SET ignore_old_scan_res 1") + dev[2].global_request("SET ignore_old_scan_res 1") logger.info("Write NFC Tag on the P2P Client") - res = dev[1].request("P2P_LISTEN") + res = dev[1].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") - pw = dev[1].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[1].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - res = dev[1].request("P2P_SET nfc_tag 1").rstrip() + res = dev[1].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") logger.info("Read NFC Tag on the GO to trigger invitation") - res = dev[0].request("WPS_NFC_TAG_READ " + sel) + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel) if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[1].wait_event(grpform_events, timeout=30) + ev = dev[1].wait_global_event(grpform_events, timeout=30) if ev is None: raise Exception("Joining the group timed out") res = dev[1].group_form_result(ev) @@ -526,25 +526,25 @@ def test_nfc_p2p_static_handover_join_tagdev_client(dev): check_ip_addr(res) logger.info("Write NFC Tag on another P2P Client") - res = dev[2].request("P2P_LISTEN") + res = dev[2].global_request("P2P_LISTEN") if "FAIL" in res: raise Exception("Failed to start Listen mode") - pw = dev[2].request("WPS_NFC_TOKEN NDEF").rstrip() + pw = dev[2].global_request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") - res = dev[2].request("P2P_SET nfc_tag 1").rstrip() + res = dev[2].global_request("P2P_SET nfc_tag 1").rstrip() if "FAIL" in res: raise Exception("Failed to enable NFC Tag for P2P static handover") - sel = dev[2].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() + sel = dev[2].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") logger.info("Read NFC Tag on the GO to trigger invitation") - res = dev[0].request("WPS_NFC_TAG_READ " + sel) + res = dev[0].global_request("WPS_NFC_TAG_READ " + sel) if "FAIL" in res: raise Exception("Failed to provide NFC tag contents to wpa_supplicant") - ev = dev[2].wait_event(grpform_events, timeout=30) + ev = dev[2].wait_global_event(grpform_events, timeout=30) if ev is None: raise Exception("Joining the group timed out") res = dev[2].group_form_result(ev) @@ -556,7 +556,7 @@ def test_nfc_p2p_go_legacy_config_token(dev): logger.info("Start autonomous GOs") dev[0].p2p_start_go() logger.info("Connect legacy WPS STA with configuration token") - conf = dev[0].request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip() + conf = dev[0].group_request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip() if "FAIL" in conf: raise Exception("Failed to generate configuration token") dev[1].dump_monitor() @@ -576,10 +576,10 @@ def test_nfc_p2p_go_legacy_handover(dev): req = dev[1].request("NFC_GET_HANDOVER_REQ NDEF WPS-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[0].request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip() + sel = dev[0].group_request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") - res = dev[0].request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel) + res = dev[0].group_request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant (GO)") dev[1].dump_monitor() @@ -594,35 +594,35 @@ def test_nfc_p2p_go_legacy_handover(dev): def test_nfc_p2p_ip_addr_assignment(dev): """NFC connection handover and legacy station IP address assignment""" set_ip_addr_info(dev[1]) - dev[0].request("SET p2p_go_intent 3") + dev[0].global_request("SET p2p_go_intent 3") logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[0].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=15) + ev = dev[0].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=1) + ev = dev[1].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev) @@ -634,13 +634,14 @@ def test_nfc_p2p_ip_addr_assignment(dev): check_ip_addr(res0) logger.info("Connect legacy P2P client that does not use new IP address assignment") - res = dev[2].request("P2P_SET disable_ip_addr_req 1") + res = dev[2].global_request("P2P_SET disable_ip_addr_req 1") if "FAIL" in res: raise Exception("Failed to disable IP address assignment request") pin = dev[2].wps_read_pin() dev[1].p2p_go_authorize_client(pin) res = dev[2].p2p_connect_group(dev[1].p2p_dev_addr(), pin, timeout=60) logger.info("Client connected") + res = dev[2].global_request("P2P_SET disable_ip_addr_req 0") hwsim_utils.test_connectivity_p2p(dev[1], dev[2]) if 'ip_addr' in res: raise Exception("Unexpected IP address assignment") @@ -648,35 +649,35 @@ def test_nfc_p2p_ip_addr_assignment(dev): def test_nfc_p2p_ip_addr_assignment2(dev): """NFC connection handover and IP address assignment for two clients""" set_ip_addr_info(dev[1]) - dev[0].request("SET p2p_go_intent 3") + dev[0].global_request("SET p2p_go_intent 3") logger.info("Perform NFC connection handover") - req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() + req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip() if "FAIL" in req: raise Exception("Failed to generate NFC connection handover request") - sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() + sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip() if "FAIL" in sel: raise Exception("Failed to generate NFC connection handover select") dev[0].dump_monitor() dev[1].dump_monitor() - res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) + res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)") - res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) + res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel) if "FAIL" in res: raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)") - ev = dev[0].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=15) + ev = dev[0].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=15) if ev is None: raise Exception("Group formation timed out") res0 = dev[0].group_form_result(ev) - ev = dev[1].wait_event(["P2P-GROUP-STARTED", - "P2P-GO-NEG-FAILURE", - "P2P-GROUP-FORMATION-FAILURE", - "WPS-PIN-NEEDED"], timeout=1) + ev = dev[1].wait_global_event(["P2P-GROUP-STARTED", + "P2P-GO-NEG-FAILURE", + "P2P-GROUP-FORMATION-FAILURE", + "WPS-PIN-NEEDED"], timeout=1) if ev is None: raise Exception("Group formation timed out") res1 = dev[1].group_form_result(ev)