mirror of https://github.com/aredn/aredn.git
Fix Mikrotik first install where the radios are not necessarily available. (#882)
This commit is contained in:
parent
adab218868
commit
0532afdbbf
|
@ -55,10 +55,11 @@ local dtdmac = aredn_info.get_nvram("dtdmac")
|
|||
|
||||
local hardware_mac
|
||||
if wifi_mac == "" or mac2 == "" then
|
||||
local wlan = get_ifname("wifi")
|
||||
if wlan then
|
||||
if aredn.hardware.has_wifi() then
|
||||
local phy
|
||||
for i = 1,5
|
||||
do
|
||||
for _, wlan in ipairs({ "wlan0", "wlan1" })
|
||||
do
|
||||
local f = io.popen("iwinfo " .. wlan .. " info")
|
||||
if f then
|
||||
|
@ -74,8 +75,8 @@ if wifi_mac == "" or mac2 == "" then
|
|||
if phy then
|
||||
break
|
||||
end
|
||||
sleep(5)
|
||||
end
|
||||
if phy then
|
||||
for line in io.lines("/sys/class/ieee80211/" .. phy .. "/macaddress")
|
||||
do
|
||||
local m = line:match("(%w%w:%w%w:%w%w:%w%w:%w%w:%w%w)")
|
||||
|
@ -84,6 +85,10 @@ if wifi_mac == "" or mac2 == "" then
|
|||
break
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
sleep(5)
|
||||
end
|
||||
end
|
||||
if not hardware_mac then
|
||||
if not aredn.hardware.has_wifi() then
|
||||
|
|
|
@ -171,12 +171,15 @@ local wifi_ssid
|
|||
if not wifi_disabled then
|
||||
wifi_channel = cursor:get("wireless", radio, "channel")
|
||||
wifi_channel = tonumber(wifi_channel) or 0
|
||||
local basefreq = aredn.hardware.get_rfchannels(wifi_iface)[1].frequency
|
||||
local rfchans = aredn.hardware.get_rfchannels(wifi_iface)
|
||||
if rfchans and rfchans[1] then
|
||||
local basefreq = rfchans[1].frequency
|
||||
if basefreq > 3000 and basefreq < 5000 then
|
||||
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_ssid = "none"
|
||||
cursor:foreach("wireless", "wifi-iface",
|
||||
|
|
Loading…
Reference in New Issue