eiwd

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

commit b705a579ad552e31cf68cd35d9a0be0befbf99fb
parent 5ebbe07fa611482f3e28f74f6f87779385fea524
Author: James Prestwood <prestwoj@gmail.com>
Date:   Fri, 13 Aug 2021 09:24:40 -0700

auto-t: ead.py: use non_block_wait

Diffstat:
Mautotests/util/ead.py | 25++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/autotests/util/ead.py b/autotests/util/ead.py @@ -81,12 +81,8 @@ class EAD(iwd.AsyncOpAbstract): _adapters = None def __init__(self): - tries = 0 - while not self._bus.name_has_owner(EAD_SERVICE): - if tries > 200: - raise TimeoutError('IWD has failed to start') - tries += 1 - time.sleep(0.1) + ctx.non_block_wait(self._bus.name_has_owner, 20, EAD_SERVICE, + exception=TimeoutError('EAD has failed to start')) self._adapters = AdapterList(self) @@ -103,21 +99,8 @@ class EAD(iwd.AsyncOpAbstract): if not wait_to_appear: return list(self._adapters.values()) - self._wait_timed_out = False - def wait_timeout_cb(): - self._wait_timed_out = True - return False - - try: - timeout = GLib.timeout_add_seconds(max_wait, wait_timeout_cb) - context = ctx.mainloop.get_context() - while len(self._adapters) < wait_to_appear: - context.iteration(may_block=True) - if self._wait_timed_out: - raise TimeoutError('IWD has no associated devices') - finally: - if not self._wait_timed_out: - GLib.source_remove(timeout) + ctx.non_block_wait(lambda s, num : len(s._adapters) >= num, max_wait, self, wait_to_appear, + exception=TimeoutError('EAD has no associated devices')) return list(self._adapters.values())