From 741becfefa511a7a82f9aa8207baedd3a319badd Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Fri, 17 Feb 2023 20:58:51 -0800 Subject: [PATCH] Improve AP band selection. (#718) --- files/www/cgi-bin/setup | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index a2306040..60ba2264 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -670,7 +670,7 @@ if parms.button_save then end end - if phycount > 1 and wifi_enable == "1" and wifi2_channel < 36 and wifi2_enable == "1" then + if phycount > 1 and wifi_enable == "1" and wifi2_enable == "1" and (wifi_channel < 36) == (wifi2_channel < 36) then err("Mesh RF and LAN Access Point can not both use the same wireless card, review LAN AP settings") end if phycount > 1 and wifi_enable == "0" and wifi2_enable == "1" and wifi3_enable == "1" and wifi2_hwmode == wifi3_hwmode then @@ -1214,7 +1214,7 @@ if APokay and ((phycount > 1 and (wifi_enable ~= "1" or wifi3_enable ~= "1")) or -- lan ap shows as an option -- determine hardware options and set band ahd channels accordingly if phycount == 1 then - local rc3 = os.execute("iw phy phy0 info | grep -q '5180 MHz' > /dev/null") + local rc3 = os.execute("iw phy phy0 info | grep -v disabled | grep -q '5180 MHz' > /dev/null") if rc3 ~= 0 then wifi2_hwmode = "11g" if wifi2_channel > 14 then @@ -1231,11 +1231,20 @@ if APokay and ((phycount > 1 and (wifi_enable ~= "1" or wifi3_enable ~= "1")) or else -- 2 band device if wifi_enable == "1" then - wifi2_hwmode = "11a" - if wifi2_channel < 36 then - wifi2_channel = 36 + local rc3 = os.execute("iw phy phy1 info | grep -v disabled | grep -q '5180 MHz' > /dev/null") + if rc3 ~= 0 then + wifi2_hwmode = "11g" + if wifi2_channel > 14 then + wifi2_channel = 1 + end + chan = ctwo + else + wifi2_hwmode = "11a" + if wifi2_channel < 36 then + wifi2_channel = 36 + end + chan = cfive end - chan = cfive else if wifi2_enable ~= "1" and wifi3_enable == "1" and wifi3_hwmode == "11a" then wifi2_hwmode = "11g" @@ -1258,12 +1267,14 @@ if APokay and ((phycount > 1 and (wifi_enable ~= "1" or wifi3_enable ~= "1")) or end html.print("LAN Access PointEnable  ") if phycount > 1 then - html.print("AP band") html.print("") + html.print("") + html.print("") + else + hidden[#hidden + 1] = "" end - html.print("") - html.print("") else hidden[#hidden + 1] = "" end