diff --git a/apparse/iw_device_parser.py b/apparse/iw_device_parser.py index 1d01f13..094eb25 100644 --- a/apparse/iw_device_parser.py +++ b/apparse/iw_device_parser.py @@ -6,7 +6,7 @@ class IwDeviceParser(BaseParser): """Parser for a device list of the iw utility""" - _channel_regex = re.compile(r'^(?P\d+) \((?P\d+) MHz\)') + _channel_regex = re.compile(r'^(?P\d+) \((?P\d+) MHz\)(?:, width: (?P\d+) MHz)') _tx_power_regex = re.compile(r'^(?P\d+\.\d+) dBm$') _default_keys = ( @@ -15,6 +15,7 @@ class IwDeviceParser(BaseParser): 'type', 'channel', 'frequency', + 'width', 'tx_power' ) _parser_keys = { @@ -65,6 +66,8 @@ def parse(self, data): elif key == 'channel': self._data[self._current]['channel'] = int(groups['channel']) self._data[self._current]['frequency'] = int(groups['frequency']) + if groups['width'] is not None: + self._data[self._current]['width'] = int(groups['width']) elif key == 'txpower': self._data[self._current]['tx_power'] = float(groups['tx_power'])