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
|
local hardware_mac
|
||||||
if wifi_mac == "" or mac2 == "" then
|
if wifi_mac == "" or mac2 == "" then
|
||||||
local wlan = get_ifname("wifi")
|
if aredn.hardware.has_wifi() then
|
||||||
if wlan then
|
|
||||||
local phy
|
local phy
|
||||||
for i = 1,5
|
for i = 1,5
|
||||||
|
do
|
||||||
|
for _, wlan in ipairs({ "wlan0", "wlan1" })
|
||||||
do
|
do
|
||||||
local f = io.popen("iwinfo " .. wlan .. " info")
|
local f = io.popen("iwinfo " .. wlan .. " info")
|
||||||
if f then
|
if f then
|
||||||
|
@ -74,8 +75,8 @@ if wifi_mac == "" or mac2 == "" then
|
||||||
if phy then
|
if phy then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
sleep(5)
|
|
||||||
end
|
end
|
||||||
|
if phy then
|
||||||
for line in io.lines("/sys/class/ieee80211/" .. phy .. "/macaddress")
|
for line in io.lines("/sys/class/ieee80211/" .. phy .. "/macaddress")
|
||||||
do
|
do
|
||||||
local m = line:match("(%w%w:%w%w:%w%w:%w%w:%w%w:%w%w)")
|
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
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
sleep(5)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not hardware_mac then
|
if not hardware_mac then
|
||||||
if not aredn.hardware.has_wifi() then
|
if not aredn.hardware.has_wifi() then
|
||||||
|
|
|
@ -171,12 +171,15 @@ 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
|
||||||
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
|
if basefreq > 3000 and basefreq < 5000 then
|
||||||
wifi_channel = wifi_channel * 5 + 3000
|
wifi_channel = wifi_channel * 5 + 3000
|
||||||
elseif basefreq > 900 and basefreq < 2300 then
|
elseif basefreq > 900 and basefreq < 2300 then
|
||||||
wifi_channel = wifi_channel * 5 + 887
|
wifi_channel = wifi_channel * 5 + 887
|
||||||
end
|
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"
|
||||||
cursor:foreach("wireless", "wifi-iface",
|
cursor:foreach("wireless", "wifi-iface",
|
||||||
|
|
Loading…
Reference in New Issue