3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

auto-t: add stop APIs and fix some issues wpas.py

- wait_for_event was returning a list in certain cases, not the
   event itself
 - The configurator ID was not being printed (',' instead of '%')
 - The DPP ID was not being properly waited for with PKEX
This commit is contained in:
James Prestwood 2023-11-13 06:32:54 -08:00 committed by Denis Kenzior
parent 2be49a93ba
commit 13952ff350

View File

@ -76,7 +76,7 @@ class Wpas:
for e in self._rx_data: for e in self._rx_data:
if event in e: if event in e:
return self._rx_data return e
return False return False
@ -281,7 +281,7 @@ class Wpas:
self._dpp_conf_id = self.wait_for_result() self._dpp_conf_id = self.wait_for_result()
if not uri: if not uri:
print("DPP Configurator ID: %s", self._dpp_conf_id) print("DPP Configurator ID: %s" % self._dpp_conf_id)
return return
self._rx_data = [] self._rx_data = []
@ -315,6 +315,8 @@ class Wpas:
self._rx_data = [] self._rx_data = []
self._ctrl_request(cmd) self._ctrl_request(cmd)
self._dpp_id = self.wait_for_result() self._dpp_id = self.wait_for_result()
while not self._dpp_id.isnumeric():
self._dpp_id = self.wait_for_result()
def dpp_pkex_add(self, code, identifier=None, version=None, initiator=False, role=None): def dpp_pkex_add(self, code, identifier=None, version=None, initiator=False, role=None):
cmd = f'DPP_PKEX_ADD own={self._dpp_id}' cmd = f'DPP_PKEX_ADD own={self._dpp_id}'
@ -336,10 +338,18 @@ class Wpas:
self._rx_data = [] self._rx_data = []
self._ctrl_request(cmd) self._ctrl_request(cmd)
def dpp_pkex_remove(self):
self._rx_data = []
self._ctrl_request("DPP_PKEX_REMOVE *")
def dpp_listen(self, freq): def dpp_listen(self, freq):
self._rx_data = [] self._rx_data = []
self._ctrl_request(f'DPP_LISTEN {freq}') self._ctrl_request(f'DPP_LISTEN {freq}')
def dpp_stop_listen(self):
self._rx_data = []
self._ctrl_request("DPP_STOP_LISTEN")
def dpp_configurator_remove(self): def dpp_configurator_remove(self):
self._ctrl_request('DPP_CONFIGURATOR_REMOVE *') self._ctrl_request('DPP_CONFIGURATOR_REMOVE *')
self.wait_for_result() self.wait_for_result()