mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
mtwifi-cfg: add support for tri-band models
This commit is contained in:
parent
7b6369185e
commit
1bfe4ec86b
@ -148,7 +148,7 @@ function l1dat_parser.load_l1_profile(path)
|
||||
end
|
||||
end
|
||||
})
|
||||
local nixio = require("nixio")
|
||||
--local nixio = require("nixio")
|
||||
local chipset_num = {}
|
||||
local dir = io.popen("ls /etc/wireless/")
|
||||
if not dir then return end
|
||||
@ -167,9 +167,9 @@ function l1dat_parser.load_l1_profile(path)
|
||||
k1, k2 = string.match(k, "INDEX(%d+)_(.+)")
|
||||
if k1 then
|
||||
k1 = tonumber(k1) + 1
|
||||
if devs[k1][k2] then
|
||||
nixio.syslog("warning", "skip repeated key"..line)
|
||||
end
|
||||
--if devs[k1][k2] then
|
||||
-- nixio.syslog("warning", "skip repeated key"..line)
|
||||
--end
|
||||
devs[k1][k2] = v or ""
|
||||
else
|
||||
k1 = string.match(k, "INDEX(%d+)")
|
||||
|
@ -26,14 +26,27 @@ function show_usage()
|
||||
end
|
||||
|
||||
function show_devs()
|
||||
local devs = {}
|
||||
local ret = ""
|
||||
for k, _ in pairs(l1dat.devname_ridx) do
|
||||
if #ret > 0 then
|
||||
ret = ret .. " " .. k
|
||||
else
|
||||
ret = k
|
||||
|
||||
for k, v in pairs(l1dat.devname_ridx) do
|
||||
-- skip MT7986-2.4G for ax7800 project
|
||||
if not(string.find(v.profile_path, "ax7800") and
|
||||
v.INDEX == "MT7986" and v.subidx == 1) then
|
||||
table.insert(devs, k)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(devs)
|
||||
|
||||
for _,v in ipairs(devs) do
|
||||
if #ret > 0 then
|
||||
ret = ret .. " " .. v
|
||||
else
|
||||
ret = v
|
||||
end
|
||||
end
|
||||
|
||||
print(ret)
|
||||
end
|
||||
|
||||
|
@ -92,12 +92,14 @@ end
|
||||
function ifup(ifname)
|
||||
if ifname and #ifname > 0 then
|
||||
os.execute("ifconfig "..ifname.." up")
|
||||
nixio.syslog("info", "mtwifi-cfg: ifconfig up "..ifname)
|
||||
end
|
||||
end
|
||||
|
||||
function ifdown(ifname)
|
||||
if ifname and #ifname > 0 then
|
||||
os.execute("ifconfig "..ifname.." down")
|
||||
nixio.syslog("info", "mtwifi-cfg: ifconfig down "..ifname)
|
||||
end
|
||||
end
|
||||
|
||||
@ -184,11 +186,12 @@ end
|
||||
function mtwifi_up(devname, cfg, restore_vifs, is_dbdc)
|
||||
nixio.syslog("info", "mtwifi-cfg: start "..devname)
|
||||
local dev = l1dat.devname_ridx[devname]
|
||||
local dbdc_main_ifname = defs.dbdc_init_ifname
|
||||
|
||||
if not dev then return end
|
||||
|
||||
if is_dbdc then
|
||||
local dbdc_main_dev = dev.INDEX .. "_1_1"
|
||||
local dbdc_main_ifname = l1dat.devname_ridx[dbdc_main_dev].main_ifname
|
||||
|
||||
if not is_dbdc_inited(dbdc_main_ifname) then
|
||||
nixio.syslog("info", "mtwifi-cfg: dbdc card init...")
|
||||
ifup(dbdc_main_ifname)
|
||||
@ -318,7 +321,9 @@ function set_chip_cfg(cfg, dats)
|
||||
|
||||
-- setup other dev cfg
|
||||
for k,v in pairs(l1dat.devname_ridx) do
|
||||
if k ~= cfg.device then
|
||||
if k ~= cfg.device and
|
||||
v.INDEX == l1dat.devname_ridx[cfg.device].INDEX and
|
||||
v.mainidx == l1dat.devname_ridx[cfg.device].mainidx then
|
||||
dev_dats = load_profile(v.profile_path)
|
||||
if dev_dats then
|
||||
for _,j in pairs(defs.chip_cfgs) do
|
||||
@ -641,18 +646,22 @@ function mtwifi_cfg_setup(argv)
|
||||
end
|
||||
|
||||
if restart_other_dbdc_dev then
|
||||
for k, _ in pairs(l1dat.devname_ridx) do
|
||||
local ret = mtwifi_down(k, cfg)
|
||||
for _, v in ipairs(ret) do
|
||||
table.insert(restore_vifs, v)
|
||||
for k, j in pairs(l1dat.devname_ridx) do
|
||||
if j.INDEX == dev.INDEX and j.mainidx == dev.mainidx then
|
||||
local ret = mtwifi_down(k, cfg)
|
||||
for _, v in ipairs(ret) do
|
||||
table.insert(restore_vifs, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
if #restore_vifs > 0 then
|
||||
nixio.syslog("info", "mtwifi-cfg: dbdc restore_vifs: "..inspect.inspect(restore_vifs))
|
||||
end
|
||||
|
||||
for k, _ in pairs(l1dat.devname_ridx) do
|
||||
mtwifi_up(k, cfg, restore_vifs, true)
|
||||
for k, j in pairs(l1dat.devname_ridx) do
|
||||
if j.INDEX == dev.INDEX and j.mainidx == dev.mainidx then
|
||||
mtwifi_up(k, cfg, restore_vifs, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
mtwifi_down(devname)
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
local mtwifi_defs = {}
|
||||
|
||||
mtwifi_defs.dbdc_init_ifname = "ra0"
|
||||
mtwifi_defs.max_mbssid = 16
|
||||
mtwifi_defs.max_acl_entry = 129
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user