[PATCH 2/3] hwsim: Support creating radio with specific name.
greearb at candelatech.com
greearb
Fri Oct 24 08:37:55 PDT 2014
From: Ben Greear <greearb at candelatech.com>
Makes it easier to automate tests.
Signed-off-by: Ben Greear <greearb at candelatech.com>
---
tests/hwsim/hwsim.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
index da06627..dec273d 100644
--- a/tests/hwsim/hwsim.py
+++ b/tests/hwsim/hwsim.py
@@ -25,12 +25,14 @@ class HWSimController(object):
self._conn = netlink.Connection(netlink.NETLINK_GENERIC)
self._fid = netlink.genl_controller.get_family_id('MAC80211_HWSIM')
- def create_radio(self, n_channels=None, use_chanctx=False):
+ def create_radio(self, n_channels=None, use_chanctx=False, hwname=None):
attrs = []
if n_channels:
attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
if use_chanctx:
attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX))
+ if hwname:
+ attrs.append(netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, hwname))
msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
flags = netlink.NLM_F_REQUEST |
@@ -52,7 +54,8 @@ class HWSimController(object):
def create(args):
print 'Created radio %d' % c.create_radio(n_channels=args.channels,
- use_chanctx=args.chanctx)
+ use_chanctx=args.chanctx,
+ hwname=args.radio_name)
def destroy(args):
print c.destroy_radio(args.radio)
@@ -77,6 +80,10 @@ if __name__ == '__main__':
'greater. By default channel contexts are ' +
'only used if the number of channels is ' +
'greater than 1.')
+ parser_create.add_argument('--radio_name', metavar='<radio-name>', type=str,
+ default="",
+ help='Optional radio name to request for the new ' +
+ 'radio.')
parser_create.set_defaults(func=create)
parser_destroy = subparsers.add_parser('destroy', help='destroy a radio')
--
1.7.11.7
More information about the Hostap
mailing list