Skip to content

Commit

Permalink
[fix] Fixed madwifi driver for legacy systems
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Feb 15, 2021
1 parent 15fd53f commit 0b598e1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/source/backends/openwrt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ also requires setting the following additional options for each radio in the lis
+--------------+---------+-----------------------------------------------+
| key name | type | allowed values |
+==============+=========+===============================================+
| ``driver`` | string | mac80211, madwifi, ath5k, ath9k, broadcom |
| ``driver`` | string | mac80211, atheros, ath5k, ath9k, broadcom |
+--------------+---------+-----------------------------------------------+
| ``protocol`` | string | 802.11a, 802.11b, 802.11g, 802.11n, 802.11ac |
+--------------+---------+-----------------------------------------------+
Expand Down
2 changes: 2 additions & 0 deletions netjsonconfig/backends/openwrt/converters/radios.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def __intermediate_radio(self, radio):
# determine channel width
if radio['type'] == 'mac80211':
radio['htmode'] = self.__intermediate_htmode(radio)
else:
del radio['protocol']
# ensure country is uppercase
if 'country' in radio:
radio['country'] = radio['country'].upper()
Expand Down
2 changes: 1 addition & 1 deletion netjsonconfig/backends/openwrt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"properties": {
"driver": {
"type": "string",
"enum": ["mac80211", "madwifi", "ath5k", "ath9k", "broadcom"],
"enum": ["mac80211", "atheros", "ath5k", "ath9k", "broadcom"],
"default": default_radio_driver,
"propertyOrder": 2,
}
Expand Down
30 changes: 30 additions & 0 deletions tests/openwrt/test_radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,36 @@ def test_render_radio_list_option(self):
)
self.assertEqual(o.render(), expected)

def test_render_atheros_driver(self):
expected = self._tabs(
"""package wireless
config wifi-device 'wifi0'
option channel '6'
option channel_width '20'
option disabled '0'
option hwmode '11g'
option phy 'wifi0'
option type 'atheros'
"""
)
o = OpenWrt(
{
"radios": [
{
"protocol": "802.11g",
"name": "wifi0",
"phy": "wifi0",
"channel": 6,
"channel_width": 20,
"disabled": False,
"driver": "atheros",
}
]
}
)
self.assertEqual(o.render(), expected)

def test_parse_radio_list_option(self):
native = self._tabs(
"""package wireless
Expand Down

0 comments on commit 0b598e1

Please sign in to comment.