commit 15c09207776726dddcef2a72c7185080f65bc1d8
parent 4ebc79c46606243ed853517d7a67694ae79bd19b
Author: James Prestwood <prestwoj@gmail.com>
Date: Wed, 16 Feb 2022 11:39:43 -0800
auto-t: hwsim.py: support async radio creation
Adds a new wait argument which, if false, will call the DBus method
and return immediately. This allows the caller to create multiple
radios very quickly, simulating (as close as we can) a wifi card
with dual phy's which appear in the kernel simultaneously.
The name argument was also changed to be mandatory, which is now
required by hwsim.
Diffstat:
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/autotests/util/hwsim.py b/autotests/util/hwsim.py
@@ -309,26 +309,35 @@ class RadioList(collections.Mapping):
def _interfaces_removed_handler(self, path, interfaces):
del _dict[path]
- def create(self, name=None, p2p_device=False, iftype_disable=None,
- cipher_disable=None):
+ def create(self, name, p2p_device=False, iftype_disable=None,
+ cipher_disable=None, wait=True):
args = dbus.Dictionary({
+ 'Name': name,
'P2P': p2p_device,
}, signature='sv')
- if name:
- args['Name'] = name
-
if iftype_disable:
args['InterfaceTypeDisable'] = iftype_disable
if cipher_disable:
args['CipherTypeDisable'] = cipher_disable
+ if not wait:
+ self._radio_manager.CreateRadio(args, reply_handler=self._success,
+ error_handler=self._failure)
+ return None
+
path = self._radio_manager.CreateRadio(args)
obj = Radio(path)
self._dict[path] = obj
return obj
+ def _success(self, bla):
+ pass
+
+ def _failure(self, ex):
+ pass
+
class Hwsim(iwd.AsyncOpAbstract):
_instances = WeakValueDictionary()