with alloc_fail(hapd, 1, "ssdp_listener_start"):
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("ENABLE succeeded during OOM")
+
+def test_wps_config_methods(dev):
+ """WPS config method update"""
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add("wlan5")
+ if "OK" not in wpas.request("SET config_methods display label"):
+ raise Exception("Failed to set config_methods")
+ if wpas.request("GET config_methods").strip() != "display label":
+ raise Exception("config_methods were not updated")
+ if "OK" not in wpas.request("SET config_methods "):
+ raise Exception("Failed to clear config_methods")
+ if wpas.request("GET config_methods").strip() != "":
+ raise Exception("config_methods were not cleared")
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
if ev is None:
raise Exception("Scan timed out")
+
+def test_p2p_config_methods(dev):
+ """P2P and WPS config method update"""
+ addr0 = dev[0].p2p_dev_addr()
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add("wlan5")
+ addr1 = wpas.p2p_dev_addr()
+
+ if "OK" not in wpas.request("SET config_methods keypad virtual_push_button"):
+ raise Exception("Failed to set config_methods")
+
+ wpas.p2p_listen()
+ if not dev[0].discover_peer(addr1):
+ raise Exception("Device discovery timed out")
+ dev[0].p2p_stop_find()
+ peer = dev[0].get_peer(addr1)
+ if peer['config_methods'] != '0x180':
+ raise Exception("Unexpected peer config methods(1): " + peer['config_methods'])
+ dev[0].global_request("P2P_FLUSH")
+
+ if "OK" not in wpas.request("SET config_methods virtual_display"):
+ raise Exception("Failed to set config_methods")
+
+ if not dev[0].discover_peer(addr1):
+ raise Exception("Device discovery timed out")
+ dev[0].p2p_stop_find()
+ peer = dev[0].get_peer(addr1)
+ if peer['config_methods'] != '0x8':
+ raise Exception("Unexpected peer config methods(2): " + peer['config_methods'])
+
+ wpas.p2p_stop_find()