3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +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): def _interfaces_removed_handler(self, path, interfaces):
del _dict[path] del _dict[path]
def create(self, name=None, p2p_device=False, iftype_disable=None, def create(self, name, p2p_device=False, iftype_disable=None,
cipher_disable=None): cipher_disable=None, wait=True):
args = dbus.Dictionary({ args = dbus.Dictionary({
'Name': name,
'P2P': p2p_device, 'P2P': p2p_device,
}, signature='sv') }, signature='sv')
if name:
args['Name'] = name
if iftype_disable: if iftype_disable:
args['InterfaceTypeDisable'] = iftype_disable args['InterfaceTypeDisable'] = iftype_disable
if cipher_disable: if cipher_disable:
args['CipherTypeDisable'] = 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) path = self._radio_manager.CreateRadio(args)
obj = Radio(path) obj = Radio(path)
self._dict[path] = obj self._dict[path] = obj
return obj return obj
def _success(self, bla):
pass
def _failure(self, ex):
pass
class Hwsim(iwd.AsyncOpAbstract): class Hwsim(iwd.AsyncOpAbstract):
_instances = WeakValueDictionary() _instances = WeakValueDictionary()