mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 13:59:24 +01:00
auto-t: wpas.py: read DPP event until expected result
Controlling wpa_supplicant/hostapd from a text based interface is problematic in that there is no way of knowing if an event corresponds to a request. In certain cases if wpa_s/hostapd is sending out multiple events and we make a request, a random event may come back after the request, but before the actual result. To fix this, at least for this specific case, we can continue to read from the socket until the result is numeric.
This commit is contained in:
parent
f8459427d3
commit
c78573b468
@ -242,19 +242,29 @@ class Wpas:
|
|||||||
self._ctrl_request('SET ' + key + ' ' + value, **kwargs)
|
self._ctrl_request('SET ' + key + ' ' + value, **kwargs)
|
||||||
|
|
||||||
def dpp_enrollee_start(self, uri=None):
|
def dpp_enrollee_start(self, uri=None):
|
||||||
|
self._rx_data = []
|
||||||
self._ctrl_request('DPP_BOOTSTRAP_GEN type=qrcode')
|
self._ctrl_request('DPP_BOOTSTRAP_GEN type=qrcode')
|
||||||
self.wait_for_result()
|
self.wait_for_result()
|
||||||
|
|
||||||
if uri:
|
if uri:
|
||||||
|
self._rx_data = []
|
||||||
self._ctrl_request('DPP_QR_CODE ' + uri)
|
self._ctrl_request('DPP_QR_CODE ' + uri)
|
||||||
self._dpp_qr_id = self.wait_for_result()
|
self._dpp_qr_id = self.wait_for_result()
|
||||||
|
self._rx_data = []
|
||||||
self._ctrl_request('DPP_AUTH_INIT peer=%s role=enrollee' % self._dpp_qr_id)
|
self._ctrl_request('DPP_AUTH_INIT peer=%s role=enrollee' % self._dpp_qr_id)
|
||||||
|
|
||||||
def dpp_configurator_create(self, uri):
|
def dpp_configurator_create(self, uri):
|
||||||
|
self._rx_data = []
|
||||||
self._ctrl_request('DPP_CONFIGURATOR_ADD')
|
self._ctrl_request('DPP_CONFIGURATOR_ADD')
|
||||||
self._dpp_conf_id = self.wait_for_result()
|
self._dpp_conf_id = self.wait_for_result()
|
||||||
|
while not self._dpp_conf_id.isnumeric():
|
||||||
|
self._dpp_conf_id = self.wait_for_result()
|
||||||
|
|
||||||
|
self._rx_data = []
|
||||||
self._ctrl_request('DPP_QR_CODE ' + uri)
|
self._ctrl_request('DPP_QR_CODE ' + uri)
|
||||||
self._dpp_qr_id = self.wait_for_result()
|
self._dpp_qr_id = self.wait_for_result()
|
||||||
|
while not self._dpp_conf_id.isnumeric():
|
||||||
|
self._dpp_qr_id = self.wait_for_result()
|
||||||
|
|
||||||
print("DPP Configurator ID: %s. DPP QR ID: %s" % (self._dpp_conf_id, self._dpp_qr_id))
|
print("DPP Configurator ID: %s. DPP QR ID: %s" % (self._dpp_conf_id, self._dpp_qr_id))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user