Skip to content

Commit 47b4435

Browse files
authored
[fix] Removed option of 2.4GHz radio for 802.11ac #190
Closes #190
1 parent a90813c commit 47b4435

6 files changed

Lines changed: 11 additions & 50 deletions

File tree

docs/source/backends/openwrt.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,9 +1417,8 @@ Automatic channel selection example
14171417
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14181418

14191419
If you need to use the "automatic channel selection" feature of OpenWRT, you must set
1420-
the channel to ``0`` and, unless you are using neither **802.11n** nor **802.11ac** nor **802.11ax**,
1421-
you must set the ``hwmode`` property to tell OpenWRT which band to use
1422-
(11g for 2.4 Ghz, 11a for 5 GHz).
1420+
the channel to ``0``. You must also set the ``hwmode`` property to tell OpenWRT which
1421+
band to use (11g for 2.4 Ghz, 11a for 5 GHz).
14231422

14241423
The following example sets "automatic channel selection" for two radios, the first radio uses
14251424
**802.11n** in the 2.4 GHz band, while the second uses **802.11ac** in the 5 GHz band.
@@ -1443,7 +1442,9 @@ The following example sets "automatic channel selection" for two radios, the fir
14431442
"driver": "mac80211",
14441443
"protocol": "802.11ac",
14451444
"channel": 0, # 0 stands for auto
1446-
"hwmode": "11a", # must set this explicitly, 11a means 5 GHz band
1445+
"hwmode": "11a", # must set this explicitly, 11a means 5 GHz band,
1446+
# but this is optional for "802.11ac" because it only
1447+
# support 5 GHz band.
14471448
"channel_width": 80
14481449
}
14491450
]

netjsonconfig/backends/openwrt/converters/radios.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def __intermediate_hwmode(self, radio):
4343
if protocol in ['802.11a', '802.11b', '802.11g']:
4444
# return 11a, 11b or 11g
4545
return protocol[4:]
46+
if protocol == '802.11ac':
47+
return '11a'
4648
# determine hwmode depending on channel used
4749
if radio['channel'] == 0:
4850
# when using automatic channel selection, we need an

netjsonconfig/backends/openwrt/schema.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,6 @@
465465
"radio_80211an_settings": {
466466
"allOf": [{"$ref": "#/definitions/radio_hwmode_11a"}]
467467
},
468-
"radio_80211ac_2ghz_settings": {
469-
"allOf": [{"$ref": "#/definitions/radio_hwmode_11g"}]
470-
},
471468
"radio_80211ac_5ghz_settings": {
472469
"allOf": [{"$ref": "#/definitions/radio_hwmode_11a"}]
473470
},

netjsonconfig/schema.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -783,15 +783,6 @@
783783
{"$ref": "#/definitions/radio_n_channel_width"},
784784
],
785785
},
786-
"radio_80211ac_2ghz_settings": {
787-
"title": "802.11ac (2.4 GHz AC)",
788-
"allOf": [
789-
{"properties": {"protocol": {"enum": ["802.11ac"]}}},
790-
{"$ref": "#/definitions/base_radio_settings"},
791-
{"$ref": "#/definitions/radio_2ghz_channels"},
792-
{"$ref": "#/definitions/radio_ac_channel_width"},
793-
],
794-
},
795786
"radio_80211ac_5ghz_settings": {
796787
"title": "802.11ac (5 GHz AC)",
797788
"allOf": [
@@ -875,7 +866,6 @@
875866
"oneOf": [
876867
{"$ref": "#/definitions/radio_80211gn_settings"},
877868
{"$ref": "#/definitions/radio_80211an_settings"},
878-
{"$ref": "#/definitions/radio_80211ac_2ghz_settings"},
879869
{"$ref": "#/definitions/radio_80211ac_5ghz_settings"},
880870
{"$ref": "#/definitions/radio_80211ax_2ghz_settings"},
881871
{"$ref": "#/definitions/radio_80211ax_5ghz_settings"},

tests/openwrt/test_netjson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
{
2828
"name": "radio0",
2929
"protocol": "802.11ac",
30-
"channel": 1,
30+
"channel": 132,
3131
"channel_width": 80,
3232
"phy": "phy0",
3333
"country": "US",

tests/openwrt/test_radio.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -472,35 +472,6 @@ def test_parse_auto_80211n_5ghz_channel(self):
472472
o = OpenWrt(native=native)
473473
self.assertEqual(o.config, expected)
474474

475-
def test_auto_80211ac_2ghz_channel(self):
476-
o = OpenWrt(
477-
{
478-
"radios": [
479-
{
480-
"name": "radio0",
481-
"phy": "phy0",
482-
"driver": "mac80211",
483-
"protocol": "802.11ac",
484-
"channel": 0,
485-
"channel_width": 80,
486-
"hwmode": "11g",
487-
}
488-
]
489-
}
490-
)
491-
expected = self._tabs(
492-
"""package wireless
493-
494-
config wifi-device 'radio0'
495-
option channel 'auto'
496-
option htmode 'VHT80'
497-
option hwmode '11g'
498-
option phy 'phy0'
499-
option type 'mac80211'
500-
"""
501-
)
502-
self.assertEqual(o.render(), expected)
503-
504475
def test_auto_80211ac_5ghz_channel(self):
505476
o = OpenWrt(
506477
{
@@ -827,7 +798,7 @@ def test_default_driver(self):
827798
{
828799
"name": "radio0",
829800
"protocol": "802.11ac",
830-
"channel": 1,
801+
"channel": 132,
831802
"channel_width": 80,
832803
"phy": "phy0",
833804
"country": "US",
@@ -841,11 +812,11 @@ def test_default_driver(self):
841812
"""package wireless
842813
843814
config wifi-device 'radio0'
844-
option channel '1'
815+
option channel '132'
845816
option country 'US'
846817
option disabled '0'
847818
option htmode 'VHT80'
848-
option hwmode '11g'
819+
option hwmode '11a'
849820
option phy 'phy0'
850821
option txpower '10'
851822
option type 'mac80211'

0 commit comments

Comments
 (0)