Skip to content

Commit

Permalink
Merge pull request #1071 from pony1k/issue/1063
Browse files Browse the repository at this point in the history
lime.wireless: Fix wireless.is5Ghz
  • Loading branch information
G10h4ck authored Jan 25, 2024
2 parents 5a50b6f + 0c5b5d5 commit 0d30e2c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/lime-system/files/usr/lib/lua/lime/wireless.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ function wireless.scandevices()
end

function wireless.is5Ghz(radio)
local devModes = iwinfo.nl80211.hwmodelist(radio)
return devModes.a or devModes.ac
local config = require("lime.config")
local uci = config.get_uci_cursor()
wifi_band = uci:get('wireless', radio, 'band')
if wifi_band then return wifi_band=='5g' end
wifi_channel = uci:get('wireless', radio, 'channel')
if tonumber(wifi_channel) then
wifi_channel = tonumber(wifi_channel)
return 32<=wifi_channel and wifi_channel<178
end
local backend = iwinfo.type(radio)
local devModes = backend and iwinfo[backend].hwmodelist(radio)
return devModes and (devModes.a or devModes.ac)
end

wireless.availableModes = { adhoc=true, ap=true, apname=true, apbb=true, ieee80211s=true }
Expand Down

0 comments on commit 0d30e2c

Please sign in to comment.