Skip to content

Commit 0b598e1

Browse files
committed
[fix] Fixed madwifi driver for legacy systems
1 parent 15fd53f commit 0b598e1

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

docs/source/backends/openwrt.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ also requires setting the following additional options for each radio in the lis
13531353
+--------------+---------+-----------------------------------------------+
13541354
| key name | type | allowed values |
13551355
+==============+=========+===============================================+
1356-
| ``driver`` | string | mac80211, madwifi, ath5k, ath9k, broadcom |
1356+
| ``driver`` | string | mac80211, atheros, ath5k, ath9k, broadcom |
13571357
+--------------+---------+-----------------------------------------------+
13581358
| ``protocol`` | string | 802.11a, 802.11b, 802.11g, 802.11n, 802.11ac |
13591359
+--------------+---------+-----------------------------------------------+

netjsonconfig/backends/openwrt/converters/radios.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __intermediate_radio(self, radio):
2828
# determine channel width
2929
if radio['type'] == 'mac80211':
3030
radio['htmode'] = self.__intermediate_htmode(radio)
31+
else:
32+
del radio['protocol']
3133
# ensure country is uppercase
3234
if 'country' in radio:
3335
radio['country'] = radio['country'].upper()

netjsonconfig/backends/openwrt/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
"properties": {
212212
"driver": {
213213
"type": "string",
214-
"enum": ["mac80211", "madwifi", "ath5k", "ath9k", "broadcom"],
214+
"enum": ["mac80211", "atheros", "ath5k", "ath9k", "broadcom"],
215215
"default": default_radio_driver,
216216
"propertyOrder": 2,
217217
}

tests/openwrt/test_radio.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,36 @@ def test_render_radio_list_option(self):
617617
)
618618
self.assertEqual(o.render(), expected)
619619

620+
def test_render_atheros_driver(self):
621+
expected = self._tabs(
622+
"""package wireless
623+
624+
config wifi-device 'wifi0'
625+
option channel '6'
626+
option channel_width '20'
627+
option disabled '0'
628+
option hwmode '11g'
629+
option phy 'wifi0'
630+
option type 'atheros'
631+
"""
632+
)
633+
o = OpenWrt(
634+
{
635+
"radios": [
636+
{
637+
"protocol": "802.11g",
638+
"name": "wifi0",
639+
"phy": "wifi0",
640+
"channel": 6,
641+
"channel_width": 20,
642+
"disabled": False,
643+
"driver": "atheros",
644+
}
645+
]
646+
}
647+
)
648+
self.assertEqual(o.render(), expected)
649+
620650
def test_parse_radio_list_option(self):
621651
native = self._tabs(
622652
"""package wireless

0 commit comments

Comments
 (0)