Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gluon-core: lua: wireless: add support for PHYs named in board.json #3435

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions package/gluon-core/luasrc/usr/lib/lua/gluon/wireless.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@ local util = require 'gluon.util'
local unistd = require 'posix.unistd'

local iwinfo = require 'iwinfo'
local json = require 'jsonc'

local M = {}

local wlan_data

function M.find_phy(config)
-- Avoid loading board.json if config.phy isn't set
if config.phy then
if not wlan_data then
local board_data = json.load('/etc/board.json')
wlan_data = board_data.wlan or {}
end

local path = (wlan_data[config.phy] or {}).path
if path then
-- Currently only used on mediatek-mt7622. On all other targets,
-- wlan_data will not have any PHY entries, so path will be nil.
return iwinfo.nl80211.phyname('path=' .. path)
end
end

return iwinfo.nl80211.phyname(config['.name'])
end

Expand Down