mirror of https://github.com/aredn/aredn.git
Fix frequency range reporting and display for 900MHz devices (#803)
This commit is contained in:
parent
8711afa9ca
commit
be969b1e63
|
@ -271,13 +271,19 @@ function hardware.get_rfchannels(wifiintf)
|
||||||
local f = io.popen("iwinfo " .. wifiintf .. " freqlist")
|
local f = io.popen("iwinfo " .. wifiintf .. " freqlist")
|
||||||
if f then
|
if f then
|
||||||
local freq_adjust = 0
|
local freq_adjust = 0
|
||||||
|
local freq_min = 0
|
||||||
|
local freq_max = 0x7FFFFFFF
|
||||||
if wifiintf == "wlan0" then
|
if wifiintf == "wlan0" then
|
||||||
local radio = hardware.get_radio()
|
local radio = hardware.get_radio()
|
||||||
if radio then
|
if radio then
|
||||||
if radio.name:match("M9") then
|
if radio.name:match("M9") then
|
||||||
freq_adjust = -1520;
|
freq_adjust = -1520;
|
||||||
|
freq_min = 907
|
||||||
|
freq_max = 922
|
||||||
elseif radio.name:match("M3") then
|
elseif radio.name:match("M3") then
|
||||||
freq_adjust = -2000;
|
freq_adjust = -2000;
|
||||||
|
freq_min = 3380
|
||||||
|
freq_max = 3495
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -286,14 +292,16 @@ function hardware.get_rfchannels(wifiintf)
|
||||||
local freq, num = line:match("(%d+%.%d+) GHz %(Channel (%-?%d+)%)")
|
local freq, num = line:match("(%d+%.%d+) GHz %(Channel (%-?%d+)%)")
|
||||||
if freq and not line:match("restricted") and not line:match("disabled") then
|
if freq and not line:match("restricted") and not line:match("disabled") then
|
||||||
freq = tonumber("" .. freq:gsub("%.", "")) + freq_adjust
|
freq = tonumber("" .. freq:gsub("%.", "")) + freq_adjust
|
||||||
|
if freq >= freq_min and freq <= freq_max then
|
||||||
num = tonumber("" .. num:gsub("^0+", ""))
|
num = tonumber("" .. num:gsub("^0+", ""))
|
||||||
channels[#channels + 1] = {
|
channels[#channels + 1] = {
|
||||||
label = num .. " (" .. freq .. ")",
|
label = freq_adjust == 0 and (num .. " (" .. freq .. ")") or (freq),
|
||||||
number = num,
|
number = num,
|
||||||
frequency = freq
|
frequency = freq
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
return channels
|
return channels
|
||||||
|
|
|
@ -181,8 +181,11 @@ local wifi_ssid
|
||||||
if not wifi_disabled then
|
if not wifi_disabled then
|
||||||
wifi_channel = cursor:get("wireless", radio, "channel")
|
wifi_channel = cursor:get("wireless", radio, "channel")
|
||||||
wifi_channel = tonumber(wifi_channel) or 0
|
wifi_channel = tonumber(wifi_channel) or 0
|
||||||
if wifi_channel >= 76 and wifi_channel <= 99 then
|
local basefreq = aredn.hardware.get_rfchannels(wifi_iface)[1].frequency
|
||||||
|
if basefreq > 3000 and basefreq < 5600 then
|
||||||
wifi_channel = wifi_channel * 5 + 3000
|
wifi_channel = wifi_channel * 5 + 3000
|
||||||
|
elseif basefreq > 900 and basefreq < 2300 then
|
||||||
|
wifi_channel = wifi_channel * 5 + 887
|
||||||
end
|
end
|
||||||
wifi_chanbw = cursor:get("wireless", radio, "chanbw") or "20"
|
wifi_chanbw = cursor:get("wireless", radio, "chanbw") or "20"
|
||||||
wifi_ssid = "none"
|
wifi_ssid = "none"
|
||||||
|
|
Loading…
Reference in New Issue