3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +01:00

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.
This commit is contained in:
James Prestwood 2022-02-16 11:39:43 -08:00 committed by Denis Kenzior
parent 4ebc79c466
commit 15c0920777

View File

@ -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()