eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit f8459427d3f3f0d68ec07d71104e9e095222bbd1
parent 295430a47ea3b400bda8e0a5fe0c4baa8926cb37
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue, 11 Jan 2022 16:55:49 -0800

auto-t: update wpas.py to use non_block_wait

This should be used as a replacement for the common GLib
wait loop (internally this is all it does).

Diffstat:
Mautotests/util/wpas.py | 31+++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/autotests/util/wpas.py b/autotests/util/wpas.py @@ -58,29 +58,20 @@ class Wpas: f.close() return dict([[v.strip() for v in kv] for kv in [l.split('#', 1)[0].split('=', 1) for l in lines] if len(kv) == 2]) - def wait_for_event(self, event, timeout=10): - self._wait_timed_out = False - - def wait_timeout_cb(): - self._wait_timed_out = True - return False - - timeout = GLib.timeout_add_seconds(timeout, wait_timeout_cb) - context = ctx.mainloop.get_context() + def _check_event(self, event): + if not event and len(self._rx_data) >= 1: + print("returning %s" % self._rx_data[0]) + return self._rx_data[0] - while True: - context.iteration(may_block=True) + for e in self._rx_data: + if event in e: + return self._rx_data - if not event and len(self._rx_data) >= 1: - return self._rx_data[0] + return False - for e in self._rx_data: - if event in e: - GLib.source_remove(timeout) - return self._rx_data - - if self._wait_timed_out: - raise TimeoutError('waiting for wpas event timed out') + def wait_for_event(self, event, timeout=10): + self._rx_data = [] + return ctx.non_block_wait(self._check_event, timeout, event) def wait_for_result(self, timeout=10): self._rx_data = []