Revert "mtk: add mt7615 driver and luci support"

This reverts commit ba30683611.
This commit is contained in:
coolsnowwolf 2019-04-25 10:22:09 +08:00
parent c1c24e78b9
commit b0f3d59266
52 changed files with 0 additions and 12171 deletions

View File

@ -1,75 +0,0 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/version.mk
PKG_NAME:=mtk-luci-plugin
PKG_RELEASE:=1
PKG_BUILD_DEPENDS:=base-files
PKG_FILE_DEPENDS:=
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
include $(INCLUDE_DIR)/package.mk
HTDOCS = /www
LUA_LIBRARYDIR = /usr/lib/lua
LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci
define Package/mtk-luci-plugin
SECTION:=MTK Properties
CATEGORY:=MTK Properties
SUBMENU:=Misc
DEPENDS:=+lua
TITLE:=MTK's LuCI plugins.
VERSION:=$(PKG_RELEASE)-$(REVISION)
endef
define Package/mtk-luci-plugin/config
config LUCI_APP_MTKWIFI
bool "luci-app-mtkwifi"
depends on PACKAGE_mtk-luci-plugin
default y
help
"LuCI plugin to manipulate MTK WiFi drivers"
config LUCI_APP_WEBCONSOLE
bool "luci-app-webconsole"
depends on PACKAGE_mtk-luci-plugin
default y
help
"LuCI plugin for access shell from web"
endef
define Build/Compile
endef
define Package/common/install
if [ -d $(2)/luasrc ]; then \
$(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR); \
cp -pR ./$(2)/luasrc/* $(1)$(LUCI_LIBRARYDIR)/; \
else true; fi
if [ -d $(2)/htdocs ]; then \
$(INSTALL_DIR) $(1)$(HTDOCS); \
cp -pR ./$(2)/htdocs/* $(1)$(HTDOCS)/; \
else true; fi
if [ -d $(2)/root ]; then \
$(INSTALL_DIR) $(1)/; \
cp -pR ./$(2)/root/* $(1)/; \
else true; fi
if [ -d $(2)/src ]; then \
$(call Build/Install/Default) \
$(CP) ./$(PKG_INSTALL_DIR)/* $(1)/; \
else true; fi
endef
define Package/mtk-luci-plugin/install
$(call Package/common/install,$(1),luci-app-mtkwifi)
$(call Package/common/install,$(1),luci-app-webconsole)
endef
$(eval $(call BuildPackage,mtk-luci-plugin))

View File

@ -1,19 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_LICENSE:=GPLv2
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
LUCI_TITLE:=Manipulate mtk's proprietary wifi driver.
LUCI_DEPENDS:=
# earlier version of luci put "luci.mk" somewhere else...
LUCI_MK_OLDPATH:=$(shell test -e ../luci.mk && echo "old")
LUCI_MK_NEWPATH:=$(shell test -e ../../luci.mk && echo "new")
ifeq ($(LUCI_MK_OLDPATH),old)
include ../luci.mk
endif
ifeq ($(LUCI_MK_NEWPATH),new)
include ../../luci.mk
endif
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,845 +0,0 @@
-- This module is a demo to configure MTK' proprietary WiFi driver.
-- Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
-- LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
-- translate uci into MTK's WiFi profile (like we did in "uci2dat").
-- And you will get your hands dirty.
--
-- Hua Shao <nossiac@163.com>
module("luci.controller.mtkwifi", package.seeall)
local http = require("luci.http")
local mtkwifi = require("mtkwifi")
function __mtkwifi_reload(devname)
local profiles = mtkwifi.search_dev_and_profile()
for dev,profile in pairs(profiles) do
if not devname or devname == dev then
local diff = mtkwifi.diff_profile(profile)
-- Adding or deleting a vif will need to reinstall the wifi ko,
-- so we call "mtkwifi restart" here.
if diff.BssidNum then
os.execute("/sbin/mtkwifi restart "..devname)
else
os.execute("/sbin/mtkwifi reload "..devname)
end
-- keep a backup for this commit
-- it will be used in mtkwifi.diff_profile()
os.execute("cp -f "..profile.." "..mtkwifi.__profile_bak_path(profile))
end
end
end
function index()
local page
page = node("admin", "mtk")
page.target = firstchild()
page.title = _("MTK")
page.order = 80
page.index = true
entry({"admin", "mtk", "wifi"}, template("admin_mtk/mtk_wifi_overview"), _("WiFi configuration"), 1)
entry({"admin", "mtk", "wifi", "dev_cfg_view"}, template("admin_mtk/mtk_wifi_dev_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "dev_cfg"}, call("dev_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "dev_cfg_reset"}, call("dev_cfg_reset")).leaf = true
entry({"admin", "mtk", "wifi", "dev_cfg_raw"}, call("dev_cfg_raw")).leaf = true
entry({"admin", "mtk", "wifi", "vif_cfg_view"}, template("admin_mtk/mtk_wifi_vif_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "vif_cfg"}, call("vif_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "vif_add_view"}, template("admin_mtk/mtk_wifi_vif_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "vif_add"}, call("vif_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "vif_del"}, call("vif_del")).leaf = true
entry({"admin", "mtk", "wifi", "vif_disable"}, call("vif_disable")).leaf = true
entry({"admin", "mtk", "wifi", "vif_enable"}, call("vif_enable")).leaf = true
entry({"admin", "mtk", "wifi", "get_station_list"}, call("get_station_list"))
entry({"admin", "mtk", "wifi", "get_country_region_list"}, call("get_country_region_list")).leaf = true
entry({"admin", "mtk", "wifi", "get_channel_list"}, call("get_channel_list"))
entry({"admin", "mtk", "wifi", "get_HT_ext_channel_list"}, call("get_HT_ext_channel_list"))
entry({"admin", "mtk", "wifi", "get_5G_2nd_80Mhz_channel_list"}, call("get_5G_2nd_80Mhz_channel_list"))
entry({"admin", "mtk", "wifi", "reset"}, call("reset_wifi")).leaf = true
entry({"admin", "mtk", "wifi", "reload"}, call("reload_wifi")).leaf = true
entry({"admin", "mtk", "wifi", "get_raw_profile"}, call("get_raw_profile"))
entry({"admin", "mtk", "wifi", "apcli_cfg_view"}, template("admin_mtk/mtk_wifi_apcli")).leaf = true
entry({"admin", "mtk", "wifi", "apcli_cfg"}, call("apcli_cfg")).leaf = true
entry({"admin", "mtk", "wifi", "apcli_disconnect"}, call("apcli_disconnect")).leaf = true
entry({"admin", "mtk", "wifi", "apcli_connect"}, call("apcli_connect")).leaf = true
entry({"admin", "mtk", "wifi", "apcli_scan"}, call("apcli_scan")).leaf = true;
end
function dev_cfg(devname)
local profiles = mtkwifi.search_dev_and_profile()
assert(profiles[devname])
local cfgs = mtkwifi.load_profile(profiles[devname])
for k,v in pairs(http.formvalue()) do
if type(v) ~= type("") and type(v) ~= type(0) then
nixio.syslog("err", "dev_cfg, invalid value type for "..k..","..type(v))
elseif string.byte(k) == string.byte("_") then
nixio.syslog("err", "dev_cfg, special: "..k.."="..v)
else
cfgs[k] = v or ""
end
end
if mtkwifi.band(cfgs.WirelessMode) == "5G" then
cfgs.CountryRegionABand = http.formvalue("__cr");
else
cfgs.CountryRegion = http.formvalue("__cr");
end
if cfgs.Channel == "0" then -- Auto Channel Select
cfgs.AutoChannelSelect = "3"
else
cfgs.AutoChannelSelect = "0"
end
if http.formvalue("__bw") == "20" then
cfgs.HT_BW = 0
cfgs.VHT_BW = 0
elseif http.formvalue("__bw") == "40" then
cfgs.HT_BW = 1
cfgs.VHT_BW = 0
cfgs.HT_BSSCoexistence = 0
elseif http.formvalue("__bw") == "60" then
cfgs.HT_BW = 1
cfgs.VHT_BW = 0
cfgs.HT_BSSCoexistence = 1
elseif http.formvalue("__bw") == "80" then
cfgs.HT_BW = 1
cfgs.VHT_BW = 1
elseif http.formvalue("__bw") == "160" then
cfgs.HT_BW = 1
cfgs.VHT_BW = 2
elseif http.formvalue("__bw") == "161" then
cfgs.HT_BW = 1
cfgs.VHT_BW = 3
cfgs.VHT_Sec80_Channel = http.formvalue("VHT_Sec80_Channel") or ""
end
if cfgs.ApCliAuthMode == "WEP" then
cfgs.ApCliEncrypType = http.formvalue("__apcli_wep_enctype")
else
cfgs.ApCliEncrypType = http.formvalue("__apcli_wpa_enctype")
end
local mimo = http.formvalue("__mimo")
if mimo == "0" then
cfgs.ETxBfEnCond=1
cfgs.MUTxRxEnable=0
cfgs.ITxBfEn=0
elseif mimo == "1" then
cfgs.ETxBfEnCond=0
cfgs.MUTxRxEnable=0
cfgs.ITxBfEn=1
elseif mimo == "2" then
cfgs.ETxBfEnCond=1
cfgs.MUTxRxEnable=0
cfgs.ITxBfEn=1
elseif mimo == "3" then
cfgs.ETxBfEnCond=1
if tonumber(cfgs.ApCliEnable) == 1 then
cfgs.MUTxRxEnable=3
else
cfgs.MUTxRxEnable=1
end
cfgs.ITxBfEn=0
elseif mimo == "4" then
cfgs.ETxBfEnCond=1
if tonumber(cfgs.ApCliEnable) == 1 then
cfgs.MUTxRxEnable=3
else
cfgs.MUTxRxEnable=1
end
cfgs.ITxBfEn=1
else
cfgs.ETxBfEnCond=0
cfgs.MUTxRxEnable=0
cfgs.ITxBfEn=0
end
-- if cfgs.ApCliEnable == "1" then
-- cfgs.Channel = http.formvalue("__apcli_channel")
-- end
-- VOW
-- ATC should actually be scattered into each SSID, but I'm just lazy.
if cfgs.VOW_Airtime_Fairness_En then
for i = 1,tonumber(cfgs.BssidNum) do
__atc_tp = http.formvalue("__atc_vif"..i.."_tp") or "0"
__atc_min_tp = http.formvalue("__atc_vif"..i.."_min_tp") or "0"
__atc_max_tp = http.formvalue("__atc_vif"..i.."_max_tp") or "0"
__atc_at = http.formvalue("__atc_vif"..i.."_at") or "0"
__atc_min_at = http.formvalue("__atc_vif"..i.."_min_at") or "0"
__atc_max_at = http.formvalue("__atc_vif"..i.."_max_at") or "0"
nixio.syslog("info", "ATC.__atc_tp ="..i..__atc_tp );
nixio.syslog("info", "ATC.__atc_min_tp ="..i..__atc_min_tp );
nixio.syslog("info", "ATC.__atc_max_tp ="..i..__atc_max_tp );
nixio.syslog("info", "ATC.__atc_at ="..i..__atc_at );
nixio.syslog("info", "ATC.__atc_min_at ="..i..__atc_min_at );
nixio.syslog("info", "ATC.__atc_max_at ="..i..__atc_max_at );
cfgs.VOW_Rate_Ctrl_En = mtkwifi.token_set(cfgs.VOW_Rate_Ctrl_En, i, __atc_tp)
cfgs.VOW_Group_Min_Rate = mtkwifi.token_set(cfgs.VOW_Group_Min_Rate, i, __atc_min_tp)
cfgs.VOW_Group_Max_Rate = mtkwifi.token_set(cfgs.VOW_Group_Max_Rate, i, __atc_max_tp)
cfgs.VOW_Airtime_Ctrl_En = mtkwifi.token_set(cfgs.VOW_Airtime_Ctrl_En, i, __atc_at)
cfgs.VOW_Group_Min_Ratio = mtkwifi.token_set(cfgs.VOW_Group_Min_Ratio, i, __atc_min_at)
cfgs.VOW_Group_Max_Ratio = mtkwifi.token_set(cfgs.VOW_Group_Max_Ratio, i, __atc_max_at)
end
cfgs.VOW_RX_En = http.formvalue("VOW_RX_En") or "0"
end
-- http.write_json(http.formvalue())
mtkwifi.save_profile(cfgs, profiles[devname])
if http.formvalue("__apply") then
__mtkwifi_reload(devname)
end
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_view",devname))
end
function dev_cfg_raw(devname)
-- http.write_json(http.formvalue())
local profiles = mtkwifi.search_dev_and_profile()
assert(profiles[devname])
local raw = http.formvalue("raw")
raw = string.gsub(raw, "\r\n", "\n")
local cfgs = mtkwifi.load_profile(nil, raw)
mtkwifi.save_profile(cfgs, profiles[devname])
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_view", devname))
end
function dev_cfg_reset(devname)
-- http.write_json(http.formvalue())
local profiles = mtkwifi.search_dev_and_profile()
assert(profiles[devname])
local fd = io.open("/rom"..profiles[devname], "r")
if fd then
fd:close() -- just to test if file exists.
os.execute("cp -f /rom"..profiles[devname].." "..profiles[devname])
else
mtkwifi.debug("unable to find /rom"..profiles[devname])
end
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_view", devname))
end
function vif_del(dev, vif)
mtkwifi.debug("vif_del("..dev..vif..")")
local devname,vifname = dev, vif
mtkwifi.debug("devname="..devname)
mtkwifi.debug("vifname="..vifname)
local devs = mtkwifi.get_all_devs()
local idx = devs[devname]["vifs"][vifname].vifidx -- or tonumber(string.match(vifname, "%d+")) + 1
mtkwifi.debug("idx="..idx, devname, vifname)
local profile = devs[devname].profile
assert(profile)
if idx and tonumber(idx) >= 0 then
local cfgs = mtkwifi.load_profile(profile)
if cfgs then
mtkwifi.debug("ssid"..idx.."="..cfgs["SSID"..idx].."<br>")
cfgs["SSID"..idx] = ""
mtkwifi.debug("ssid"..idx.."="..cfgs["SSID"..idx].."<br>")
mtkwifi.debug("wpapsk"..idx.."="..cfgs["WPAPSK"..idx].."<br>")
cfgs["WPAPSK"..idx] = ""
local ssidlist = {}
local j = 1
for i = 1,16 do
if cfgs["SSID"..i] ~= "" then
ssidlist[j] = cfgs["SSID"..i]
j = j + 1
end
end
for i,v in ipairs(ssidlist) do
mtkwifi.debug("ssidlist"..i.."="..v)
end
mtkwifi.debug("cfgs.BssidNum="..cfgs.BssidNum.." #ssidlist="..#ssidlist)
assert(tonumber(cfgs.BssidNum) == #ssidlist + 1, "Please delete vif from larger idx.")
cfgs.BssidNum = #ssidlist
for i = 1,16 do
if i <= cfgs.BssidNum then
cfgs["SSID"..i] = ssidlist[i]
elseif cfgs["SSID"..i] then
cfgs["SSID"..i] = ""
end
end
mtkwifi.save_profile(cfgs, profile)
else
mtkwifi.debug(profile.." cannot be found!")
end
end
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
function vif_disable(iface)
os.execute("ifconfig "..iface.." down")
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
function vif_enable(iface)
os.execute("ifconfig "..iface.." up")
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
--[[
-- security config in mtk wifi is quite complicated!
-- cfgs listed below are attached with vif and combined like "0;0;0;0". They need specicial treatment.
TxRate, WmmCapable, NoForwarding,
HideSSID, IEEE8021X, PreAuth,
AuthMode, EncrypType, RekeyMethod,
RekeyInterval, PMKCachePeriod,
DefaultKeyId, Key{n}Type, HT_EXTCHA,
RADIUS_Server, RADIUS_Port,
]]
local function conf_wep_keys(cfgs,vifidx)
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vifidx, http.formvalue("__DefaultKeyID") or 1)
cfgs["Key1Str"..vifidx] = http.formvalue("Key1Str"..vifidx)
cfgs["Key2Str"..vifidx] = http.formvalue("Key2Str"..vifidx)
cfgs["Key3Str"..vifidx] = http.formvalue("Key3Str"..vifidx)
cfgs["Key4Str"..vifidx] = http.formvalue("Key4Str"..vifidx)
cfgs["Key1Type"]=mtkwifi.token_set(cfgs["Key1Type"],vifidx, http.formvalue("WEP1Type"..vifidx))
cfgs["Key2Type"]=mtkwifi.token_set(cfgs["Key2Type"],vifidx, http.formvalue("WEP2Type"..vifidx))
cfgs["Key3Type"]=mtkwifi.token_set(cfgs["Key3Type"],vifidx, http.formvalue("WEP3Type"..vifidx))
cfgs["Key4Type"]=mtkwifi.token_set(cfgs["Key4Type"],vifidx, http.formvalue("WEP4Type"..vifidx))
return cfgs
end
local function __security_cfg(cfgs, vif_idx)
mtkwifi.debug("__security_cfg, before, HideSSID="..tostring(cfgs.HideSSID))
mtkwifi.debug("__security_cfg, before, NoForwarding="..tostring(cfgs.NoForwarding))
mtkwifi.debug("__security_cfg, before, WmmCapable="..tostring(cfgs.WmmCapable))
mtkwifi.debug("__security_cfg, before, TxRate="..tostring(cfgs.TxRate))
mtkwifi.debug("__security_cfg, before, RekeyInterval="..tostring(cfgs.RekeyInterval))
mtkwifi.debug("__security_cfg, before, AuthMode="..tostring(cfgs.AuthMode))
mtkwifi.debug("__security_cfg, before, EncrypType="..tostring(cfgs.EncrypType))
mtkwifi.debug("__security_cfg, before, WscModeOption="..tostring(cfgs.WscModeOption))
mtkwifi.debug("__security_cfg, before, RekeyMethod="..tostring(cfgs.RekeyMethod))
mtkwifi.debug("__security_cfg, before, IEEE8021X="..tostring(cfgs.IEEE8021X))
mtkwifi.debug("__security_cfg, before, DefaultKeyID="..tostring(cfgs.DefaultKeyID))
mtkwifi.debug("__security_cfg, before, PMFMFPC="..tostring(cfgs.PMFMFPC))
mtkwifi.debug("__security_cfg, before, PMFMFPR="..tostring(cfgs.PMFMFPR))
mtkwifi.debug("__security_cfg, before, PMFSHA256="..tostring(cfgs.PMFSHA256))
mtkwifi.debug("__security_cfg, before, RADIUS_Server="..tostring(cfgs.RADIUS_Server))
mtkwifi.debug("__security_cfg, before, RADIUS_Port="..tostring(cfgs.RADIUS_Port))
mtkwifi.debug("__security_cfg, before, session_timeout_interval="..tostring(cfgs.session_timeout_interval))
mtkwifi.debug("__security_cfg, before, PMKCachePeriod="..tostring(cfgs.PMKCachePeriod))
mtkwifi.debug("__security_cfg, before, PreAuth="..tostring(cfgs.PreAuth))
mtkwifi.debug("__security_cfg, before, Wapiifname="..tostring(cfgs.Wapiifname))
cfgs.HideSSID = mtkwifi.token_set(cfgs.HideSSID, vif_idx, http.formvalue("__hidessid") or "0")
cfgs.NoForwarding = mtkwifi.token_set(cfgs.NoForwarding, vif_idx, http.formvalue("__noforwarding") or "0")
cfgs.WmmCapable = mtkwifi.token_set(cfgs.WmmCapable, vif_idx, http.formvalue("__wmmcapable") or "0")
cfgs.TxRate = mtkwifi.token_set(cfgs.TxRate, vif_idx, http.formvalue("__txrate") or "0");
cfgs.RekeyInterval = mtkwifi.token_set(cfgs.RekeyInterval, vif_idx, http.formvalue("__rekeyinterval") or "0");
local __authmode = http.formvalue("__authmode") or "Disable"
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, __authmode)
--[[ need to handle disable case as it conflicts with OPENWEP
case = disable; authmode = OPEN, encryption = NONE
case = open/OPENWEP; authmode = OPEN, encryption = WEP
]]
if __authmode == "Disable" then
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, "OPEN")
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "NONE")
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
elseif __authmode == "OPEN" or __authmode == "SHARED" or __authmode == "WEPAUTO" then
--[[ the following required cfgs are already set in loop above
cfgs.Key{n}Str, ...
cfgs.Key{n}Type, ...
cfgs.DefaultKeyID
]]
cfgs.WscModeOption = "0"
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "WEP")
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
cfgs = conf_wep_keys(cfgs,vif_idx)
cfgs.WscConfMode = mtkwifi.token_set(cfgs.WscConfMode, vif_idx, 0)
elseif __authmode == "WPAPSK" or __authmode == "WPAPSKWPA2PSK" then
--[[ the following required cfgs are already set in loop above
cfgs.WPAPSK{n}, ...
cfgs.RekeyInterval
]]
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "NONE")
--cfgs["WPAPSK"..vif_idx] = http.formvalue("WPAPSK"..vif_idx)
elseif __authmode == "WPA2PSK" then
--[[ the following required cfgs are already set in loop above
cfgs.WPAPSK{n}, ...
cfgs.RekeyInterval
]]
-- for DOT11W_PMF_SUPPORT
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
if cfgs.PMFMFPC then
cfgs.PMFMFPC = mtkwifi.token_set(cfgs.PMFMFPC, vif_idx, http.formvalue("__pmfmfpc") or "0")
end
if cfgs.PMFMFPR then
cfgs.PMFMFPR = mtkwifi.token_set(cfgs.PMFMFPR, vif_idx, http.formvalue("__pmfmfpr") or "0")
end
if cfgs.PMFSHA256 then
cfgs.PMFSHA256 = mtkwifi.token_set(cfgs.PMFSHA256, vif_idx, http.formvalue("__pmfsha256") or "0")
end
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
elseif __authmode == "WPA" then
--[[ the following required cfgs are already set in loop above
cfgs.WPAPSK{n}, ...
cfgs.RekeyInterval
cfgs.RADIUS_Key
]]
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
elseif __authmode == "WPA2" then
--[[ the following required cfgs are already set in loop above
cfgs.WPAPSK{n}, ...
cfgs.RekeyInterval
cfgs.RADIUS_Key
]]
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
cfgs.PMKCachePeriod = mtkwifi.token_set(cfgs.PMKCachePeriod, vif_idx, http.formvalue("__pmkcacheperiod") or "0")
cfgs.PreAuth = mtkwifi.token_set(cfgs.PreAuth, vif_idx, http.formvalue("__preauth") or "0")
-- for DOT11W_PMF_SUPPORT
if cfgs.PMFMFPC then
cfgs.PMFMFPC = mtkwifi.token_set(cfgs.PMFMFPC, vif_idx, http.formvalue("__pmfmfpc") or "0")
end
if cfgs.PMFMFPR then
cfgs.PMFMFPR = mtkwifi.token_set(cfgs.PMFMFPR, vif_idx, http.formvalue("__pmfmfpr") or "0")
end
if cfgs.PMFSHA256 then
cfgs.PMFSHA256 = mtkwifi.token_set(cfgs.PMFSHA256, vif_idx, http.formvalue("__pmfsha256") or "0")
end
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
elseif __authmode == "WPA1WPA2" then
--[[ the following required cfgs are already set in loop above
cfgs.WPAPSK{n}, ...
cfgs.RekeyInterval
cfgs.RADIUS_Key
]]
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "1812")
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
cfgs.PMKCachePeriod = mtkwifi.token_set(cfgs.PMKCachePeriod, vif_idx, http.formvalue("__pmkcacheperiod") or "0")
cfgs.PreAuth = mtkwifi.token_set(cfgs.PreAuth, vif_idx, http.formvalue("__preauth") or "0")
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
elseif __authmode == "IEEE8021X" then
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, "OPEN")
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "1")
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
if http.formvalue("__8021x_wep") then
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "WEP")
else
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "NONE")
end
elseif __authmode == "WAICERT" then
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "SMS4")
cfgs.Wapiifname = mtkwifi.token_set(cfgs.Wapiifname, vif_idx, "br-lan")
-- cfgs.wapicert_asipaddr
-- cfgs.WapiAsPort
-- cfgs.wapicert_ascert
-- cfgs.wapicert_usercert
elseif __authmode == "WAIPSK" then
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "SMS4")
-- cfgs.wapipsk_keytype
-- cfgs.wapipsk_prekey
end
mtkwifi.debug("__security_cfg, after, HideSSID="..tostring(cfgs.HideSSID))
mtkwifi.debug("__security_cfg, after, NoForwarding="..tostring(cfgs.NoForwarding))
mtkwifi.debug("__security_cfg, after, WmmCapable="..tostring(cfgs.WmmCapable))
mtkwifi.debug("__security_cfg, after, TxRate="..tostring(cfgs.TxRate))
mtkwifi.debug("__security_cfg, after, RekeyInterval="..tostring(cfgs.RekeyInterval))
mtkwifi.debug("__security_cfg, after, AuthMode="..tostring(cfgs.AuthMode))
mtkwifi.debug("__security_cfg, after, EncrypType="..tostring(cfgs.EncrypType))
mtkwifi.debug("__security_cfg, after, WscModeOption="..tostring(cfgs.WscModeOption))
mtkwifi.debug("__security_cfg, after, RekeyMethod="..tostring(cfgs.RekeyMethod))
mtkwifi.debug("__security_cfg, after, IEEE8021X="..tostring(cfgs.IEEE8021X))
mtkwifi.debug("__security_cfg, after, DefaultKeyID="..tostring(cfgs.DefaultKeyID))
mtkwifi.debug("__security_cfg, after, PMFMFPC="..tostring(cfgs.PMFMFPC))
mtkwifi.debug("__security_cfg, after, PMFMFPR="..tostring(cfgs.PMFMFPR))
mtkwifi.debug("__security_cfg, after, PMFSHA256="..tostring(cfgs.PMFSHA256))
mtkwifi.debug("__security_cfg, after, RADIUS_Server="..tostring(cfgs.RADIUS_Server))
mtkwifi.debug("__security_cfg, after, RADIUS_Port="..tostring(cfgs.RADIUS_Port))
mtkwifi.debug("__security_cfg, after, session_timeout_interval="..tostring(cfgs.session_timeout_interval))
mtkwifi.debug("__security_cfg, after, PMKCachePeriod="..tostring(cfgs.PMKCachePeriod))
mtkwifi.debug("__security_cfg, after, PreAuth="..tostring(cfgs.PreAuth))
mtkwifi.debug("__security_cfg, after, Wapiifname="..tostring(cfgs.Wapiifname))
end
function initialize_multiBssParameters(cfgs,vif_idx)
cfgs["WPAPSK"..vif_idx]="12345678"
cfgs["Key1Type"]=mtkwifi.token_set(cfgs["Key1Type"],vif_idx,"0")
cfgs["Key2Type"]=mtkwifi.token_set(cfgs["Key2Type"],vif_idx,"0")
cfgs["Key3Type"]=mtkwifi.token_set(cfgs["Key3Type"],vif_idx,"0")
cfgs["Key4Type"]=mtkwifi.token_set(cfgs["Key4Type"],vif_idx,"0")
cfgs["RADIUS_Server"]=mtkwifi.token_set(cfgs["RADIUS_Server"],vif_idx,"0")
cfgs["RADIUS_Key"..vif_idx]="ralink"
cfgs["DefaultKeyID"]=mtkwifi.token_set(cfgs["DefaultKeyID"],vif_idx,"1")
cfgs["IEEE8021X"]=mtkwifi.token_set(cfgs["IEEE8021X"],vif_idx,"0")
cfgs["WscConfMode"]=mtkwifi.token_set(cfgs["WscConfMode"],vif_idx,"0")
cfgs["PreAuth"]=mtkwifi.token_set(cfgs["PreAuth"],vif_idx,"0")
return cfgs
end
function vif_cfg(dev, vif)
local devname, vifname = dev, vif
if not devname then devname = vif end
mtkwifi.debug("devname="..devname)
mtkwifi.debug("vifname="..(vifname or ""))
local devs = mtkwifi.get_all_devs()
local profile = devs[devname].profile
assert(profile)
local cfgs = mtkwifi.load_profile(profile)
for k,v in pairs(http.formvalue()) do
if type(v) == type("") or type(v) == type(0) then
nixio.syslog("debug", "post."..k.."="..tostring(v))
else
nixio.syslog("debug", "post."..k.." invalid, type="..type(v))
end
end
-- sometimes vif_idx start from 0, like AccessPolicy0
-- sometimes it starts from 1, like WPAPSK1. nice!
local vif_idx
local to_url
if http.formvalue("__action") == "vif_cfg_view" then
vif_idx = devs[devname]["vifs"][vifname].vifidx
mtkwifi.debug("vif_idx=", vif_idx, devname, vifname)
to_url = luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_cfg_view", devname, vifname)
elseif http.formvalue("__action") == "vif_add_view" then
cfgs.BssidNum = tonumber(cfgs.BssidNum) + 1
vif_idx = tonumber(cfgs.BssidNum)
to_url = luci.dispatcher.build_url("admin", "mtk", "wifi")
-- initializing ; separated parameters for the new interface
cfgs = initialize_multiBssParameters(cfgs, vif_idx)
end
-- "__" should not be in the name if user wants to copy formvalue data directly in the dat file variable
for k,v in pairs(http.formvalue()) do
if type(v) ~= type("") and type(v) ~= type(0) then
nixio.syslog("err", "vif_cfg, invalid value type for "..k..","..type(v))
elseif string.byte(k) ~= string.byte("_") then
mtkwifi.debug("copying values for "..k)
cfgs[k] = v or ""
end
end
cfgs["AccessPolicy"..vif_idx-1] = http.formvalue("__accesspolicy")
local t = mtkwifi.parse_mac(http.formvalue("__maclist"))
cfgs["AccessControlList"..vif_idx-1] = table.concat(t, ";")
__security_cfg(cfgs, vif_idx)
mtkwifi.debug(devname, profile)
mtkwifi.save_profile(cfgs, profile)
if http.formvalue("__apply") then
__mtkwifi_reload(devname)
end
return luci.http.redirect(to_url)
end
function apcli_scan(ifname)
local aplist = mtkwifi.scan_ap(ifname)
http.write_json(aplist)
end
function get_station_list()
http.write("get_station_list")
end
function reset_wifi(devname)
if devname then
os.execute("cp -f /rom/etc/wireless/"..devname.."/ /etc/wireless/")
else
os.execute("cp -rf /rom/etc/wireless /etc/")
end
os.execute("rm -rf /tmp/mtk/wifi")
__mtkwifi_reload(devname)
return luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
function reload_wifi(devname)
__mtkwifi_reload(devname)
return luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
function get_raw_profile()
local sid = http.formvalue("sid")
http.write_json("get_raw_profile")
end
function get_country_region_list()
local mode = http.formvalue("mode")
local cr_list;
if mtkwifi.band(mode) == "5G" then
cr_list = mtkwifi.CountryRegionList_5G_All
else
cr_list = mtkwifi.CountryRegionList_2G_All
end
http.write_json(cr_list)
end
function remove_ch_by_region(ch_list, region)
for i = #ch_list,2,-1 do
if not ch_list[i].region[region] then
table.remove(ch_list, i)
end
end
end
function get_channel_list()
local mode = http.formvalue("mode")
local region = tonumber(http.formvalue("country_region")) or 1
local ch_list
if mtkwifi.band(mode) == "5G" then
ch_list = mtkwifi.ChannelList_5G_All
else
ch_list = mtkwifi.ChannelList_2G_All
end
remove_ch_by_region(ch_list, region)
http.write_json(ch_list)
end
function get_HT_ext_channel_list()
local ch_cur = tonumber(http.formvalue("ch_cur"))
local region = tonumber(http.formvalue("country_region")) or 1
local ext_ch_list = {}
if ch_cur <= 14 then -- 2.4G Channel
local ch_list = mtkwifi.ChannelList_2G_All
local below_ch = ch_cur - 4
local above_ch = ch_cur + 4
local i = 1
if below_ch > 0 and ch_list[below_ch + 1].region[region] then
ext_ch_list[i] = {}
ext_ch_list[i].val = 0
ext_ch_list[i].text = ch_list[below_ch + 1].text
i = i + 1
end
if above_ch <= 14 and ch_list[above_ch + 1].region[region] then
ext_ch_list[i] = {}
ext_ch_list[i].val = 1
ext_ch_list[i].text = ch_list[above_ch + 1].text
end
else -- 5G Channel
local ch_list = mtkwifi.ChannelList_5G_All
local ext_ch_idx = -1
local len = 0
for k, v in ipairs(ch_list) do
len = len + 1
if v.channel == ch_cur then
ext_ch_idx = (k % 2 == 0) and k + 1 or k - 1
end
end
if ext_ch_idx > 0 and ext_ch_idx < len and ch_list[ext_ch_idx].region[region] then
ext_ch_list[1] = {}
ext_ch_list[1].val = ext_ch_idx % 2
ext_ch_list[1].text = ch_list[ext_ch_idx].text
end
end
http.write_json(ext_ch_list)
end
function get_5G_2nd_80Mhz_channel_list()
local ch_cur = tonumber(http.formvalue("ch_cur"))
local region = tonumber(http.formvalue("country_region"))
local ch_list = mtkwifi.ChannelList_5G_2nd_80MHZ_ALL
local ch_list_5g = mtkwifi.ChannelList_5G_All
local i, j, test_ch, test_idx
local bw80_1st_idx = -1
-- remove adjacent freqencies starting from list tail.
for i = #ch_list,1,-1 do
for j = 0,3 do
if ch_list[i].channel == -1 then
break
end
test_ch = ch_list[i].channel + j * 4
test_idx = ch_list[i].chidx + j
if test_ch == ch_cur then
if i + 1 <= #ch_list and ch_list[i + 1] then
table.remove(ch_list, i + 1)
end
table.remove(ch_list, i)
bw80_1st_idx = i
break
end
if i == (bw80_1st_idx - 1) or (not ch_list_5g[test_idx].region[region]) then
table.remove(ch_list, i)
break
end
end
end
-- remove unused channel.
for i = #ch_list,1,-1 do
if ch_list[i].channel == -1 then
table.remove(ch_list, i)
end
end
http.write_json(ch_list)
end
function apcli_cfg(dev, vif)
local devname = dev
mtkwifi.debug(devname)
local profiles = mtkwifi.search_dev_and_profile()
mtkwifi.debug(profiles[devname])
assert(profiles[devname])
local cfgs = mtkwifi.load_profile(profiles[devname])
for k,v in pairs(http.formvalue()) do
if type(v) ~= type("") and type(v) ~= type(0) then
nixio.syslog("err", "apcli_cfg, invalid value type for "..k..","..type(v))
elseif string.byte(k) ~= string.byte("_") then
cfgs[k] = v or ""
end
end
cfgs.ApCliSsid = ''..mtkwifi.__handleSpecialChars(http.formvalue("ApCliSsid"))
local __authmode = http.formvalue("ApCliAuthMode")
if __authmode == "Disable" then
cfgs.ApCliAuthMode = "OPEN"
cfgs.ApCliEncrypType = "NONE"
elseif __authmode == "OPEN" or __authmode == "SHARED" then
cfgs.ApCliAuthMode = __authmode
cfgs.ApCliEncrypType = http.formvalue("wep_ApCliEncrypType")
else
cfgs.ApCliAuthMode = __authmode
cfgs.ApCliEncrypType = http.formvalue("wpa_ApCliEncrypType")
end
mtkwifi.save_profile(cfgs, profiles[devname])
if http.formvalue("__apply") then
__mtkwifi_reload(devname)
end
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_cfg_view", dev, vif))
end
function apcli_connect(dev, vif)
-- dev_vif can be
-- 1. mt7620.apcli0 # simple case
-- 2. mt7615e.1.apclix0 # multi-card
-- 3. mt7615e.1.2G.apclix0 # multi-card & multi-profile
local devname,vifname = dev, vif
mtkwifi.debug("devname=", dev, "vifname=", vif)
mtkwifi.debug(devname)
mtkwifi.debug(vifname)
local profiles = mtkwifi.search_dev_and_profile()
mtkwifi.debug(profiles[devname])
assert(profiles[devname])
local cfgs = mtkwifi.load_profile(profiles[devname])
cfgs.ApCliEnable = "1"
mtkwifi.save_profile(cfgs, profiles[devname])
os.execute("ifconfig "..vifname.." up")
local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
if not string.match(brvifs, vifname) then
brvifs = brvifs.." "..vifname
nixio.syslog("debug", "add "..vifname.." into lan")
os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
os.execute("uci commit")
os.execute("ubus call network.interface.lan add_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
end
os.execute("iwpriv "..vifname.." set MACRepeaterEn="..cfgs.MACRepeaterEn)
os.execute("iwpriv "..vifname.." set ApCliEnable=0")
os.execute("iwpriv "..vifname.." set Channel="..cfgs.Channel)
os.execute("iwpriv "..vifname.." set ApCliAuthMode="..cfgs.ApCliAuthMode)
os.execute("iwpriv "..vifname.." set ApCliEncrypType="..cfgs.ApCliEncrypType)
if cfgs.ApCliAuthMode == "WEP" then
os.execute("#iwpriv "..vifname.." set ApCliDefaultKeyID="..cfgs.ApCliDefaultKeyID)
os.execute("#iwpriv "..vifname.." set ApCliKey1="..cfgs.ApCliKey1Str)
elseif cfgs.ApCliAuthMode == "WPAPSK"
or cfgs.ApCliAuthMode == "WPA2PSK"
or cfgs.ApCliAuthMode == "WPA1PSKWPA2PSK" then
os.execute("iwpriv "..vifname.." set ApCliWPAPSK="..cfgs.ApCliWPAPSK)
end
os.execute("iwpriv "..vifname.." set ApCliSsid=\""..cfgs.ApCliSsid.."\"")
os.execute("iwpriv "..vifname.." set ApCliEnable=1")
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end
function apcli_disconnect(dev, vif)
-- dev_vif can be
-- 1. mt7620.apcli0 # simple case
-- 2. mt7615e.1.apclix0 # multi-card
-- 3. mt7615e.1.2G.apclix0 # multi-card & multi-profile
local devname,vifname = dev, vif
mtkwifi.debug("devname=", dev, "vifname", vif)
mtkwifi.debug(devname)
mtkwifi.debug(vifname)
local profiles = mtkwifi.search_dev_and_profile()
mtkwifi.debug(profiles[devname])
assert(profiles[devname])
local cfgs = mtkwifi.load_profile(profiles[devname])
cfgs.ApCliEnable = "1"
mtkwifi.save_profile(cfgs, profiles[devname])
os.execute("iwpriv "..vifname.." set ApCliEnable=0")
local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
if string.match(brvifs, vifname) then
brvifs = mtkwifi.__trim(string.gsub(brvifs, vifname, ""))
nixio.syslog("debug", "add "..vifname.." into lan")
os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
os.execute("uci commit")
os.execute("ubus call network.interface.lan remove_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
end
os.execute("ifconfig "..vifname.." down")
luci.http.redirect(luci.dispatcher.build_url("admin", "mtk", "wifi"))
end

View File

@ -1,343 +0,0 @@
<%+header%>
<!--
This module is a demo to configure MTK' proprietary WiFi driver.
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
translate uci into MTK's WiFi profile (like we did in "uci2dat").
Hua Shao <nossiac@163.com>
-->
<%
local disp = require "luci.dispatcher"
-- local request = disp.context.path
local request = disp.context.request
local mtkwifi = require("mtkwifi")
--local devname = string.match(request[5], "(mt.+)%.")
local devname = request[5]
local devs = mtkwifi.get_all_devs()
local dev = {}
local vif = {}
local vifidx
for _,v in ipairs(devs) do
if v.devname == devname then
dev = v
end
end
local vifname = request[6] or dev.apcli.vifname
assert(vifname)
vif = dev and dev.vifs[vifname] or nil
vifidx = vif and vif.vifidx or nil
--print(devs, dev, dev.apcli, devname, vifname)
local cfgs = mtkwifi.load_profile(dev.profile)
local debug = 0
%>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
<div id="loading" style="margin-top: 1em; display: none;">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
&nbsp;&nbsp;&nbsp; Please waiting while the page is loading......
</div>
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_cfg", devname, vifname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="off">
<fieldset class="cbi-section" id="vif-cfg-apcli">
<legend> <a name="apcli_scan_section">Wireless Repeater - <%=devname.."@"..vifname%> </a></legend>
<pre> Manually setup apcli0 connection:
iwpriv <%=vifname%> set ApCliEnable=0 // disable sta mode first
iwpriv <%=vifname%> set ApCliAuthMode= // root ap authentication mode
iwpriv <%=vifname%> set ApCliEncrypType= // root ap encryption type
iwpriv <%=vifname%> set ApCliWPAPSK= // root ap password
iwpriv <%=vifname%> set ApCliWirelessMode= // root ap wifi mode
iwpriv <%=vifname%> set ApCliSsid= // root ap ssid
iwpriv <%=vifname%> set ApCliEnable=1 // enable sta mode</pre>
<br />
<p class="left">
<input id="scan" type="button" class="cbi-button cbi-button-find" onclick="get_ap_list('<%=vifname%>')" value="Scan Wireless Network" />
</p>
<div id="loading" style="display:none;">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle;" />
&nbsp;&nbsp;&nbsp; Please waiting while the page is loading......
</div>
<div id="aplist">
</div>
</fieldset>
<fieldset class="cbi-section" id="vif-cfg-apcli-config">
<legend> <a name="apcli_cfg_section"> Connection Configurations</a> </legend>
<table class="cbi-section-table">
<tbody>
<tr><th class="th1"></th><th></th><th></th></tr>
<tr>
<td>MAC Repeater Mode</td>
<td>
<input type="radio" name="MACRepeaterEn" value="1" <% if cfgs.MACRepeaterEn == "1" then %> checked="checked"<% end %> /> Enable
<input type="radio" name="MACRepeaterEn" value="0" <% if cfgs.MACRepeaterEn ~= "1" then %> checked="checked"<% end %> /> Disable
</td>
<td></td>
</tr>
<tr>
<td>Root AP SSID</td>
<td>
<input type="text" name="ApCliSsid" id="ApCliSsid" value="<%=cfgs.ApCliSsid%>"/>
</td>
<td></td>
</tr>
<tr>
<td>Root AP Channel</td>
<td>
<input type="text" name="Channel" id="Channel" value="<%=dev.Channel%>"/>
</td>
<td> <span style="color:red;">This will overwrite ap channel.</span></td>
</tr>
<tr>
<td>Root AP Authentication Mode</td>
<td>
<select name="ApCliAuthMode" cfg="ApCliAuthMode" id="ApCliAuthMode" onchange="ApCliAuthMode_onchange(this.options[this.options.selectedIndex].value)">
<% for _,v in ipairs(dev.ApCliAuthModeList) do %>
<% if (cfgs.ApCliAuthMode == "OPEN" and cfgs.ApCliEncrypType== "NONE") then
if(v == "Disable") then %>
<option value="<%=v%>" selected="selected" ><%=v%>
</option>
<% else %>
<option value="<%=v%>" ><%=v%>
</option>
<% end
else %>
<option value="<%=v%>" <% if cfgs.ApCliAuthMode==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
<% end %>
</select>
</td>
<td></td>
</tr>
</tbody>
<tbody id="apcli_wpa"<% if cfgs.ApCliAuthMode ~= "WPA2PSK" then %> style="display: none;"<% end %>>
<tr>
<td>Root AP Encryption</td>
<td>
<select name="wpa_ApCliEncrypType" id="wpa_ApCliEncrypType" >
<% for _, v in ipairs(dev.WPA_Enc_List) do %>
<option value="<%=v%>" <% if cfgs.ApCliEncrypType==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
</select>
</td>
<td></td>
</tr>
<tr>
<td>Root AP WPA Key</td>
<td>
<input type="text" name="ApCliWPAPSK" id="ApCliWPAPSK" value="<%=cfgs.ApCliWPAPSK%>"/>
</td>
<td></td>
</tr>
</tbody>
<tbody id="apcli_wep"<% if cfgs.ApCliAuthMode ~= "WEP" then %> style="display: none;"<% end %>>
<tr>
<td>Root AP Encryption</td>
<td>
<select name="wep_ApCliEncrypType" id="wep_ApCliEncrypType" >
<% for _, v in ipairs(dev.WEP_Enc_List) do %>
<option value="<%=v%>" <% if cfgs.ApCliEncrypType==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
</select>
</td>
<td></td>
</tr>
<tr>
<td>Root AP WEP Key</td>
<td>
<input type="text" name="ApCliKey1Str" id="ApCliKey1Str" value="<%=cfgs.ApCliKey1Str%>"/>
<input type="hidden" name="ApCliDefaultKeyID" value="1"/>
</td>
<td></td>
</tr>
</tbody>
</table>
</fieldset>
<div class="cbi-page-actions" id="apcli_form_buttons">
<input class="cbi-button cbi-button-apply" value="Reload" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", devname)%>");' />
<input class="cbi-button cbi-button-apply" value="Save" type="submit" />
<input class="cbi-button cbi-button-reset" value="Reset" type="reset" />
</div>
</form>
<script type="text/javascript">
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
XHR.get(url, null,
function(x)
{
console.log(x);
document.getElementById("loading").style.display="none";
window.location.reload();
}
);
}
function decode_ssid(ssid)
{
ssid = ssid.replace(/&amp;/g, "&");
ssid = ssid.replace(/&lt;/g, "<");
ssid = ssid.replace(/&gt;/g, ">");
ssid = ssid.replace(/&#34;/g, "\"");
ssid = ssid.replace(/&#39;/g, "'");
ssid = ssid.replace(/&nbsp;/g, " ");
var patt = new RegExp(/&#(\d+);/);
while (res = patt.exec(ssid))
{
ssid = ssid.replace("&#" + res[1] + ";", String.fromCharCode(res[1]));
}
return ssid;
}
var ap_list;
function create_ap_table (aplist) {
var table = document.createElement('table');
table.setAttribute("id", "aplist_table");
for (i in aplist) {
var tr = table.insertRow(i);
var td0 = tr.insertCell(0);
td0.innerHTML = aplist[i].ssid;
var td1 = tr.insertCell(1);
td1.innerHTML = aplist[i].channel;
var td2 = tr.insertCell(2);
td2.innerHTML = aplist[i].bssid;
var td3 = tr.insertCell(3);
td3.innerHTML = aplist[i].security;
var td4 = tr.insertCell(4);
td4.innerHTML = aplist[i].rssi;
var td5 = tr.insertCell(5);
if (aplist[i].authmode == "OPEN"
|| aplist[i].authmode == "WPAPSK"
|| aplist[i].authmode == "WPA2PSK"
|| aplist[i].authmode == "WPAPSKWPA2PSK") {
td5.innerHTML = '<a href="javascript:choose_rootap(\''+i+'\')" >Choose This</a>';
} else {
td5.innerHTML = 'Security Not Supported';
}
}
var tr = table.insertRow(0);
var td0 = tr.insertCell(0);
td0.innerHTML = '<strong>SSID</strong>';
var td1 = tr.insertCell(1);
td1.innerHTML = '<strong>Channel</strong>';
var td2 = tr.insertCell(2);
td2.innerHTML = '<strong>BSSID</strong>';
var td3 = tr.insertCell(3);
td3.innerHTML = '<strong>Security</strong>';
var td4 = tr.insertCell(4);
td4.innerHTML = '<strong>RSSI</strong>';
var td5 = tr.insertCell(5);
td5.innerHTML = '<strong>Action</strong>';
var div = document.getElementById('aplist');
div.innerHTML = "";
div.appendChild(table);
}
function get_ap_list(vifname) {
document.getElementById("loading").style.display="";
XHR.get('<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_scan")%>/' + vifname, null,
function(x)
{
console.log(x)
ap_list = eval(x.response);
console.log(ap_list);
create_ap_table(ap_list);
document.getElementById("loading").style.display="none";
}
);
}
function toggle_apcli (show) {
if (show) {
document.getElementById('apcli_cfg').style.display = "";
var a = document.getElementById('ApCliAuthMode')
var to = a.options[a.options.selectedIndex].value
if (to == "WPA2PSK"
|| to == "WPAPSK"
|| to == "WPAPSKWPA2PSK") {
document.getElementById("apcli_wpa").style.display="";
document.getElementById("apcli_wep").style.display="none";
} else if (to == "WEP") {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="";
} else {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="none";
}
}
else {
document.getElementById('apcli_cfg').style.display = "none";
document.getElementById('apcli_wpa').style.display = "none";
document.getElementById('apcli_wep').style.display = "none";
}
}
function ApCliAuthMode_onchange (to) {
if (to == "WPA2PSK"
|| to == "WPAPSK"
|| to == "WPAPSKWPA2PSK") {
document.getElementById("apcli_wpa").style.display="";
document.getElementById("apcli_wep").style.display="none";
} else if (to == "OPEN" || to == "SHARED") {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="";
} else {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="none";
}
}
function choose_rootap(index) {
document.getElementById("ApCliSsid").value=decode_ssid(ap_list[index].ssid);
document.getElementById("Channel").value=ap_list[index].channel;
document.getElementById("ApCliAuthMode").value=ap_list[index].authmode;
if (ap_list[index].authmode == "WPA2PSK"
|| ap_list[index].authmode == "WPAPSK"
|| ap_list[index].authmode == "WPAPSKWPA2PSK") {
document.getElementById("wpa_ApCliEncrypType").value=ap_list[index].encrypttype;
} else if (ap_list[index].authmode == "OPEN" || ap_list[index].authmode == "SHARED") {
if (ap_list[index].encrypttype == "NONE")
{
document.getElementById("ApCliAuthMode").value="Disable";
}
else
{
document.getElementById("wep_ApCliEncrypType").value=ap_list[index].encrypttype;
}
}
ApCliAuthMode_onchange(document.getElementById("ApCliAuthMode").value);
document.getElementById("ApCliWPAPSK").value="";
document.getElementById("ApCliKey1Str").value="";
location.href="#apcli_cfg_section";
}
window.onload = function() {
ApCliAuthMode_onchange(document.getElementById("ApCliAuthMode").value);
<% if cfgs.ApCliEnable == "1" then %>
toggle_apcli(true);
<% else %>
toggle_apcli(false);
<% end %>
}
</script>
<%+footer%>

View File

@ -1,851 +0,0 @@
<%+header%>
<!--
This module is a demo to configure MTK' proprietary WiFi driver.
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
translate uci into MTK's WiFi profile (like we did in "uci2dat").
Hua Shao <nossiac@163.com>
-->
<%
local disp = require "luci.dispatcher"
-- local request = disp.context.path
local request = disp.context.request
local mtkwifi = require("mtkwifi")
local devname = request[5]
local devs = mtkwifi.get_all_devs()
local dev = {}
for _,v in ipairs(devs) do
if v.devname == devname then
dev = v
end
end
local cfgs = mtkwifi.load_profile(dev.profile)
%>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
<div id="loading" style="margin-top: 1em; display: none;">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
&nbsp;&nbsp;&nbsp; Please waiting while the page is loading......
</div>
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg", devname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="false">
<fieldset class="cbi-section">
<legend> Device Configurations - <%=devname%>
<%
local diff = mtkwifi.diff_profile(dev.profile)
if next(diff) ~= nil then
%>
<span style="color:red;">(<a href="javascript:location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", dev.devname)%>'">reload</a> to apply changes)</span>
<%
end
%>
</legend>
<table id="dev-cfg-basic" class="cbi-section-table">
<tr><th></th><td></td><td></td></tr>
<tr>
<td>Mode</td>
<td>
<select style="width:auto" name="WirelessMode" id="WirelessMode" onchange="WirelessMode_onchange(this.options[this.options.selectedIndex].value)">
<% for k,v in pairs(dev.WirelessModeList) do %>
<option value="<%=k%>" <% if tonumber(dev.WirelessMode) == tonumber(k) then%> selected="selected"<% end %>><%=k%> - <%=v%></option>
<% end %>
</select>
</td>
<td></td>
</tr>
<tr>
<td>Channel</td>
<td>
<select style="width:auto; min-width:180px;" name="Channel" id="Channel" onchange="Channel_onchange(this.value)" <% if cfgs.ApCliEnable == "1" then %> disabled="disabled" <% end %>>
</select>
</td>
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
</tr>
<tr>
<td>Country Code</td>
<td>
<select name="CountryCode" style="width:auto">
<option value="US" id="advCountryCodeUS" <% if cfgs.CountryCode == "US" then %> selected="selected"<% end %>>US (United States)</option>
<option value="JP" id="advCountryCodeJP" <% if cfgs.CountryCode == "JP" then %> selected="selected"<% end %>>JP (Japan)</option>
<option value="FR" id="advCountryCodeFR" <% if cfgs.CountryCode == "FR" then %> selected="selected"<% end %>>FR (France)</option>
<option value="TW" id="advCountryCodeTW" <% if cfgs.CountryCode == "TW" then %> selected="selected"<% end %>>TW (Taiwan)</option>
<option value="IE" id="advCountryCodeIE" <% if cfgs.CountryCode == "IE" then %> selected="selected"<% end %>>IE (Ireland)</option>
<option value="HK" id="advCountryCodeHK" <% if cfgs.CountryCode == "HK" then %> selected="selected"<% end %>>HK (Hong Kong)</option>
<option value="NONE" id="advCountryCodeNONE"<% if cfgs.CountryCode == "NONE" then %> checked="checked"<% end %>>NONE</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td>Country Region</td>
<td>
<select style="width:auto; min-width:180px;" name="__cr" id="__cr" onchange="CountryRegion_onchange(this.value)">
</select>
</td>
<td></td>
</tr>
<% if cfgs.HT_OpMode then %>
<tr>
<td>Operating Mode</td>
<td>
<select style="width:auto" name="HT_OpMode">
<option value="0" <% if cfgs.HT_OpMode == "0" then %> selected="selected"<% end%>>Mixed Mode</option>
<option value="1" <% if cfgs.HT_OpMode == "1" then %> selected="selected"<% end%>>Green Field</option>
</select>
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_GI then %>
<tr>
<td>HT Guard Interval</td>
<td>
<select style="width:auto" name="HT_GI">
<option value="0" <% if cfgs.HT_GI == "0" then %> selected="selected"<% end%>>Long</option>
<option value="1" <% if cfgs.HT_GI == "1" then %> selected="selected"<% end%>>Short</option>
<option value="2" <% if cfgs.HT_GI == "2" then %> selected="selected"<% end%>>Auto</option>
</select>
</td>
<td></td>
</tr>
<% end %>
<tr>
<td>Channel BandWidth</td>
<td>
<select style="width:auto" name="__bw" id="__bw" onchange="Bw_onchange(this.options[this.options.selectedIndex].value)">
<option value="20" <% if dev.__bw == "20" then %> selected="selected"<% end%>>20 MHz</option>
<option value="40" <% if dev.__bw == "40" then %> selected="selected"<% end%>>40 MHz</option>
<option value="60" <% if dev.__bw == "60" then %> selected="selected"<% end%>>20/40 MHz</option>
<option value="80" <% if dev.__bw == "80" then %> selected="selected"<% end%>>80 MHz</option>
<option value="160" <% if dev.__bw == "160" then %> selected="selected"<% end%>>160 MHz</option>
<option value="161" <% if dev.__bw == "161" then %> selected="selected"<% end%>>80+80 MHz</option>
</select>
</td>
<td></td>
</tr>
<% if cfgs.VHT_BW then %>
<tr>
<td>2G 40Mhz Ext Channel</td>
<td>
<select style="width:auto; min-width:180px;" name="HT_EXTCHA" id="HT_EXTCHA" <% if cfgs.ApCliEnable == "1" or dev.__bw ~= "40" or dev.__bw ~= "60" then %> disabled="disabled" <% end %>>
</select>
</td>
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
</tr>
<tr>
<td>5G 2nd 80Mhz Channel</td>
<td>
<select style="width:auto; min-width:180px;" name="VHT_Sec80_Channel" id="VHT_Sec80_Channel" <% if cfgs.ApCliEnable == "1" or dev.__bw ~= "180" then %> disabled="disabled" <% end %>>
</select>
</td>
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
</tr>
<% end %>
<% if cfgs.HT_STBC then %>
<tr>
<td>STBC</td>
<td>
<input type="radio" name="HT_STBC" value="1" <% if cfgs.HT_STBC == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_STBC" value="0" <% if cfgs.HT_STBC == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_AMSDU then %>
<tr>
<td>A-MSDU</td>
<td>
<input type="radio" name="HT_AMSDU" value="1" <% if cfgs.HT_AMSDU == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_AMSDU" value="0" <% if cfgs.HT_AMSDU == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_AutoBA then %>
<tr>
<td>Auto Block ACK</td>
<td>
<input type="radio" name="HT_AutoBA" value="1" <% if cfgs.HT_AutoBA == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_AutoBA" value="0" <% if cfgs.HT_AutoBA == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_BADecline then %>
<tr>
<td>Decline BA Request</td>
<td>
<input type="radio" name="HT_BADecline" value="1" <% if cfgs.HT_BADecline == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_BADecline" value="0" <% if cfgs.HT_BADecline == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_DisallowTKIP then %>
<tr>
<td>HT Disallow TKIP</td>
<td>
<input type="radio" name="HT_DisallowTKIP" value="1" <% if cfgs.HT_DisallowTKIP == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_DisallowTKIP" value="0" <% if cfgs.HT_DisallowTKIP == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.HT_LDPC then %>
<tr>
<td>HT LDPC</td>
<td>
<input type="radio" name="HT_LDPC" value="1" <% if cfgs.HT_LDPC == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_LDPC" value="0" <% if cfgs.HT_LDPC == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.VHT_SGI then %>
<tr>
<td>VHT Short GI</td>
<td>
<select style="width:auto" name="VHT_SGI">
<option value="0" <% if cfgs.VHT_SGI == "0" then %> selected="selected"<% end%>>Long</option>
<option value="1" <% if cfgs.VHT_SGI == "1" then %> selected="selected"<% end%>>Short</option>
</select>
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.VHT_STBC then %>
<tr>
<td>VHT STBC</td>
<td>
<input type="radio" name="VHT_STBC" value="1" <% if cfgs.VHT_STBC == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="VHT_STBC" value="0" <% if cfgs.VHT_STBC == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.VHT_BW_SIGNAL then %>
<tr>
<td>VHT BW Signaling</td>
<td>
<input type="radio" name="VHT_BW_SIGNAL" value="1" <% if cfgs.VHT_BW_SIGNAL == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="VHT_BW_SIGNAL" value="0" <% if cfgs.VHT_BW_SIGNAL == "0" then %> checked="checked"<% end %>/> Disable
<input type="radio" name="VHT_BW_SIGNAL" value="0" <% if cfgs.VHT_BW_SIGNAL == "2" then %> checked="checked"<% end %>/> Dynamic
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.VHT_LDPC then %>
<tr>
<td>VHT LDPC</td>
<td>
<input type="radio" name="VHT_LDPC" value="1" <% if cfgs.VHT_LDPC == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="VHT_LDPC" value="0" <% if cfgs.VHT_LDPC == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.BGProtection then %>
<tr>
<td>BG Protection Mode</td>
<td>
<select name="BGProtection" style="width:auto">
<option value="0" <% if cfgs.BGProtection == "0" then %>selected="selected"<% end %>>Auto</option>
<option value="1" <% if cfgs.BGProtection == "1" then %>selected="selected"<% end %>>Always On</option>
<option value="2" <% if cfgs.BGProtection == "2" then %>selected="selected"<% end %>>Always Off</option>
</select>
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.VHT_BW then %>
<tr>
<td>HT Protection</td>
<td>
<input type="radio" name="HT_PROTECT" value="1" <% if cfgs.HT_PROTECT == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="HT_PROTECT" value="0" <% if cfgs.HT_PROTECT == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.BeaconPeriod then %>
<tr>
<td>Beacon Interval</td>
<td>
<input name="BeaconPeriod" value="<%=cfgs.BeaconPeriod%>" />ms(range 20-999, default 100)
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.DtimPeriod then %>
<tr>
<td>Data Beacon Rate (DTIM)</td>
<td>
<input name="DtimPeriod" value="<%=cfgs.DtimPeriod%>" />ms(range 1-255, default 1)
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.FragThreshold then %>
<tr>
<td>Fragment Threshold</td>
<td>
<input name="FragThreshold" value="<%=cfgs.FragThreshold%>" />(range 256-2346, default 2346)
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.RTSThreshold then %>
<tr>
<td>RTS Threshold</td>
<td>
<input name="RTSThreshold" value="<%=cfgs.RTSThreshold%>" />(range 256-2347, default 2347)
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.TxPower then %>
<tr>
<td>TX Power</td>
<td>
<input name="TxPower" value="<%=cfgs.TxPower%>" />dbm(range 1-100, default 100)
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.TxPreamble then %>
<tr>
<td>Short Preamble</td>
<td>
<input type="radio" name="TxPreamble" value="1" <% if cfgs.TxPreamble == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="TxPreamble" value="0" <% if cfgs.TxPreamble == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.ShortSlot then %>
<tr>
<td>Short Slot</td>
<td>
<input type="radio" name="ShortSlot" value="1" <% if cfgs.ShortSlot == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="ShortSlot" value="0" <% if cfgs.ShortSlot == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.TxBurst then %>
<tr>
<td>TX Burst</td>
<td>
<input type="radio" name="TxBurst" value="1" <% if cfgs.TxBurst == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="TxBurst" value="0" <% if cfgs.TxBurst == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.PktAggregate then %>
<tr>
<td>Packet Aggregate</td>
<td>
<input type="radio" name="PktAggregate" value="1" <% if cfgs.PktAggregate == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="PktAggregate" value="0" <% if cfgs.PktAggregate == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
<% if cfgs.IEEE80211H then %>
<tr>
<td>802.11H</td>
<td>
<input type="radio" name="IEEE80211H" value="1" <% if cfgs.IEEE80211H == "1" then %> checked="checked"<% end %>/> Enable
<input type="radio" name="IEEE80211H" value="0" <% if cfgs.IEEE80211H == "0" then %> checked="checked"<% end %>/> Disable
</td>
<td></td>
</tr>
<% end %>
</table>
</fieldset>
<div class="cbi-page-actions">
<input class="cbi-button cbi-button-apply" value="Reload" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", devname)%>");' />
<input class="cbi-button cbi-button-apply" value="Save" type="submit" />
<input class="cbi-button cbi-button-apply" name="__apply" value="Save & Apply" type="submit" />
<input class="cbi-button cbi-button-reset" value="Reset" type="reset" />
</div>
</form>
<form method="post" name="cbi2" action="<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_raw", devname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="off">
<fieldset class="cbi-section">
<legend> Raw Configurations ( Edit WiFi profile directly )</legend>
<p> <span style="color: red"><b>WARNING</b></span> : DO NOT MESS WITH IT IF YOU DON'T UNDERSTAND IT!</p>
<textarea name="raw" id="raw" style="width:98%; height: 200px;"><%
local fd = io.open(dev.profile)
for line in fd:lines() do
print(line)
end
%></textarea>
</fieldset>
<div class="cbi-page-actions">
<input class="cbi-button cbi-button-reset" value="Reset" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_view", devname)%>'" type="button" />
<input class="cbi-button cbi-button-apply" id="save" value="Save" type="submit" onclick="if (confirm('You are going to overwrite the profile directly, are you sure?')) return true; else return false;" />
<input class="cbi-button cbi-button-apply" id="reset" value="Restore Profile to Factory Setting" type="button" onclick="if (confirm('You are going to reset the profile of <%=devname%> to factory default, are you sure?')) location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_reset", devname)%>'" />
</div>
</form>
<script type="text/javascript">
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
XHR.get(url, null,
function(x)
{
console.log(x);
document.getElementById("loading").style.display="none";
window.location.reload();
}
);
}
function WirelessMode_onchange (mode) {
var cr = GetCountryRegion(mode);
getCountryRegionList(mode, cr);
}
function CountryRegion_onchange(country_region) {
var wmode_o = document.getElementById('WirelessMode');
var wmode;
if (wmode_o)
wmode = wmode_o.value;
if (wmode == "")
wmode = "<%=cfgs.WirelessMode%>";
getChannelList(wmode, country_region);
}
function Channel_onchange (ch) {
getBw(null, ch);
}
function Bw_onchange(bw, ch) {
var ch_val;
if (!ch){
var ch_o = document.getElementById('Channel');
if (ch_o)
ch_val = ch_o.value;
if (ch_val == "")
ch_val = "<%=cfgs.Channel%>";
} else {
ch_val = ch
}
get5G2nd80MhzChannelList(bw, ch_val);
getHTExtChannel(bw, ch_val);
}
function initCountryRegionList(list, mode){
var select = document.getElementById('__cr');
var cr = {};
if (is_mode_gband(mode))
cr = "<%=cfgs.CountryRegion%>";
else if (is_mode_aband(mode))
cr = "<%=cfgs.CountryRegionABand%>";
var new_cr = initList(select, list, cr, "region");
CountryRegion_onchange(new_cr);
}
function getCountryRegionList(mode) {
XHR.get('<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "get_country_region_list")%>', 'mode='+mode,
function(x)
{
//console.log(x);
//console.log(x.response);
var json = eval(x.response);
initCountryRegionList(json, mode);
}
);
}
function initChannelList(list) {
/* choose auto select when no matching item in the lis */
var select = document.getElementById('Channel');
var ch = {};
var new_ch = null;
ch.cval = select.value;
ch.oval = "<%=dev.Channel%>";
var new_ch = initList(select, list, ch, "channel");
Channel_onchange(new_ch);
}
function getChannelList(mode, country_region) {
XHR.get('<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "get_channel_list")%>', 'mode='+mode+'&country_region='+country_region,
function(x)
{
console.log(x);
console.log(x.response);
var json = eval(x.response);
initChannelList(json);
}
);
}
function GetCountryRegion(mode) {
var cr_o = document.getElementById('__cr');
var cr = "";
if (cr_o) {
cr = cr_o.value;
}
if (cr == "") {
if (is_mode_gband(mode)) {
cr = "<%=cfgs.CountryRegion%>";
} else if (is_mode_aband(mode)) {
cr = "<%=cfgs.CountryRegionABand%>";
} else {
alert("Cannot get valid CountryRegion from invalid WireleeMode");
}
}
return cr;
}
function getBw(mode, ch) {
/* choose bw as wide as possible if modification is needed */
var bw_sel = document.getElementById('__bw');
var wmode;
if (!mode) {
wmode = document.getElementById('WirelessMode');
wmode = wmode.value*1;
} else {
wmode = mode*1;
}
if (is_mode_legacy_only(wmode)) {
for (var idx in bw_sel.options) {
bw_sel.options[idx].disabled = false;
if (bw_sel.options[idx].value == 20)
bw_sel.options[idx].selected = true;
if (bw_sel.options[idx].value > 20)
bw_sel.options[idx].disabled = true;
}
} else if (is_ch_gband(ch)) {
for (var idx in bw_sel.options) {
bw_sel.options[idx].disabled = false;
if ((bw_sel.options[idx].value == 60) && (bw_sel.selectedIndex > idx))
bw_sel.options[idx].selected = true;
if (bw_sel.options[idx].value > 60)
bw_sel.options[idx].disabled = true;
}
} else if (is_ch_aband(ch)) {
var chosen60 = false;
var bw160 = "<%=cfgs.VHT_BW%>"*1;
if (bw_sel.value == 60)
chosen60 = 1;
for (var idx in bw_sel.options) {
bw_sel.options[idx].disabled = false;
if (bw_sel.options[idx].value == 40 && chosen60 && bw160 == 0) {
bw_sel.options[idx].selected = true;
} else if (bw_sel.options[idx].value == 60) {
bw_sel.options[idx].disabled = true;
bw_sel.options[idx].selected = false;
} else if (bw_sel.options[idx].value == 160 && chosen60 && bw160 == 1) {
bw_sel.options[idx].selected = true;
}
}
}
Bw_onchange(bw_sel.value, ch);
}
function init5G2nd80MhzChannelList(list) {
var select = document.getElementById('VHT_Sec80_Channel');
var ch2 = {};
var new_ch2 = null;
ch2.cval = select.value;
ch2.oval = "<%=cfgs.VHT_Sec80_Channel%>";
initList(select, list, ch2, "channel");
if (select.length > 0)
select.disabled = false;
else
alert("[Warning] 5G 2nd 80Mhz Channel is not available. Please Check CountryRegion.");
}
function get5G2nd80MhzChannelList(bw, ch) {
var ch_5g_2nd = document.getElementById('VHT_Sec80_Channel');
ch_5g_2nd.disabled = true;
if (ch == "0")
return;
if (bw != "161" || ch == "0")
return;
var mode = document.getElementById('WirelessMode');
mode = mode.value*1;
var cr = GetCountryRegion(mode);
XHR.get('<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "get_5G_2nd_80Mhz_channel_list")%>', 'ch_cur='+ch+'&country_region='+cr,
function(x)
{
//console.log(x);
//console.log(x.response);
var json = eval(x.response);
init5G2nd80MhzChannelList(json);
}
);
}
function initHTExtChannelList(list) {
var select = document.getElementById('HT_EXTCHA');
var ch2 = {};
var new_ch2 = null;
ch2.cval = select.value;
ch2.oval = "<%=cfgs.HT_EXTCHA%>";
initList(select, list, ch2, "val");
if (select.length > 0)
select.disabled = false;
else
alert("[Warning] 2G 40Mhz Ext Channel is not avalable. Please Check CountryRegion.");
}
function getHTExtChannel(bw, ch) {
var ch_2g_ext = document.getElementById('HT_EXTCHA');
ch_2g_ext.disabled = true;
if (ch == "0")
return;
if (bw != "40" && bw != "60")
return;
var mode = document.getElementById('WirelessMode');
mode = mode.value*1;
var cr = GetCountryRegion(mode);
XHR.get('<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "get_HT_ext_channel_list")%>', 'ch_cur='+ch+'&country_region='+cr,
function(x)
{
console.log(x);
console.log(x.response);
var json = eval(x.response);
initHTExtChannelList(json);
}
);
}
function toggle_apcli (show) {
if (show) {
document.getElementById('apcli_cfg').style.display = "";
var a = document.getElementById('ApCliAuthMode')
var to = a.options[a.options.selectedIndex].value
if (to == "WPA2PSK") {
document.getElementById("apcli_wpa").style.display="";
document.getElementById("apcli_wep").style.display="none";
} else if (to == "WEP") {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="";
} else {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="none";
}
}
else {
document.getElementById('apcli_cfg').style.display = "none";
document.getElementById('apcli_wpa').style.display = "none";
document.getElementById('apcli_wep').style.display = "none";
}
}
function ApCliAuthMode_onchange (to) {
if (to == "WPA2PSK") {
document.getElementById("apcli_wpa").style.display="";
document.getElementById("apcli_wep").style.display="none";
} else if (to == "WEP") {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="";
} else {
document.getElementById("apcli_wpa").style.display="none";
document.getElementById("apcli_wep").style.display="none";
}
}
function toggle_atf(o) {
if (o.getAttribute("value") == "1") {
document.getElementById("VOW_Airtime_Fairness_En").value = "0";
o.setAttribute("value", "0");
o.className = "cbi-button cbi-button-add";
o.innerHTML = "Enable ATC";
} else {
document.getElementById("VOW_Airtime_Fairness_En").value = "1";
o.setAttribute("value", "1");
o.className = "cbi-button cbi-button-remove";
o.innerHTML = "Disable ATC";
}
}
function toggle_atc(o) {
if (o.getAttribute("value") == "1") {
document.getElementById("VOW_BW_Ctrl").value = "0";
o.setAttribute("value", "0");
o.className = "cbi-button cbi-button-add";
o.innerHTML = "Enable ATC";
document.getElementById("atc-table").style.display = "none";
} else {
document.getElementById("VOW_BW_Ctrl").value = "1";
o.setAttribute("value", "1");
o.className = "cbi-button cbi-button-remove";
o.innerHTML = "Disable ATC";
document.getElementById("atc-table").style.display = "";
}
}
function is_mode_legacy_only(mode) {
var imode = mode*1;
return ((imode >= 0) && (imode <= 4));
}
function is_mode_gband(mode) {
var imode = mode*1;
var gband_mode_list = [0,1,4,6,7,9];
var i;
for (i = 0; i < gband_mode_list.length; i++){
if( gband_mode_list[i] == imode )
return true;
}
return false;
}
function is_mode_aband(mode) {
var imode = mode*1;
var aband_mode_list = [2,8,11,14,15];
var i;
for (i = 0; i < aband_mode_list.length; i++){
if( aband_mode_list[i] == imode )
return true;
}
return false;
}
function is_ch_gband(ch) {
ch = ch*1;
if (ch == 0) {
var wmode = document.getElementById('WirelessMode');
return is_mode_gband(wmode.value);
}
return ((ch > 0) && (ch <= 14));
}
function is_ch_aband(ch) {
ch = ch*1;
if (ch == 0) {
var wmode = document.getElementById('WirelessMode');
return is_mode_aband(wmode.value);
}
return ((ch >= 36 ) && (ch <= 165));
}
function initList(selobj, list, selvals, value, text){
var sel = {};
var id = selobj.id;
if (typeof(selvals) != "object")
sel[0] = selvals;
else
sel = selvals;
selobj.innerHTML = "";
for (var i in list) {
var opt = document.createElement('option');
if(value)
opt.value = list[i][value];
else
opt.value = list[i].value;
if(text)
opt.text = list[i][text];
else
opt.text = list[i].text;
selobj.appendChild(opt);
}
var selv = null;
for (var k in sel) {
//console.log("[initList][" + id + "] sel[" + k + "]=" + sel[k]);
for (var i in selobj.options){
if (selobj.options[i].value == sel[k]){
selobj.options[i].selected = true;
selv = sel[k];
//console.log("[initList][" + id + "] found selv=" + selv);
break;
}
}
if (selv) break;
}
if (!selv) {
selv = selobj.value;
//console.log("[initList][" + id + "] !selv, selv=" + selv);
}
return selv;
}
window.onload = function() {
WirelessMode_onchange('<%=dev.WirelessMode%>');
ApCliAuthMode_onchange('<%=cfgs.ApCliAuthMode%>');
}
</script>
<%+footer%>

View File

@ -1,171 +0,0 @@
<%+header%>
<!--
This module is a demo to configure MTK' proprietary WiFi driver.
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
translate uci into MTK's WiFi profile (like we did in "uci2dat").
Hua Shao <nossiac@163.com>
-->
<%
local mtkwifi = require("mtkwifi")
local devs = mtkwifi.get_all_devs()
%>
<h2><a name="content">Wireless Overview</a></h2>
<div id="loading" style="margin-top: 1em; display: none;">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
&nbsp;&nbsp;&nbsp; Please waiting while the page is loading......
</div>
<% if #devs == 0 then %>
<fieldset class="cbi-section">
<legend>No wireless device found.</legend>
</fieldset>
<% end %>
<% for _,dev in ipairs(devs) do %>
<fieldset class="cbi-section">
<table class="cbi-section-table" style="margin:10px; empty-cells:hide">
<!-- physical device -->
<tbody>
<tr>
<td style="width:34px">
<img src="/luci-static/resources/icons/wifi_big.png" style="float:left; margin-right:10px" />
</td>
<td colspan="2" style="text-align:left">
<big><strong title="<%=dev.profile%>"><%=dev.devname%></strong></big>
<%
local diff = mtkwifi.diff_profile(dev.profile)
if next(diff) ~= nil then
%>
<span style="color:red;">* need reload to apply changes</span>
<%
end
%>
<br/>
<span> work mode: <% if dev.ApCliEnable == "1" then %> APCli <% else %> AP<% end %> <!-- <br/> driver: <%=dev.version%> --></span>
</td>
<td style="width:310px;text-align:right">
<input class="cbi-button cbi-button-reload" style="width:100px" title="Reload WiFi network" value="Reload" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", dev.devname)%>");' />
<input class="cbi-button cbi-button-edit" style="width:100px" title="Configure WiFi device" value="Config" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "dev_cfg_view", dev.devname)%>'" />
<input class="cbi-button cbi-button-add" style="width:100px" title="Add WiFi network" value="Add" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_add_view", dev.devname,dev.vifs.__prefix)%>'" />
</td>
</tr>
<!-- /physical device -->
<!-- network list -->
<% for _,vif in ipairs(dev.vifs) do %>
<tr class="cbi-section-table-row cbi-rowstyle-1">
<td></td>
<td class="cbi-value-field" style="width:16px; padding:3px">
<% if vif.state == "up" then %>
<img src="/luci-static/resources/icons/signal-75-100.png" />
<% else %>
<img src="/luci-static/resources/icons/signal-none.png" />
<% end %>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px"><strong>Interface:</strong> <%=vif.vifname%> | <strong>Type:</strong> AP | <strong>SSID:</strong> <%=vif.__ssid%> | <strong>Channel:</strong> <%=vif.__channel or dev.Channel%>
<br/>
<% if vif.state == "up" then %>
<strong>BSSID:</strong>:<%=vif.__bssid%> | <strong>Mode:</strong> <%=dev.WirelessModeList[tonumber(vif.__wirelessmode or dev.WirelessMode)]%>
<% else %>
Wireless is disabled or not associated
<% end %>
</td>
<td class="cbi-value-field" style="text-align:right">
<% if not vif.state then %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="Enable this network" value="Enable" type="button" onclick="alert('Please restart manually to create this interface.')" />
<% elseif vif.state == "up" then %>
<input class="cbi-button cbi-button-reset" style="width:100px" title="Disable this network" value="Disable" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_disable", vif.vifname)%>'" />
<% else %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="Enable this network" value="Enable" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_enable", vif.vifname)%>'" />
<% end %>
<input class="cbi-button cbi-button-edit" style="width:100px" title="Edit this network" value="Config" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_cfg_view", dev.devname, vif.vifname)%>'" />
<input class="cbi-button cbi-button-remove" style="width:100px" title="Delete this network" value="Remove" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_del", dev.devname, vif.vifname)%>'" />
</td>
</tr>
<% end %>
<!-- /network list -->
<!-- apcli list -->
<% if dev.apcli then %>
<tr>
<td></td>
<td class="cbi-value-field" style="width:16px; padding:3px">
<% if dev.apcli.state == "up" then %>
<img src="/luci-static/resources/icons/signal-75-100.png" />
<% else %>
<img src="/luci-static/resources/icons/signal-none.png" />
<% end %>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px"><strong>Interface:</strong> <%=dev.apcli.devname%> | <strong>Type:</strong> STA | <strong>Status:</strong> <%=dev.apcli.status%>
<br/>
<% if dev.apcli.status == "Connected" then %>
<strong>BSSID:</strong>:<%=dev.apcli.bssid%> |
<strong>SSID:</strong>:<%=dev.apcli.ssid%>
<% else %>
Wireless is disabled or not associated
<% end %>
</td>
<td style="text-align:right">
<% if dev.apcli.state == "up" then %>
<input class="cbi-button cbi-button-reset" style="width:100px" title="Disable this network" value="Disable" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_disable", dev.apcli.vifname)%>'" />
<% else %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="Enable this network" value="Enable" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_enable", dev.apcli.vifname)%>'" />
<% end %>
<% if dev.apcli.status == "Connected" then %>
<input class="cbi-button cbi-button-remove" style="width:100px" title="Reload WiFi network" value="Disconnect" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_disconnect", dev.devname, dev.apcli.vifname)%>")' />
<% else %>
<!-- <input class="cbi-button cbi-button-reload" style="width:100px" title="Reload WiFi network" value="Connect" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_connect", dev.devname,dev.apcli.vifname)%>")' /> -->
<% end %>
<input class="cbi-button cbi-button-edit" style="width:100px" title="Configure WiFi device" value="Config" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "apcli_cfg_view", dev.devname, dev.apcli.vifname)%>'" />
</td>
</tr>
<% end %>
<!-- /apcli list -->
</tbody>
</table>
</fieldset>
<% end %>
<!--
<h2><a id="content" name="content"><%:Station List%></a></h2>
<fieldset class="cbi-section">
<table class="cbi-section-table" style="margin:10px" id="iw-assoclist">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"></th>
<th class="cbi-section-table-cell"><%:SSID%></th>
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
<th class="cbi-section-table-cell"><%:Signal%></th>
<th class="cbi-section-table-cell"><%:Noise%></th>
<th class="cbi-section-table-cell"><%:RX Rate%></th>
<th class="cbi-section-table-cell"><%:TX Rate%></th>
</tr>
<tr class="cbi-section-table-row cbi-rowstyle-2">
<td class="cbi-value-field" colspan="8">
<em><%:Collecting data...%></em>
</td>
</tr>
</table>
</fieldset>
-->
<script type="text/javascript">
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
XHR.get(url, null,
function(x)
{
console.log(x);
document.getElementById("loading").style.display="none";
window.location.reload();
}
);
}
</script>
<%+footer%>

View File

@ -1,602 +0,0 @@
<%+header%>
<!--
This module is a demo to configure MTK' proprietary WiFi driver.
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
translate uci into MTK's WiFi profile (like we did in "uci2dat").
Hua Shao <nossiac@163.com>
-->
<%
function any_wsc_enabled(wsc_conf_mode)
if (wsc_conf_mode == "7") then
return 1;
end
if (wsc_conf_mode == "4") then
return 1;
end
if (wsc_conf_mode == "2") then
return 1;
end
if (wsc_conf_mode == "1") then
return 1;
end
return 0;
end
local disp = require "luci.dispatcher"
local path = disp.context.path
local request = disp.context.request
local mtkwifi = require("mtkwifi")
local devname
local vifname, vifidx
local dev = {}
local vif = {}
if request[4] == "vif_add_view" then
devname, vifname = request[5], request[6]
local devs = mtkwifi.get_all_devs()
dev = devs and devs[devname]
vifname = vifname..#dev.vifs
vifidx = #dev.vifs + 1
elseif request[4] == "vif_cfg_view" then
devname, vifname = request[5], request[6]
local devs = mtkwifi.get_all_devs()
dev = devs and devs[devname] or nil
vif = dev and dev.vifs[vifname] or nil
vifidx = vif and vif.vifidx or nil
end
local cfgs = mtkwifi.load_profile(dev.profile)
local WscValue = mtkwifi.token_get(cfgs["WscConfMode"], vifidx, "0") or "0"
%>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
<div id="loading" style="margin-top: 1em; display: none;">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
&nbsp;&nbsp;&nbsp; Please waiting while the page is loading......
</div>
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "vif_cfg", devname, vifname)%>" enctype="multipart/form-data" onsubmit="return validate_security(<%=vifidx%>,<%=cfgs["HT_DisallowTKIP"]%>)" autocomplete="off">
<% if not dev or not vif then%>
<fieldset class="cbi-section">
<legend>Interface Not Exist - <%=vifname and devname.."@"..vifname or devname%>
</legend>
</fieldset>
<% else %>
<fieldset class="cbi-section">
<legend>Interface Configurations - <%=vifname and devname.."@"..vifname or devname%>
<%
local diff = mtkwifi.diff_profile(dev.profile)
if next(diff) ~= nil then
%>
<span style="color:red;">(<a href="javascript:location.href='<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", dev.devname)%>'">reload</a> to apply changes)</span>
<%
end
%>
</legend>
<table id="vif-cfg-basic">
<tbody>
<tr>
<td>SSID</td>
<td>
<input value="<%=vif.__ssid%>" name="<%="SSID"..vifidx%>" required="required" />
<input value="<%=request[4]%>" name="__action" type="hidden" />
</td>
</tr>
<% if dev.DBDC_MODE == "0" then %>
<tr>
<td>Channel</td>
<td>
<select style="width:auto" name="__channel">
<% for i=0,14 do %>
<option value="<%=i%>" <% if i==vif.__channel then %> selected="selected"<% end %>>
<% if i==0 then %>Auto<% else %><%=i%><% end %>
</option>
<% end %>
</select>
</td>
</tr>
<% end %>
<tr>
<td>Auth Mode</td>
<td>
<select name="__authmode" cfg="AuthMode" id="AuthMode" onchange="AuthMode_onchange(this.options[this.options.selectedIndex].value)">
<%
local AuthModes
if(WscValue == "0") then
AuthModes = dev.AuthModeList
else
AuthModes = dev.WpsEnableAuthModeList
end
for _, v in ipairs(AuthModes) do
if (mtkwifi.token_get(cfgs.IEEE8021X, vifidx, nil) == "1") then
if(v == "IEEE8021X") then %>
<option value="<%=v%>" selected="selected" ><%=v%>
</option>
<% else %>
<option value="<%=v%>" ><%=v%>
</option>
<% end
elseif (vif.__authmode == "OPEN" and vif.__encrypttype== "NONE") then
if(v == "Disable") then %>
<option value="<%=v%>" selected="selected" ><%=v%>
</option>
<% else %>
<option value="<%=v%>" ><%=v%>
</option>
<% end
else%>
<option value="<%=v%>" <% if vif.__authmode==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
<% end %>
</select>
</td>
</tr>
</tbody>
<tbody id="wpacommon" style="display:none;">
<tr>
<td>WPA Algorithm</td>
<td>
<select name="__wpa_encrypttype" id="__wpa_encrypttype" cfg="EncrypType">
<% for _,v in ipairs(dev.WPA_Enc_List) do %>
<option value="<%=v%>" <% if vif.__encrypttype==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
</select>
</td>
</tr>
<tr>
<td>Key Renewal Interval</td>
<td>
<input value="<%=vif.__rekeyinterval%>" type="text" name="__rekeyinterval" id="__rekeyinterval" cfg="RekeyInterval" /> second(s) (0 ~ 4194303)
</td>
</tr>
</tbody>
<tbody id="WPA2PSK" style="display:none;">
<tr>
<td>Key</td>
<td>
<input value="<%=vif.__wpapsk%>" type="text" name="<%="WPAPSK"..vifidx%>" id="<%="WPAPSK"..vifidx%>" />
</td>
</tr>
</tbody>
<tbody id="WEP" style="display:none;">
<tr>
<td>Encryption</td>
<td>
<select name="__wep_encrypttype" cfg="EncrypType">
<% for _,v in ipairs(dev.WEP_Enc_List) do %>
<option value="<%=v%>" <% if vif.__encrypttype==v then %>selected="selected" <% end %>><%=v%>
</option>
<% end %>
</select>
</td>
</tr>
<tr>
<td>Default Key</td>
<td>
<select name="__DefaultKeyID" id="__DefaultKeyID">
<option value="1" <%if tonumber(vif.__wepkey_id) == 1 then%>selected="selected"<%end%>>1</option>
<option value="2" <%if tonumber(vif.__wepkey_id) == 2 then%>selected="selected"<%end%>>2</option>
<option value="3" <%if tonumber(vif.__wepkey_id) == 3 then%>selected="selected"<%end%>>3</option>
<option value="4" <%if tonumber(vif.__wepkey_id) == 4 then%>selected="selected"<%end%>>4</option>
</select>
</td>
</tr>
<tr>
<td>WEP Key 1</td>
<td>
<input value="<%=cfgs["Key1Str"..vifidx]%>" type="text" name="<%="Key1Str"..vifidx%>" id="<%="Key1Str"..vifidx%>" />
</td>
</tr>
<tr>
<td>Key Type 1</td>
<td>
<select id="<%="WEP1Type"..vifidx%>" name="<%="WEP1Type"..vifidx%>">
<option value="1" <%if(mtkwifi.token_get(cfgs["Key1Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
<option value="0" <%if(mtkwifi.token_get(cfgs["Key1Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
</select>
</td>
</tr>
<tr>
<td>WEP Key 2</td>
<td>
<input value="<%=cfgs["Key2Str"..vifidx]%>" type="text" name="<%="Key2Str"..vifidx%>" id="<%="Key2Str"..vifidx%>" />
</td>
</tr>
<tr>
<td>Key Type 2</td>
<td>
<select id="<%="WEP2Type"..vifidx%>" name="<%="WEP2Type"..vifidx%>">
<option value="1" <%if(mtkwifi.token_get(cfgs["Key2Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
<option value="0" <%if(mtkwifi.token_get(cfgs["Key2Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
</select>
</td>
</tr>
<tr>
<td>WEP Key 3</td>
<td>
<input value="<%=cfgs["Key3Str"..vifidx]%>" type="text" name="<%="Key3Str"..vifidx%>" id="<%="Key3Str"..vifidx%>" />
</td>
</tr>
<tr>
<td>Key Type 3</td>
<td>
<select id="<%="WEP3Type"..vifidx%>" name="<%="WEP3Type"..vifidx%>">
<option value="1" <%if(mtkwifi.token_get(cfgs["Key3Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
<option value="0" <%if(mtkwifi.token_get(cfgs["Key3Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
</select>
</td>
</tr>
<tr>
<td>WEP Key 4</td>
<td>
<input value="<%=cfgs["Key4Str"..vifidx]%>" type="text" name="<%="Key4Str"..vifidx%>" id="<%="Key4Str"..vifidx%>" />
</td>
</tr>
<tr>
<td>Key Type 4</td>
<td>
<select id="<%="WEP4Type"..vifidx%>" name="<%="WEP4Type"..vifidx%>">
<option value="1" <%if(mtkwifi.token_get(cfgs["Key4Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
<option value="0" <%if(mtkwifi.token_get(cfgs["Key4Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
</select>
</td>
</tr>
</tbody>
<tbody id="WPA2" style="display:none;">
<tr>
<td>PMK Cache Period</td>
<td>
<input value="<%=vif.__pmkcacheperiod%>" type="text" name="__pmkcacheperiod" id="__pmkcacheperiod" cfg="PMKCachePeriod" /> minute(s)
</td>
</tr>
<tr>
<td>Pre-Authentication</td>
<td>
<input name="__preauth" id="__preauth" value="1"
<% if mtkwifi.token_get(cfgs["PreAuth"], vifidx, 0) == "1" then %>
checked="checked"
<% end %> type="checkbox" />
</td>
</tr>
</tbody>
<tbody id="PMF" style="display:none;">
<tr>
<td>MFPC </td>
<td> <input name="__pmfmfpc" id="__pmfmfpc" value="1"
<% if mtkwifi.token_get(cfgs["PMFMFPC"], vifidx, 0) == "1" then %>
checked="checked"
<% end %> type="checkbox" /> </td>
</tr>
<tr>
<td>MFPR </td>
<td> <input name="__pmfmfpr" id="__pmfmfpr" value="1"
<% if mtkwifi.token_get(cfgs["PMFMFPR"], vifidx, 0) == "1" then %>
checked="checked"
<% end %> type="checkbox" /></td>
</tr>
<tr>
<td>MFPSHA256 </td>
<td> <input name="__pmfsha256" id="__pmfsha256" value="1"
<% if mtkwifi.token_get(cfgs["PMFSHA256"], vifidx, 0) == "1" then %>
checked="checked"
<% end %> type="checkbox" /> </td>
</tr>
</tbody>
<tbody id="IEEE8021X" style="display:none;">
<tr>
<td>WEP for 8021X</td>
<td>
<input value="1" type="checkbox" name="__8021x_wep" <% if vif.__encrypttype=="WEP" then %>checked="checked" <% end %> />
</td>
</tr>
</tbody>
<tbody id="radius" style="display:none">
<tr>
<td>Radius Server IP</td>
<td>
<input value="<%=vif.__radius_server%>" type="text" name="__radius_server" id="__radius_server" cfg="RADIUS_Server" />
</td>
</tr>
<tr>
<td>Radius Server Port</td>
<td>
<input value="<%=vif.__radius_port%>" type="text" name="__radius_port" id="__radius_port" cfg="RADIUS_Port" />
</td>
</tr>
<tr>
<td>Shared Secret</td>
<td>
<input value="<%=cfgs["RADIUS_Key"..vifidx]%>" type="text" name="<%="RADIUS_Key"..vifidx%>" id="<%="RADIUS_Key"..vifidx%>" />
</td>
</tr>
<tr>
<td>Session Timeout</td>
<td>
<input value="<%=mtkwifi.token_get(cfgs.session_timeout_interval, vifidx, 0)%>" type="text" name="__session_timeout_interval" id="__session_timeout_interval" /> second(s)
</td>
</tr>
<tr>
<td>Idle Timeout</td>
<td>
<input value="<%=cfgs.idle_timeout_interval%>" type="text" name="idle_timeout_interval" id="idle_timeout_interval" /> second(s)
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>Hidden</td>
<td>
<input name="__hidessid" cfg="HideSSID" value="1"
<% if vif.__hidessid == "1" then %>
checked="checked"
<% end %> type="checkbox" />
</td>
</tr>
<tr>
<td>AP Isolation</td>
<td>
<input name="__noforwarding" cfg="NoForwarding" value="1"
<% if vif.__noforwarding == "1" then %>
checked="checked"
<% end %> type="checkbox" />
</td>
</tr>
<tr>
<td>WMM Capable</td>
<td>
<input name="__wmmcapable" cfg="WmmCapable" value="1"
<% if vif.__wmmcapable ~= "0" then %>
checked="checked"
<% end %> type="checkbox" />
</td>
</tr>
<tr>
<td>TX Rate</td>
<td>
<input value="<%=vif.__txrate or 0%>" name="__txrate" id="__txrate" />
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<pre>
# 1. one MAC one line.
# 2. empty lines will be ignored.
# 3. lines start with "#" will be ignored.
# 4. invalid MAC will be ignored.
11:22:33:44:55:66
AA:BB:CC:DD:EE:FF
11:22:33:aa:bb:cc</pre>
<textarea name="__maclist" id="__maclist" style="width:98%; height: 200px;"><%
local list = cfgs["AccessControlList"..(vifidx-1)] or ""
print(table.concat(list:split(";"), "\n"))
%></textarea>
</fieldset>
<div class="cbi-page-actions">
<input class="cbi-button cbi-button-apply" value="Reload" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "mtk", "wifi", "reload", devname)%>");' />
<input class="cbi-button cbi-button-apply" value="Save" type="submit" />
<input class="cbi-button cbi-button-apply" name="__apply" value="Save & Apply" type="submit" />
<input class="cbi-button cbi-button-reset" value="Reset" type="reset" />
</div>
<% end %> <!-- if not dev -->
</form>
<script type="text/javascript">
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
XHR.get(url, null,
function(x)
{
console.log(x);
document.getElementById("loading").style.display="none";
window.location.reload();
}
);
}
function AuthMode_onchange(to) {
var enc_list = new Array()
enc_list[0] = "OPEN";
enc_list[1] = "WEP";
enc_list[2] = "WPA2PSK";
enc_list[3] = "WPA2";
enc_list[4] = "IEEE8021X";
enc_list[5] = "WPAPSKWPA2PSK";
enc_list[6] = "WPA1WPA2";
//replacing input string to WEP (for the case of OPEN, SHARED, WEPAUTO) so as to enable the control with id wep
if ((to == "WEPAUTO") || (to == "SHARED") || (to == "OPEN")) {
to = "WEP";
}
for (enc in enc_list) {
var e = document.getElementById(enc_list[enc])
if (enc_list[enc] == to) {
if (e) e.style.display = "";
} else {
if (e) e.style.display = "none";
}
}
if (to == "WPA2" || to == "IEEE8021X" || to == "WPA1WPA2") {
document.getElementById("radius").style.display = "";
} else {
document.getElementById("radius").style.display = "none";
}
if (to == "WPA2" || to == "WPA2PSK" || to == "WPAPSKWPA2PSK" || to == "WPA1WPA2") {
document.getElementById("wpacommon").style.display = "";
if (to != "WPAPSKWPA2PSK") {
document.getElementById("PMF").style.display = "";
} else {
document.getElementById("PMF").style.display = "none";
}
} else {
document.getElementById("wpacommon").style.display = "none";
}
if (to == "WPAPSKWPA2PSK") {
document.getElementById("WPA2PSK").style.display = "";
}
}
function validate_security(vifidx, ht_disallow_tkip) {
if (document.getElementById("__activeTab").value != "basic") {
return true;
}
var e = document.getElementById("AuthMode");
var AuthMode = e.options[e.selectedIndex].value;
if (AuthMode == "Disable") {
if (isNaN(document.getElementById("__txrate").value) == true || (document.getElementById("__txrate").value == "")) {
alert('Please input a valid TX Rate value');
return false;
}
} else if (AuthMode == "OPEN" || AuthMode == "WEPAUTO" || AuthMode == "SHARED") {
return check_Wep(AuthMode, vifidx, ht_disallow_tkip);
} else if (AuthMode == "WPAPSK" || AuthMode == "WPA2PSK" || AuthMode == "WPAPSKWPA2PSK") {
return check_WpaKey(AuthMode, vifidx, ht_disallow_tkip);
} else if (AuthMode == "WPA2") {
if (check_Wpa2(AuthMode, vifidx) == false)
return false;
if (check_radius(vifidx) == false)
return false;
} else if (AuthMode == "8021X") {
if (check_radius(vifidx) == false)
return false;
} else if (AuthMode == "WPA" || AuthMode == "WPA1WPA2") // WPA or WPA1WP2 mixed mode
{
if (check_Wpa(AuthMode, vifidx, ht_disallow_tkip) == false)
return false;
if (check_radius(vifidx) == false)
return false;
} else if (AuthMode == "IEEE8021X") // 802.1x
{
if (check_radius(vifidx) == false)
return false;
} else {
alert("Unknown value " + AuthMode + "for Auth Mode");
return false;
}
return true;
}
function check_Wpa2(AuthMode, vifidx) {
if (isNaN(document.getElementById("__rekeyinterval").value) == true) {
alert('Please input a valid key renewal interval');
return false;
}
if (document.getElementById("__rekeyinterval").value == 0) {
alert('Renew key interval is equal to 0, so the device will not refresh key');
}
if (!document.getElementById("__pmkcacheperiod").value.length) {
alert('Please input the PMK Cache Period.');
return false;
} else if (isNaN(document.getElementById("__pmkcacheperiod").value)) {
alert('Please input a number for PMK Cache Period.');
return false;
}
if (check_radius(vifidx) == false)
return false;
}
function check_WpaKey(AuthMode, vifidx, ht_disallow_tkip) {
var keyvalue = document.getElementById("WPAPSK" + vifidx).value;
if (keyvalue.length == 0) {
alert('Please input wpapsk key!');
return false;
}
if (keyvalue.length < 8) {
alert('Please input at least 8 character of wpapsk key!');
return false;
}
if (keyvalue.length == 64 && checkHex(keyvalue) == false) {
alert('Please input 8~63 ASCII or 64 Hexadecimal character!');
return false;
}
if (checkInjection(keyvalue) == false) {
alert('Invalid characters in Pass Phrase.');
return false;
}
return check_Wpa(AuthMode, vifidx, ht_disallow_tkip);
}
function check_Wpa(AuthMode, vifidx, ht_disallow_tkip) {
var e = document.getElementById("__wpa_encrypttype");
var EncrypType = e.options[e.selectedIndex].value;
// there is no tkip-aes mixed mode in WPA-PSK.
if ((AuthMode == "WPA" || AuthMode == "WPAPSK") && (EncrypType == "TKIPAES")) {
alert("There is no TKIP-AES mode in WPA-PSK");
return false;
}
if (ht_disallow_tkip == "1" && EncrypType == "TKIP")
alert("Disallow TKIP/WEP encryption is enabled, so 11N rate will turn off!");
if (isNaN(document.getElementById("__rekeyinterval").value) == true) {
alert('Please input a valid key renewal interval');
return false;
}
if (document.getElementById("__rekeyinterval").value == 0) {
alert('Renew key interval is equal to 0, so the device will not refresh key');
}
return true;
}
function check_Wep(AuthMode, vifidx, ht_disallow_tkip) {
var e = document.getElementById("__DefaultKeyID");
var defaultid = e.options[e.selectedIndex].value;
var keyvalue = document.getElementById("Key" + defaultid + "Str" + vifidx).value;
if (keyvalue.length == 0) {
alert('Please input wep key' + defaultid + ' !');
return false;
}
var keylength = keyvalue.length;
if (keylength != 0) {
if (document.getElementById("WEP" + defaultid + "Type" + vifidx).selectedIndex == 0) {
if (keylength != 5 && keylength != 13) {
alert('Please input 5 or 13 characters of wep key' + defaultid + ' !');
return false;
}
if (checkInjection(keyvalue) == false) {
alert('Wep key' + defaultid + " contains invalid characters.");
return false;
}
}
if (document.getElementById("WEP" + defaultid + "Type" + vifidx).selectedIndex == 1) {
if (keylength != 10 && keylength != 26) {
alert('Please input 10 or 26 characters of wep key' + defaultid + ' !');
return false;
}
if (checkHex(keyvalue) == false) {
alert('Invalid Wep key1 format!');
return false;
}
}
}
if (ht_disallow_tkip == "1")
alert("Disallow TKIP/WEP encryption is enabled, so 11N rate will turn off!");
return true;
}
window.onload = AuthMode_onchange(document.getElementById("AuthMode").options[document.getElementById("AuthMode").selectedIndex].value)
</script>
<%+footer%>

View File

@ -1,199 +0,0 @@
#!/usr/bin/env lua
-- Alternative for OpenWrt's /sbin/wifi.
-- Copyright Not Reserved.
-- Hua Shao <nossiac@163.com>
package.path = '/lib/wifi/?.lua;'..package.path
local mtkwifi = require("mtkwifi")
local nixio = require("nixio")
function usage()
print("wifi <up|down|reset|reload|status> [devname]")
end
function wifi_common_up(devname)
nixio.syslog("debug", "wifi_common_up "..tostring(devname))
-- need to find out the vif prefix for this device
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if string.match(vif, "ra%a-%d+") then
os.execute("ifconfig "..vif.." up")
end
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if string.match(vif, "apcli%a-%d+") then
os.execute("ifconfig "..vif.." up")
end
end
end
function wifi_common_down(devname)
nixio.syslog("debug", "wifi_common_down "..tostring(devname))
-- need to find out the vif prefix for this device
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if string.match(vif, "apcli%d+")
or string.match(vif, "apclii%d+") then
os.execute("ifconfig "..vif.." down")
end
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if string.match(vif, "ra%d+")
or string.match(vif, "rai%d+")
or string.match(vif, "rae%d+")
or string.match(vif, "rax%d+") then
os.execute("ifconfig "..vif.." down")
end
end
end
function wifi_common_reload(devname)
nixio.syslog("debug", "wifi_common_reload "..tostring(devname))
wifi_common_up()
wifi_common_down()
end
function wifi_common_restart(devname)
nixio.syslog("debug", "wifi_common_restart "..tostring(devname))
wifi_common_reload()
end
function wifi_common_reset(devname)
nixio.syslog("debug", "wifi_common_reset called!")
local curpath = "/etc/wireless/"
if devname then
curpath = curpath..devname.."/"
end
local defpath = "/rom"..defpath
if mtkwifi.exists(defpath) then
os.execute("rm -rf "..curpath)
os.execute("cp -rf "..defpath.." "..curpath)
wifi_common_reload()
else
nixio.syslog("debug", defpath.." missing, unable to reset!")
end
end
function wifi_common_status(devname)
nixio.syslog("debug", "wifi_common_status "..tostring(devname))
print(mtkwifi.read_pipe("iwconfig"))
print(mtkwifi.read_pipe("ifconfig -a"))
end
function wifi_common_detect(devname)
nixio.syslog("debug", "wifi_common_detect "..tostring(devname))
local devs = mtkwifi.getdevs()
for _,dev in ipairs(devs) do
print("config wifi-device "..dev.devname..
"\n\toption type "..dev.devname..
"\n\toption vendor ralink"..
"\n\toption channel "..dev.Channel)
for _,vif in ipairs(dev.vifs) do
print("\nconfig wifi-iface"..
"\n\toption device"..dev.devname..
"\n\toption ifname"..vif.vifname..
"\n\toption network lan"..
"\n\toption mode ap")
end
end
end
for _,f in ipairs(string.split(mtkwifi.read_pipe("find /lib/wifi/ -name \"*.lua\" 2>/dev/null"), "\n")) do
dofile(f)
end
function wifi(cmd, devname)
local mtkwifi = require("mtkwifi")
local devs, l1parser = mtkwifi.__get_l1dat()
if not devs or not l1parser then
return wifi_orig(cmd, devname)
end
if devname then
local dev = devs.devname_ridx[devname]
assert(mtkwifi.exists(dev.init_script))
local compatname = dev.init_compatible
assert(compatname)
if _G[compatname.."_"..cmd] then
nixio.syslog("info", "call "..compatname.."_"..cmd.."("..devname..")")
_G[compatname.."_"..cmd](devname)
end
return
end
-- if devname not not specified
for devname, dev in pairs(devs.devname_ridx) do
local compatname = dev.init_compatible
nixio.syslog("info", "call "..compatname.."_"..cmd.."("..devname..")")
_G[compatname.."_"..cmd](devname)
end
end
function wifi_orig(cmd,devname)
local relname = nil
if devname then
relname = string.split(devname,".")[1]
end
if relname then
if _G[relname.."_"..cmd] then
nixio.syslog("info", "call "..relname.."_"..cmd.."("..devname..")")
_G[relname.."_"..cmd](devname)
end
else
local devinfo = mtkwifi.search_dev_and_profile()
local done = {}
for __devname in pairs(devinfo) do
local __relname = string.split(__devname,".")[1]
repeat
-- common case
if done[__relname] then break else done[__relname] = true end
if _G[__relname.."_"..cmd] then
nixio.syslog("info", "call "..__relname.."_"..cmd.."("..__devname..")")
_G[__relname.."_"..cmd](__devname)
break
end
-- try shell
local dev_shell = "/lib/wifi/"..__relname..".sh"
if mtkwifi.exists(dev_shell) then
local cmd = "source "..dev_shell.."; "..__relname.."_"..cmd.." > /dev/null"
nixio.syslog("info", cmd)
if os.execute(cmd) ~= 0 then
nixio.syslog("err", cmd)
end
break
end
-- fall back on common api
nixio.syslog("info", "no scripts for "..__relname.." found, fall back on common api!")
_G["wifi_common_"..cmd](__devname)
until true
end
end
end
cmd = arg[1]
dev = arg[2]
if cmd == "up"
or cmd == "down"
or cmd == "status"
or cmd == "detect"
or cmd == "reload"
or cmd == "restart"
or cmd == "reset" then
wifi(cmd, dev)
elseif cmd == "reload_legacy" then
nixio.syslog("info", "legacy command "..cmd)
wifi("up", dev)
else
usage()
end

View File

@ -1,953 +0,0 @@
#!/usr/bin/env lua
--[[
* A lua library to manipulate mtk's wifi driver. used in luci-app-mtk.
*
* Hua Shao <nossiac@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
]]
local mtkwifi = {}
local _, nixio = pcall(require, "nixio")
function mtkwifi.debug(...)
local ff = io.open("/tmp/mtkwifi.dbg.log", "a")
local vars = {...}
for _, v in pairs(vars) do
ff:write(v.." ")
end
ff:write("\n")
ff:close()
end
if not nixio then
nixio.syslog = mtkwifi.debug
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
function mtkwifi.__trim(s)
if s then return (s:gsub("^%s*(.-)%s*$", "%1")) end
end
function mtkwifi.__handleSpecialChars(s)
s = s:gsub("\\", "\\\\")
s = s:gsub("\"", "\\\"")
s = mtkwifi.__trim(s)
return s
end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
function mtkwifi.__spairs(t, order)
-- collect the keys
local keys = {}
for k in pairs(t) do keys[#keys+1] = k end
table.sort(keys, order)
-- return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
end
end
end
function mtkwifi.__lines(str)
local t = {}
local function helper(line) table.insert(t, line) return "" end
helper((str:gsub("(.-)\r?\n", helper)))
return t
end
function mtkwifi.__get_l1dat()
if not pcall(require, "l1dat_parser") then
return
end
local parser = require("l1dat_parser")
local l1dat = parser.load_l1_profile(parser.L1_DAT_PATH)
return l1dat, parser
end
function mtkwifi.sleep(s)
local ntime = os.clock() + s
repeat until os.clock() > ntime
end
function mtkwifi.deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[mtkwifi.deepcopy(orig_key)] = mtkwifi.deepcopy(orig_value)
end
setmetatable(copy, mtkwifi.deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function mtkwifi.read_pipe(pipe)
local fp = io.popen(pipe)
local txt = fp:read("*a")
fp:close()
return txt
end
function mtkwifi.load_profile(path, raw)
local cfgs = {}
local content
if path then
local fd = io.open(path, "r")
if not fd then return end
content = fd:read("*all")
fd:close()
elseif raw then
content = raw
else
return
end
-- convert profile into lua table
for _,line in ipairs(mtkwifi.__lines(content)) do
line = mtkwifi.__trim(line)
if string.byte(line) ~= string.byte("#") then
local i = string.find(line, "=")
if i then
local k,v
k = string.sub(line, 1, i-1)
v = string.sub(line, i+1)
if cfgs[mtkwifi.__trim(k)] then
mtkwifi.debug("warning", "skip repeated key"..line)
end
cfgs[mtkwifi.__trim(k)] = mtkwifi.__trim(v) or ""
else
mtkwifi.debug("warning", "skip line without '=' "..line)
end
else
mtkwifi.debug("warning", "skip comment line "..line)
end
end
return cfgs
end
function mtkwifi.__profile_bak_path(profile)
local bak = "/tmp/mtk/wifi/"..string.match(profile, "([^/]+\.dat)")..".last"
os.execute("mkdir -p /tmp/mtk/wifi")
return bak
end
function mtkwifi.save_profile(cfgs, path)
if not cfgs then
mtkwifi.debug("configuration was empty, nothing saved")
return
end
local fd = io.open(path, "w")
table.sort(cfgs, function(a,b) return a<b end)
if not fd then return end
fd:write("# Generated by mtkwifi.lua\n")
fd:write("Default\n")
for k,v in mtkwifi.__spairs(cfgs, function(a,b) return string.upper(a) < string.upper(b) end) do
fd:write(k.."="..v.."\n")
end
fd:close()
if pcall(require, "mtknvram") then
local nvram = require("mtknvram")
local l1dat, l1 = mtkwifi.__get_l1dat()
local zone = l1 and l1.l1_path_to_zone(path)
if not l1dat then
mtkwifi.debug("save_profile: no l1dat", path)
nvram.nvram_save_profile(path)
else
if zone then
mtkwifi.debug("save_profile:", path, zone)
nvram.nvram_save_profile(path, zone)
else
mtkwifi.debug("save_profile:", path)
nvram.nvram_save_profile(path)
end
end
end
end
-- if path2 not give, we use path1's backup.
function mtkwifi.diff_profile(path1, path2)
assert(path1)
if not path2 then
path2 = mtkwifi.__profile_bak_path(path1)
if not mtkwifi.exists(path2) then
return {}
end
end
assert(path2)
local diff = {}
local cfg1 = mtkwifi.load_profile(path1) or {}
local cfg2 = mtkwifi.load_profile(path2) or {}
for k,v in pairs(cfg1) do
if cfg2[k] ~= cfg1[k] then
diff[k] = {cfg1[k] or "", cfg2[k] or ""}
end
end
for k,v in pairs(cfg2) do
if cfg2[k] ~= cfg1[k] then
diff[k] = {cfg1[k] or "", cfg2[k] or ""}
end
end
return diff
end
-- Mode 12 and 13 are only available for STAs.
local WirelessModeList = {
[0] = "B/G mixed",
[1] = "B only",
[2] = "A only",
-- [3] = "A/B/G mixed",
[4] = "G only",
-- [5] = "A/B/G/GN/AN mixed",
[6] = "N in 2.4G only",
[7] = "G/GN", -- i.e., no CCK mode
[8] = "A/N in 5 band",
[9] = "B/G/GN mode",
-- [10] = "A/AN/G/GN mode", --not support B mode
[11] = "only N in 5G band",
-- [12] = "B/G/GN/A/AN/AC mixed",
-- [13] = "G/GN/A/AN/AC mixed", -- no B mode
[14] = "A/AC/AN mixed",
[15] = "AC/AN mixed", --but no A mode
}
local DevicePropertyMap = {
-- 2.4G
{device="MT7603", band={"0", "1", "4", "6", "7", "9"}},
{device="MT7620", band={"0", "1", "4", "6", "7", "9"}},
{device="MT7622", band={"0", "1", "4", "9"}},
{device="MT7628", band={"0", "1", "4", "6", "7", "9"}},
-- 5G
{device="MT7610", band={"2", "8", "11", "14", "15"}},
{device="MT7612", band={"2", "8", "11", "14", "15"}},
{device="MT7662", band={"2", "8", "11", "14", "15"}},
-- Mix
{device="MT7615", band={"0", "1", "4", "9", "2", "8", "14", "15"}}
}
mtkwifi.CountryRegionList_5G_All = {
{region=0, text="0: Ch36~64, Ch149~165"},
{region=1, text="1: Ch36~64, Ch100~140"},
{region=2, text="2: Ch36~64"},
{region=3, text="3: Ch52~64, Ch149~161"},
{region=4, text="4: Ch149~165"},
{region=5, text="5: Ch149~161"},
{region=6, text="6: Ch36~48"},
{region=7, text="7: Ch36~64, Ch100~140, Ch149~165"},
{region=8, text="8: Ch52~64"},
{region=9, text="9: Ch36~64, Ch100~116, Ch132~140, Ch149~165"},
{region=10, text="10: Ch36~48, Ch149~165"},
{region=11, text="11: Ch36~64, Ch100~120, Ch149~161"},
{region=12, text="12: Ch36~64, Ch100~144"},
{region=13, text="13: Ch36~64, Ch100~144, Ch149~165"},
{region=14, text="14: Ch36~64, Ch100~116, Ch132~144, Ch149~165"},
{region=15, text="15: Ch149~173"},
{region=16, text="16: Ch52~64, Ch149~165"},
{region=17, text="17: Ch36~48, Ch149~161"},
{region=18, text="18: Ch36~64, Ch100~116, Ch132~140"},
{region=19, text="19: Ch56~64, Ch100~140, Ch149~161"},
{region=20, text="20: Ch36~64, Ch100~124, Ch149~161"},
{region=21, text="21: Ch36~64, Ch100~140, Ch149~161"},
{region=22, text="22: Ch100~140"},
{region=30, text="30: Ch36~48, Ch52~64, Ch100~140, Ch149~165"},
{region=31, text="31: Ch52~64, Ch100~140, Ch149~165"},
{region=32, text="32: Ch36~48, Ch52~64, Ch100~140, Ch149~161"},
{region=33, text="33: Ch36~48, Ch52~64, Ch100~140"},
{region=34, text="34: Ch36~48, Ch52~64, Ch149~165"},
{region=35, text="35: Ch36~48, Ch52~64"},
{region=36, text="36: Ch36~48, Ch100~140, Ch149~165"},
{region=37, text="37: Ch36~48, Ch52~64, Ch149~165, Ch173"},
}
mtkwifi.CountryRegionList_2G_All = {
{region=0, text="0: Ch1~11"},
{region=1, text="1: Ch1~13"},
{region=2, text="2: Ch10~11"},
{region=3, text="3: Ch10~13"},
{region=4, text="4: Ch14"},
{region=5, text="5: Ch1~14"},
{region=6, text="6: Ch3~9"},
{region=7, text="7: Ch5~13"},
{region=31, text="31: Ch1~11, Ch12~14"},
{region=32, text="32: Ch1~11, Ch12~13"},
{region=33, text="33: Ch1~14"},
}
mtkwifi.ChannelList_5G_All = {
{channel=0, text="Channel 0 (Auto )", region={}},
{channel= 36, text="Channel 36 (5.180 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
{channel= 40, text="Channel 40 (5.200 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
{channel= 44, text="Channel 44 (5.220 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
{channel= 48, text="Channel 48 (5.240 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
{channel= 52, text="Channel 52 (5.260 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
{channel= 56, text="Channel 56 (5.280 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
{channel= 60, text="Channel 60 (5.300 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
{channel= 64, text="Channel 64 (5.320 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
{channel=100, text="Channel 100 (5.500 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=104, text="Channel 104 (5.520 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=108, text="Channel 108 (5.540 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=112, text="Channel 112 (5.560 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=116, text="Channel 116 (5.580 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=120, text="Channel 120 (5.600 GHz)", region={[1]=1, [7]=1, [11]=1, [12]=1, [13]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=124, text="Channel 124 (5.620 GHz)", region={[1]=1, [7]=1, [12]=1, [13]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=128, text="Channel 128 (5.640 GHz)", region={[1]=1, [7]=1, [12]=1, [13]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=132, text="Channel 132 (5.660 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=136, text="Channel 136 (5.680 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=140, text="Channel 140 (5.700 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
{channel=144, text="Channel 144 (5.720 GHz)", region={[12]=1, [13]=1, [14]=1}},
{channel=149, text="Channel 149 (5.745 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
{channel=153, text="Channel 153 (5.765 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
{channel=157, text="Channel 157 (5.785 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
{channel=161, text="Channel 161 (5.805 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
{channel=165, text="Channel 165 (5.825 GHz)", region={[0]=1, [4]=1, [7]=1, [9]=1, [10]=1, [13]=1, [14]=1, [15]=1, [16]=1, [30]=1, [31]=1, [34]=1, [36]=1, [37]=1}},
{channel=169, text="Channel 169 (5.845 GHz)", region={[15]=1}},
{channel=173, text="Channel 173 (5.865 GHz)", region={[15]=1, [37]=1}},
}
mtkwifi.ChannelList_2G_All = {
{channel=0, text="Channel 0 (Auto )", region={}},
{channel= 1, text="Channel 1 (2412 GHz)", region={[0]=1, [1]=1, [5]=1, [31]=1, [32]=1, [33]=1}},
{channel= 2, text="Channel 2 (2417 GHz)", region={[0]=1, [1]=1, [5]=1, [31]=1, [32]=1, [33]=1}},
{channel= 3, text="Channel 3 (2422 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [31]=1, [32]=1, [33]=1}},
{channel= 4, text="Channel 4 (2427 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [31]=1, [32]=1, [33]=1}},
{channel= 5, text="Channel 5 (2432 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel= 6, text="Channel 6 (2437 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel= 7, text="Channel 7 (2442 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel= 8, text="Channel 8 (2447 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel= 9, text="Channel 9 (2452 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel=10, text="Channel 10 (2457 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel=11, text="Channel 11 (2462 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel=12, text="Channel 12 (2467 GHz)", region={[1]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel=13, text="Channel 13 (2472 GHz)", region={[1]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
{channel=14, text="Channel 14 (2477 GHz)", region={[4]=1, [5]=1, [31]=1, [33]=1}},
}
mtkwifi.ChannelList_5G_2nd_80MHZ_ALL = {
{channel=36, text="Ch36(5.180 GHz) - Ch48(5.240 GHz)", chidx=2},
{channel=52, text="Ch52(5.260 GHz) - Ch64(5.320 GHz)", chidx=6},
{channel=-1, text="Channel between 64 100", chidx=-1},
{channel=100, text="Ch100(5.500 GHz) - Ch112(5.560 GHz)", chidx=10},
{channel=112, text="Ch116(5.580 GHz) - Ch128(5.640 GHz)", chidx=14},
{channel=-1, text="Channel between 128 132", chidx=-1},
{channel=132, text="Ch132(5.660 GHz) - Ch144(5.720 GHz)", chidx=18},
{channel=-1, text="Channel between 144 149", chidx=-1},
{channel=149, text="Ch149(5.745 GHz) - Ch161(5.805 GHz)", chidx=22},
}
local AuthModeList = {
"Disable",
"OPEN",--OPENWEP
"SHARED",--SHAREDWEP
"WEPAUTO",
"WPA2",
"WPA2PSK",
"WPAPSKWPA2PSK",
"WPA1WPA2",
"IEEE8021X",
}
local WpsEnableAuthModeList = {
"Disable",
"OPEN",--OPENWEP
"WPA2PSK",
"WPAPSKWPA2PSK",
}
local ApCliAuthModeList = {
"Disable",
"OPEN",
"SHARED",
"WPAPSK",
"WPA2PSK",
"WPAPSKWPA2PSK",
-- "WPA",
-- "WPA2",
-- "WPAWPA2",
-- "8021X",
}
local WPA_Enc_List = {
"AES",
"TKIP",
"TKIPAES",
}
local WEP_Enc_List = {
"WEP",
}
local dbdc_prefix = {
{"ra", "rax"},
{"rai", "ray"},
{"rae", "raz"},
}
local dbdc_apcli_prefix = {
{"apcli", "apclix"},
{"apclii", "apcliy"},
{"apclie", "apcliz"},
}
function mtkwifi.band(mode)
local i = tonumber(mode)
if i == 0
or i == 1
or i == 4
or i == 6
or i == 7
or i == 9 then
return "2.4G"
else
return "5G"
end
end
function mtkwifi.__cfg2list(str)
-- delimeter == ";"
local i = 1
local list = {}
for k in string.gmatch(str, "([^;]+)") do
list[i] = k
i = i + 1
end
return list
end
function mtkwifi.token_set(str, n, v)
-- n start from 1
-- delimeter == ";"
if not str then return end
local tmp = mtkwifi.__cfg2list(str)
if type(v) ~= type("") and type(v) ~= type(0) then
mtkwifi.debug("err", "invalid value type in token_set, "..type(v))
return
end
if #tmp < tonumber(n) then
for i=#tmp, tonumber(n) do
if not tmp[i] then
tmp[i] = v -- pad holes with v !
end
end
else
tmp[n] = v
end
return table.concat(tmp, ";")
end
function mtkwifi.token_get(str, n, v)
-- n starts from 1
-- v is the backup in case token n is nil
if not str then return v end
local tmp = mtkwifi.__cfg2list(str)
return tmp[tonumber(n)] or v
end
function mtkwifi.search_dev_and_profile_orig()
local dir = io.popen("ls /etc/wireless/")
if not dir then return end
local result = {}
-- case 1: mt76xx.dat (best)
-- case 2: mt76xx.n.dat (multiple card of same dev)
-- case 3: mt76xx.n.nG.dat (case 2 plus dbdc and multi-profile, bloody hell....)
for line in dir:lines() do
-- mtkwifi.debug("debug", "scan "..line)
local tmp = io.popen("find /etc/wireless/"..line.." -type f -name \"*.dat\"")
for datfile in tmp:lines() do
-- mtkwifi.debug("debug", "test "..datfile)
repeat do
-- for case 1
local devname = string.match(datfile, "("..line..").dat")
if devname then
result[devname] = datfile
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
break
end
-- for case 2
local devname = string.match(datfile, "("..line.."%.%d)%.dat")
if devname then
result[devname] = datfile
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
break
end
-- for case 3
local devname = string.match(datfile, "("..line.."%.%d%.%dG)%.dat")
if devname then
result[devname] = datfile
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
break
end
end until true
end
end
for k,v in pairs(result) do
mtkwifi.debug("debug", "search_dev_and_profile_orig: "..k.."="..v)
end
return result
end
function mtkwifi.search_dev_and_profile_l1()
local l1dat = mtkwifi.__get_l1dat()
if not l1dat then return end
local result = {}
local dbdc_2nd_if = ""
for k, dev in ipairs(l1dat) do
dbdc_2nd_if = mtkwifi.token_get(dev.main_ifname, 2, nil)
if dbdc_2nd_if then
result[dev["INDEX"].."."..dev["mainidx"]..".1"] = mtkwifi.token_get(dev.profile_path, 1, nil)
result[dev["INDEX"].."."..dev["mainidx"]..".2"] = mtkwifi.token_get(dev.profile_path, 2, nil)
else
result[dev["INDEX"].."."..dev["mainidx"]] = dev.profile_path
end
end
for k,v in pairs(result) do
mtkwifi.debug("debug", "search_dev_and_profile_l1: "..k.."="..v)
end
return result
end
function mtkwifi.search_dev_and_profile()
return mtkwifi.search_dev_and_profile_l1() or mtkwifi.search_dev_and_profile_orig()
end
function mtkwifi.__setup_vifs(cfgs, devname, mainidx, subidx)
local l1dat, l1 = mtkwifi.__get_l1dat()
local dridx = l1dat and l1.DEV_RINDEX
local prefix
local main_ifname
local vifs = {}
local dev_idx = ""
prefix = l1dat and l1dat[dridx][devname].ext_ifname or dbdc_prefix[mainidx][subidx]
dev_idx = string.match(devname, "(%w+)")
vifs["__prefix"] = prefix
if (cfgs.BssidNum == nil) then
mtkwifi.debug("BssidNum configuration value not found.")
mtkwifi.debug("debug","BssidNum configuration value not found.")
return
end
for j=1,tonumber(cfgs.BssidNum) do
vifs[j] = {}
vifs[j].vifidx = j -- start from 1
dev_idx = string.match(devname, "(%w+)")
main_ifname = l1dat and l1dat[dridx][devname].main_ifname or dbdc_prefix[mainidx][subidx].."0"
mtkwifi.debug("setup_vifs", prefix, dev_idx, mainidx, subidx)
vifs[j].vifname = j == 1 and main_ifname or prefix..(j-1)
if mtkwifi.exists("/sys/class/net/"..vifs[j].vifname) then
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..vifs[j].vifname.."/flags 2>/dev/null")) or 0
vifs[j].state = flags%2 == 1 and "up" or "down"
end
vifs[j].__ssid = cfgs["SSID"..j]
vifs[j].__bssid = mtkwifi.read_pipe("cat /sys/class/net/"..prefix..(j-1).."/address 2>/dev/null") or "?"
if dbdc then
vifs[j].__channel = mtkwifi.token_get(cfgs.Channel, j, 0)
vifs[j].__wirelessmode = mtkwifi.token_get(cfgs.WirelessMode, j, 0)
end
vifs[j].__authmode = mtkwifi.token_get(cfgs.AuthMode, j, "OPEN")
vifs[j].__encrypttype = mtkwifi.token_get(cfgs.EncrypType, j, "NONE")
vifs[j].__hidessid = mtkwifi.token_get(cfgs.HideSSID, j, 0)
vifs[j].__noforwarding = mtkwifi.token_get(cfgs.NoForwarding, j, 0)
vifs[j].__wmmcapable = mtkwifi.token_get(cfgs.WmmCapable, j, 0)
vifs[j].__txrate = mtkwifi.token_get(cfgs.TxRate, j, 0)
vifs[j].__ieee8021x = mtkwifi.token_get(cfgs.IEEE8021X, j, 0)
vifs[j].__preauth = mtkwifi.token_get(cfgs.PreAuth, j, 0)
vifs[j].__rekeymethod = mtkwifi.token_get(cfgs.RekeyMethod, j, 0)
vifs[j].__rekeyinterval = mtkwifi.token_get(cfgs.RekeyInterval, j, 0)
vifs[j].__pmkcacheperiod = mtkwifi.token_get(cfgs.PMKCachePeriod, j, 0)
vifs[j].__ht_extcha = mtkwifi.token_get(cfgs.HT_EXTCHA, j, 0)
vifs[j].__radius_server = mtkwifi.token_get(cfgs.RADIUS_Server, j, 0)
vifs[j].__radius_port = mtkwifi.token_get(cfgs.RADIUS_Port, j, 0)
vifs[j].__wepkey_id = mtkwifi.token_get(cfgs.DefaultKeyID, j, 0)
vifs[j].__wscconfmode = mtkwifi.token_get(cfgs.WscConfMode, j, 0)
vifs[j].__wepkeys = {
cfgs["Key"..j.."Str1"],
cfgs["Key"..j.."Str2"],
cfgs["Key"..j.."Str3"],
cfgs["Key"..j.."Str4"],
}
vifs[j].__wpapsk = cfgs["WPAPSK"..j]
-- VoW
vifs[j].__atc_tp = mtkwifi.token_get(cfgs.VOW_Rate_Ctrl_En, j, 0)
vifs[j].__atc_min_tp = mtkwifi.token_get(cfgs.VOW_Group_Min_Rate, j, "")
vifs[j].__atc_max_tp = mtkwifi.token_get(cfgs.VOW_Group_Max_Rate, j, "")
vifs[j].__atc_at = mtkwifi.token_get(cfgs.VOW_Airtime_Ctrl_En, j, 0)
vifs[j].__atc_min_at = mtkwifi.token_get(cfgs.VOW_Group_Min_Ratio, j, "")
vifs[j].__atc_max_at = mtkwifi.token_get(cfgs.VOW_Group_Max_Ratio, j, "")
-- TODO index by vifname
vifs[vifs[j].vifname] = vifs[j]
end
return vifs
end
function mtkwifi.__setup_apcli(cfgs, devname, mainidx, subidx)
local l1dat, l1 = mtkwifi.__get_l1dat()
local dridx = l1dat and l1.DEV_RINDEX
local apcli = {}
local dev_idx = string.match(devname, "(%w+)")
local apcli_prefix = l1dat and l1dat[dridx][devname].apcli_ifname or
dbdc_apcli_prefix[mainidx][subidx]
local apcli_name = apcli_prefix.."0"
if mtkwifi.exists("/sys/class/net/"..apcli_name) then
apcli.vifname = apcli_name
apcli.vifidx = "1"
local iwapcli = mtkwifi.read_pipe("iwconfig "..apcli_name.." | grep ESSID 2>/dev/null")
local _,_,ssid = string.find(iwapcli, "ESSID:\"(.*)\"")
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/flags 2>/dev/null")) or 0
apcli.state = flags%2 == 1 and "up" or "down"
if not ssid or ssid == "" then
apcli.status = "Disconnected"
else
apcli.ssid = ssid
apcli.status = "Connected"
end
apcli.devname = apcli_name
apcli.bssid = mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/address 2>/dev/null") or "?"
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/flags 2>/dev/null")) or 0
apcli.ifstatus = flags%2 == 1 and "up" or ""
return apcli
else
return
end
end
function mtkwifi.get_all_devs()
local devs = {}
local i = 1 -- dev idx
local profiles = mtkwifi.search_dev_and_profile()
local wpa_support = 0
local wapi_support = 0
for devname,profile in pairs(profiles) do
mtkwifi.debug("debug", "checking "..profile)
local fd = io.open(profile,"r")
if not fd then
mtkwifi.debug("debug", "cannot find "..profile)
else
fd:close()
mtkwifi.debug("debug", "load "..profile)
mtkwifi.debug("loading profile"..profile)
local cfgs = mtkwifi.load_profile(profile)
if not cfgs then
mtkwifi.debug("error loading profile"..profile)
mtkwifi.debug("err", "error loading "..profile)
return
end
devs[i] = {}
devs[i].vifs = {}
devs[i].apcli = {}
devs[i].devname = devname
devs[i].profile = profile
local tmp = ""
tmp = string.split(devname, ".")
devs[i].maindev = tmp[1]
devs[i].mainidx = tonumber(tmp[2]) or 1
devs[i].subdev = devname
devs[i].subidx = string.match(tmp[3] or "", "(%d+)")=="2" and 2 or 1
devs[i].devband = tonumber(tmp[3])
if devs[i].devband then
devs[i].multiprofile = true
devs[i].dbdc = true
end
devs[i].version = mtkwifi.read_pipe("cat /etc/wireless/"..devs[i].maindev.."/version 2>/dev/null") or "unknown"
devs[i].ApCliEnable = cfgs.ApCliEnable
devs[i].WirelessMode = cfgs.WirelessMode
devs[i].WirelessModeList = {}
for key, value in pairs(DevicePropertyMap) do
local found = string.find(string.upper(devname), string.upper(value.device))
if found then
for k=1,#value.band do
devs[i].WirelessModeList[tonumber(value.band[k])] = WirelessModeList[tonumber(value.band[k])]
end
end
end
devs[i].WscConfMode = cfgs.WscConfMode
devs[i].AuthModeList = AuthModeList
devs[i].WpsEnableAuthModeList = WpsEnableAuthModeList
if wpa_support == 1 then
table.insert(devs[i].AuthModeList,"WPAPSK")
table.insert(devs[i].AuthModeList,"WPA")
end
if wapi_support == 1 then
table.insert(devs[i].AuthModeList,"WAIPSK")
table.insert(devs[i].AuthModeList,"WAICERT")
end
devs[i].ApCliAuthModeList = ApCliAuthModeList
devs[i].WPA_Enc_List = WPA_Enc_List
devs[i].WEP_Enc_List = WEP_Enc_List
devs[i].Channel = tonumber(cfgs.Channel)
devs[i].DBDC_MODE = tonumber(cfgs.DBDC_MODE)
devs[i].band = devs[i].devband or mtkwifi.band(cfgs.WirelessMode)
if cfgs.MUTxRxEnable then
if tonumber(cfgs.ETxBfEnCond)==1
and tonumber(cfgs.MUTxRxEnable)==0
and tonumber(cfgs.ITxBfEn)==0
then devs[i].__mimo = 0
elseif tonumber(cfgs.ETxBfEnCond)==0
and tonumber(cfgs.MUTxRxEnable)==0
and tonumber(cfgs.ITxBfEn)==1
then devs[i].__mimo = 1
elseif tonumber(cfgs.ETxBfEnCond)==1
and tonumber(cfgs.MUTxRxEnable)==0
and tonumber(cfgs.ITxBfEn)==1
then devs[i].__mimo = 2
elseif tonumber(cfgs.ETxBfEnCond)==1
and tonumber(cfgs.MUTxRxEnable)>0
and tonumber(cfgs.ITxBfEn)==0
then devs[i].__mimo = 3
elseif tonumber(cfgs.ETxBfEnCond)==1
and tonumber(cfgs.MUTxRxEnable)>0
and tonumber(cfgs.ITxBfEn)==1
then devs[i].__mimo = 4
else devs[i].__mimo = 5
end
end
if cfgs.HT_BW == "0" or not cfgs.HT_BW then
devs[i].__bw = "20"
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "0" or not cfgs.VHT_BW then
if cfgs.HT_BSSCoexistence == "0" or not cfgs.HT_BSSCoexistence then
devs[i].__bw = "40"
else
devs[i].__bw = "60" -- 20/40 coexist
end
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "1" then
devs[i].__bw = "80"
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "2" then
devs[i].__bw = "160"
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "3" then
devs[i].__bw = "161"
end
devs[i].vifs = mtkwifi.__setup_vifs(cfgs, devname, devs[i].mainidx, devs[i].subidx)
devs[i].apcli = mtkwifi.__setup_apcli(cfgs, devname, devs[i].mainidx, devs[i].subidx)
-- Setup reverse indices by devname
devs[devname] = devs[i]
if devs[i].apcli then
devs[i][devs[i].apcli.devname] = devs[i].apcli
end
i = i + 1
end
end
return devs
end
function mtkwifi.exists(path)
local fp = io.open(path, "rb")
if fp then fp:close() end
return fp ~= nil
end
function mtkwifi.parse_mac(str)
local macs = {}
local pat = "^[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]$"
local function ismac(str)
if str:match(pat) then return str end
end
if not str then return macs end
local t = str:split("\n")
for _,v in pairs(t) do
local mac = ismac(mtkwifi.__trim(v))
if mac then
table.insert(macs, mac)
end
end
return macs
-- body
end
function mtkwifi.scan_ap(vifname)
os.execute("iwpriv "..vifname.." set SiteSurvey=0")
os.execute("sleep 10") -- depends on your env
local scan_result = mtkwifi.read_pipe("iwpriv "..vifname.." get_site_survey 2>/dev/null")
local aplist = {}
local xx = {}
for i, line in ipairs(mtkwifi.__lines(scan_result)) do
if #line>40 and string.match(line, " BSSID ") then
xx.Ch = {string.find(line, "Ch "),3}
xx.SSID = {string.find(line, "SSID "),32}
xx.BSSID = {string.find(line, "BSSID "),17}
xx.Security = {string.find(line, "Security "),22}
xx.Signal = {string.find(line, "Sig%a%al"),4}
xx.Mode = {string.find(line, "W-Mode"),5}
xx.ExtCh = {string.find(line, "ExtCH"),6}
xx.WPS = {string.find(line, "WPS"),3}
xx.NT = {string.find(line, "NT"),2}
end
local tmp = {}
if #line>40 and not string.match(line, " BSSID ") then
tmp = {}
tmp.channel = mtkwifi.__trim(string.sub(line, xx.Ch[1], xx.Ch[1]+xx.Ch[2]))
tmp.ssid = mtkwifi.__trim(string.sub(line, xx.SSID[1], xx.SSID[1]+xx.SSID[2]))
tmp.bssid = string.upper(mtkwifi.__trim(string.sub(line, xx.BSSID[1], xx.BSSID[1]+xx.BSSID[2])))
tmp.security = mtkwifi.__trim(string.sub(line, xx.Security[1], xx.Security[1]+xx.Security[2]))
tmp.authmode = mtkwifi.__trim(string.split(tmp.security, "/")[1])
tmp.encrypttype = mtkwifi.__trim(string.split(tmp.security, "/")[2] or "NONE")
tmp.rssi = mtkwifi.__trim(string.sub(line, xx.Signal[1], xx.Signal[1]+xx.Signal[2]))
tmp.extch = mtkwifi.__trim(string.sub(line, xx.ExtCh[1], xx.ExtCh[1]+xx.ExtCh[2]))
tmp.mode = mtkwifi.__trim(string.sub(line, xx.Mode[1], xx.Mode[1]+xx.Mode[2]))
tmp.wps = mtkwifi.__trim(string.sub(line, xx.WPS[1], xx.WPS[1]+xx.WPS[2]))
tmp.nt = mtkwifi.__trim(string.sub(line, xx.NT[1], xx.NT[1]+xx.NT[2]))
table.insert(aplist, tmp)
end
end
return aplist
end
function mtkwifi.__any_wsc_enabled(wsc_conf_mode)
if (wsc_conf_mode == "") then
return 0;
end
if (wsc_conf_mode == "7") then
return 1;
end
if (wsc_conf_mode == "4") then
return 1;
end
if (wsc_conf_mode == "2") then
return 1;
end
if (wsc_conf_mode == "1") then
return 1;
end
return 0;
end
function mtkwifi.__restart_if_wps(devname, ifname, cfgs)
local devs = mtkwifi.get_all_devs()
local ssid_index = devs[devname]["vifs"][ifname].vifidx
local wsc_conf_mode = ""
wsc_conf_mode=mtkwifi.token_get(cfgs["WscConfMode"], ssid_index, "")
os.execute("iwpriv "..ifname.." set WscConfMode=0")
mtkwifi.debug("iwpriv "..ifname.." set WscConfMode=0")
os.execute("route delete 239.255.255.250")
mtkwifi.debug("route delete 239.255.255.250")
if(mtkwifi.__any_wsc_enabled(wsc_conf_mode)) then
os.execute("iwpriv "..ifname.." set WscConfMode=7")
mtkwifi.debug("iwpriv "..ifname.." set WscConfMode=7")
os.execute("route add -host 239.255.255.250 dev br0")
mtkwifi.debug("route add -host 239.255.255.250 dev br0")
end
-- execute wps_action.lua file to send signal for current interface
os.execute("lua wps_action.lua "..ifname)
mtkwifi.debug("lua wps_action.lua "..ifname)
return cfgs
end
function mtkwifi.restart_8021x(devname, devices)
local l1dat, l1 = mtkwifi.__get_l1dat()
local dridx = l1dat and l1.DEV_RINDEX
local devs = devices or mtkwifi.get_all_devs()
local dev = devs[devname]
local main_ifname = l1dat and l1dat[dridx][devname].main_ifname or dbdc_prefix[mainidx][subidx].."0"
local prefix = l1dat and l1dat[dridx][devname].ext_ifname or dbdc_prefix[mainidx][subidx]
local ps_cmd = "ps | grep -v grep | grep rt2860apd | grep "..main_ifname.." | awk '{print $1}'"
local pid_cmd = "cat /var/run/rt2860apd_"..devs[devname].vifs[1].vifname..".pid"
local apd_pid = mtkwifi.read_pipe(pid_cmd) or mtkwifi.read_pipe(ps_cmd)
if tonumber(apd_pid) then
os.execute("kill "..apd_pid)
end
local cfgs = mtkwifi.load_profile(devs[devname].profile)
local auth_mode = cfgs['AuthMode']
local ieee8021x = cfgs['IEEE8021X']
local pat_auth_mode = {"WPA$", "WPA;", "WPA2$", "WPA2;", "WPA1WPA2$", "WPA1WPA2;"}
local pat_ieee8021x = {"1$", "1;"}
local apd_en = false
for _, pat in ipairs(pat_auth_mode) do
if string.find(auth_mode, pat) then
apd_en = true
end
end
for _, pat in ipairs(pat_ieee8021x) do
if string.find(ieee8021x, pat) then
apd_en = true
end
end
if not apd_en then
return
end
os.execute("rt2860apd -i "..main_ifname.." -p "..prefix)
end
return mtkwifi

View File

@ -1,19 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_LICENSE:=GPLv2
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
LUCI_TITLE:=A simple web console.
LUCI_DEPENDS:=
# earlier version of luci put "luci.mk" somewhere else...
LUCI_MK_OLDPATH:=$(shell test -e ../luci.mk && echo "old")
LUCI_MK_NEWPATH:=$(shell test -e ../../luci.mk && echo "new")
ifeq ($(LUCI_MK_OLDPATH),old)
include ../luci.mk
endif
ifeq ($(LUCI_MK_NEWPATH),new)
include ../../luci.mk
endif
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,23 +0,0 @@
-- A simple web console in case you don't have access to the shell
--
-- Hua Shao <nossiac@163.com>
module("luci.controller.webconsole", package.seeall)
local http = require("luci.http")
function index()
entry({"admin", "mtk", "console"}, template("mtk_web_console"), _("Web Console"), 4)
entry({"admin", "mtk", "webcmd"}, call("webcmd"))
end
function webcmd()
local cmd = http.formvalue("cmd")
if cmd then
local fp = io.popen(tostring(cmd).." 2>&1")
local result = fp:read("*a")
fp:close()
result = result:gsub("<", "&lt;")
http.write(tostring(result))
else
http.write_json(http.formvalue())
end
end

View File

@ -1,51 +0,0 @@
<%+header%>
<!--
This module gives some convinience to access the shell via web, in
case that you don't have a uart console or telnet/ssh connection.
Hua Shao <nossiac@163.com>
-->
<h2><a name="content">Web Console</a></h2>
<form id="console">
<fieldset class="cbi-section">
<legend>Execute shell commands or scripts as root. <span style="color:red">Be Careful</span>.</legend>
<p>Press <b>Enter</b> to execute. Press <b>Shift+Enter</b> to start a new line.</p>
<p><textarea name="cmd" id="cmd" style="width:98%;height:4em;"></textarea></p>
<p>
<button class="cbi-button" onclick="return postcmd('ifconfig -a')">ifconfig -a</button>
<button class="cbi-button" onclick="return postcmd('cat /proc/meminfo')">meminfo</button>
<button class="cbi-button" onclick="return postcmd('uci show')">uci</button>
<button class="cbi-button" onclick="return postcmd('ps w')">ps</button>
<button class="cbi-button" onclick="return postcmd('cat /proc/mtd')">mtd</button>
<button class="cbi-button" onclick="return postcmd('block info')">block info</button>
<button class="cbi-button" onclick="return postcmd('mount')">mount</button>
<pre id="result" style="background-color:black;color:white;height:auto;min-height:200px;width:98%;"></pre>
</fieldset>
</form>
<script type="text/javascript">
function postcmd(cmd) {
(new XHR()).post("<%=luci.dispatcher.build_url("admin", "mtk", "webcmd")%>", {"cmd":cmd}, function(x) {
console.log(x.response)
console.log(x)
document.getElementById("result").innerHTML = x.response;
});
return false;
}
document.getElementById("cmd").addEventListener("keydown", function(e) {
if (!e) { var e = window.event; }
if (e.keyCode == 13 && !e.shiftKey) {
e.preventDefault();
var cmd = document.getElementById("cmd");
postcmd(cmd.value);
cmd.value = "";
return true;
}
}, false);
</script>
<%+footer%>

View File

@ -1,94 +0,0 @@
#
# hua.shao@mediatek.com
#
include $(TOPDIR)/rules.mk
PKG_NAME:=mtk-nvram
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_KCONFIG:=NVRAM_MTD_NAME
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
include $(INCLUDE_DIR)/package.mk
define Package/nvram
SECTION:=MTK Properties
CATEGORY:=MTK Properties
SUBMENU:=Applications
TITLE:=MTK APSoC nvram tool
DEPENDS:=+libnvram
MENU:=1
endef
define Package/nvram/config
source "$(SOURCE)/config.in"
endef
define Package/flash
SECTION:=MTK Properties
CATEGORY:=MTK Properties
SUBMENU:=Applications
TITLE:=MTK APSoC flash R/W tool
DEPENDS:=+libnvram
endef
define Package/libnvram
SECTION:=MTK Properties
CATEGORY:=MTK Properties
SUBMENU:=Libraries
TITLE:=MTK APSoC nvram library
DEPENDS:=
endef
define Package/nvram/description
MTK nvram tool
endef
define Package/flash/description
flash r/w tool
endef
define Package/libnvram/description
MTK nvram library
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
$(call Build/Prepare/Default)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) ./src/nvram.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/lib*.so $(1)/usr/lib/
endef
MAKE_FLAGS += \
CONFIG_NVRAM_MTD_NAME=$(CONFIG_NVRAM_MTD_NAME)
define Package/nvram/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/bin
endef
define Package/flash/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/flash $(1)/usr/bin
endef
define Package/libnvram/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib
endef
$(eval $(call BuildPackage,libnvram))
$(eval $(call BuildPackage,nvram))
$(eval $(call BuildPackage,flash))

View File

@ -1,6 +0,0 @@
menu "nvram Features"
depends on PACKAGE_nvram
config NVRAM_MTD_NAME
string "mtd name for nvram"
default "Config"
endmenu

View File

@ -1,35 +0,0 @@
exe1 := nvram
exe2 := flash
lib:= libnvram.so
libobjs := crc32.o flash.o nvram.o
exe1objs := main_nvram.o
exe2objs := main_flash.o
CFLAGS += -Wall
ifdef CONFIG_NVRAM_MTD_NAME
CFLAGS += -DNVRAM_MTD_NAME=\"$(CONFIG_NVRAM_MTD_NAME)\"
endif
all: $(lib) $(exe1) $(exe2)
$(lib) : $(libobjs)
$(CC) $(CFLAGS) -shared -o $@ $^
$(exe1) : $(exe1objs) $(lib)
$(CC) $(CFLAGS) -o $@ $^
$(exe2) : $(exe2objs) flash.o
$(CC) $(CFLAGS) -o $@ $^
$(exe1objs): %.o : %.c
$(CC) $(CFLAGS) -fPIC -c $< -o $@
$(exe2objs): %.o : %.c
$(CC) $(CFLAGS) -fPIC -c $< -o $@
$(libobjs): %.o : %.c
$(CC) $(CFLAGS) -fPIC -c $< -o $@
clean:
-rm *.o $(exe1) $(exe2) $(lib)

View File

@ -1,88 +0,0 @@
/******************************************************************
* $File: crc32.c
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#include <stdint.h>
static const uint32_t crc_table[256] =
{
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2(buf) DO1(buf); DO1(buf);
#define DO4(buf) DO2(buf); DO2(buf);
#define DO8(buf) DO4(buf); DO4(buf);
uint32_t crc32(uint32_t crc, const uint8_t *buf, uint32_t len)
{
crc = crc ^ 0xffffffffL;
while (len >= 8)
{
DO8(buf);
len -= 8;
}
if (len) do
{
DO1(buf);
}
while (--len);
return crc ^ 0xffffffffL;
}

View File

@ -1,16 +0,0 @@
/******************************************************************
* $File: crc32.h
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#ifndef CRC32_H
#define CRC32_H
#include <stdint.h>
uint32_t crc32(uint32_t crc, const uint8_t *buf, uint32_t len);
#endif /* CRC32_H */

View File

@ -1,252 +0,0 @@
/******************************************************************
* $File: flash.c
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include "nvram.h"
#include "flash.h"
struct mtd_info_user
{
uint8_t type;
uint32_t flags;
uint32_t size;
uint32_t erasesize;
uint32_t oobblock;
uint32_t oobsize;
uint32_t ecctype;
uint32_t eccsize;
};
struct erase_info_user
{
uint32_t start;
uint32_t length;
};
#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
#define MEMERASE _IOW('M', 2, struct erase_info_user)
#define min(x,y) ({ typeof(x) _x = (x); typeof(y) _y = (y); (void) (&_x == &_y); _x < _y ? _x : _y; })
int32_t mtd_open(const char *name, int32_t flags)
{
FILE *fp;
char dev[80];
int i, ret;
if (strstr(name, "/dev/mtd"))
{
return open(name, flags);
}
if ((fp = fopen("/proc/mtd", "r")))
{
while (fgets(dev, sizeof(dev), fp))
{
if (sscanf(dev, "mtd%d:", &i) && strstr(dev, name))
{
snprintf(dev, sizeof(dev), "/dev/mtd%d", i);
if ((ret = open(dev, flags)) < 0)
{
snprintf(dev, sizeof(dev), "/dev/mtd/%d", i);
ret = open(dev, flags);
}
fclose(fp);
return ret;
}
}
fclose(fp);
}
fprintf(stderr, "Could not open mtd device, %s\n", strerror(errno));
return -1;
}
uint32_t mtd_size(const char *name)
{
FILE *fp;
char buf[80];
if ((fp = fopen("/proc/mtd", "r")))
{
while (fgets(buf, sizeof(buf), fp))
{
if (strstr(buf, name))
{
char * p = strchr(buf, ' ');
ASSERT(p);
p++;
fclose(fp);
return strtoul(p,0,16);
}
}
}
fclose(fp);
return 0;
}
int32_t flash_read(char *path, char *buf, off_t from, size_t len)
{
int32_t fd, ret;
struct mtd_info_user info;
fd = mtd_open(path, O_RDONLY);
if (fd < 0)
{
fprintf(stderr, "Could not open mtd device\n");
return -1;
}
if (ioctl(fd, MEMGETINFO, &info))
{
fprintf(stderr, "Could not get mtd device info\n");
close(fd);
return -1;
}
if (len > info.size)
{
fprintf(stderr, "Too many bytes - %zu > %u bytes\n", len, info.erasesize);
close(fd);
return -1;
}
lseek(fd, from, SEEK_SET);
ret = read(fd, buf, len);
if (ret == -1)
{
fprintf(stderr, "Reading from mtd failed\n");
close(fd);
return -1;
}
close(fd);
return ret;
}
int32_t flash_write(char *path, char *buf, off_t to, size_t len)
{
int32_t fd, ret = 0;
struct mtd_info_user info;
struct erase_info_user ei;
fd = mtd_open(path, O_RDWR | O_SYNC);
if (fd < 0)
{
fprintf(stderr, "Could not open mtd device\n");
return -1;
}
if (ioctl(fd, MEMGETINFO, &info))
{
fprintf(stderr, "Could not get mtd device info\n");
close(fd);
return -1;
}
if (len > info.size)
{
fprintf(stderr, "Too many bytes - %zu > %u bytes\n", len, info.erasesize);
close(fd);
return -1;
}
while (len > 0)
{
if ((len & (info.erasesize-1)) || (len < info.erasesize))
{
int piece_size;
unsigned int piece, bakaddr;
char *bak = NULL;
bak = (char *)malloc(info.erasesize);
if (bak == NULL)
{
fprintf(stderr, "Not enough memory\n");
close(fd);
return -1;
}
bakaddr = to & ~(info.erasesize - 1);
lseek(fd, bakaddr, SEEK_SET);
ret = read(fd, bak, info.erasesize);
if (ret == -1)
{
fprintf(stderr, "Reading from mtd failed\n");
close(fd);
free(bak);
return -1;
}
piece = to & (info.erasesize - 1);
piece_size = min((uint32_t)len, info.erasesize - piece);
memcpy(bak + piece, buf, piece_size);
ei.start = bakaddr;
ei.length = info.erasesize;
if (ioctl(fd, MEMERASE, &ei) < 0)
{
fprintf(stderr, "Erasing mtd failed\n");
close(fd);
free(bak);
return -1;
}
lseek(fd, bakaddr, SEEK_SET);
ret = write(fd, bak, info.erasesize);
if (ret == -1)
{
fprintf(stderr, "Writing to mtd failed\n");
close(fd);
free(bak);
return -1;
}
free(bak);
buf += piece_size;
to += piece_size;
len -= piece_size;
}
else
{
ei.start = to;
ei.length = info.erasesize;
if (ioctl(fd, MEMERASE, &ei) < 0)
{
fprintf(stderr, "Erasing mtd failed\n");
close(fd);
return -1;
}
ret = write(fd, buf, info.erasesize);
if (ret == -1)
{
fprintf(stderr, "Writing to mtd failed\n");
close(fd);
return -1;
}
buf += info.erasesize;
to += info.erasesize;
len -= info.erasesize;
}
}
close(fd);
return ret;
}

View File

@ -1,19 +0,0 @@
/******************************************************************
* $File: flash.h
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#ifndef FLASH_H
#define FLASH_H
#include <stdint.h>
uint32_t mtd_size(const char *name);
int32_t flash_read(char *path, char *buf, off_t from, size_t len);
int32_t flash_write(char *path, char *buf, off_t to, size_t len);
#endif /* FLASH_H */

View File

@ -1,52 +0,0 @@
/******************************************************************
* $File: layout.h
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#ifndef LAYOUT_H
#define LAYOUT_H
/* uncomment NVRAM_CUSTOM_LAYOUT to enable your layout. */
// #define NVRAM_CUSTOM_LAYOUT
#ifdef NVRAM_CUSTOM_LAYOUT
static layout_t nvlayout[] =
{
/* the first 4KB of "Config" is reserved for uboot. */
{
.name = "uboot",
.offset = 0x0,
.size = 0x1000,
.flag = NV_RO,
},
/* you can use the rest space, up to 60KB. */
{
.name = "2860",
.offset = 0x2000,
.size = 0x4000,
},
{
.name = "rtdev",
.offset = 0x6000,
.size = 0x2000,
},
{
.name = "cert",
.offset = 0x8000,
.size = 0x2000,
},
{
.name = "wapi",
.offset = 0xa000,
.size = 0x5000,
},
};
#endif /* NVRAM_CUSTOM_LAYOUT */
#endif /* LAYOUT_H */

View File

@ -1,94 +0,0 @@
/******************************************************************
* $File: main.c
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include "flash.h"
int usage(void)
{
printf("%s", "flash r <device> <offset> <length>\n");
printf("%s", "flash w <device> <offset> <0xNN> [<0xNN> ...]\n");
return 0;
}
int main(int argc, char ** argv)
{
int off = 0;
int len = 0;
int ret = 0;
int i = 0;
char * buf = NULL;
if (argc < 5)
return usage();
if (0 == strcmp(argv[1], "r"))
{
off = atoi(argv[3]);
len = atoi(argv[4]);
buf = (char *)malloc(len);
if (!buf)
{
fprintf(stderr, "failed to alloc buf[%d], %s\n", len, strerror(errno));
return -1;
}
memset(buf, 0, len);
ret = flash_read(argv[2], buf, off, len);
if (ret < 0)
{
fprintf(stderr, "failed to read buf[%d], %s\n", len, strerror(errno));
if (buf) free(buf);
return -1;
}
for(i=0; i<len; i++)
{
printf("%02X", buf[i]);
}
printf("\n");
if (buf) free(buf);
}
else
{
off = atoi(argv[3]);
buf = (char *)malloc(argc-4);
if (!buf)
{
fprintf(stderr, "failed to alloc buf[%d], %s\n", argc-4, strerror(errno));
return -1;
}
memset(buf, 0, argc-4);
for (i=4; i<argc; i++)
{
//fprintf(stderr, "%ld\n", strtol(argv[i], NULL, 16));
buf[i-4] = (char)strtol(argv[i], NULL, 16);
}
ret = flash_write(argv[2], buf, off, argc-4);
if (buf) free(buf);
if (ret < 0)
{
fprintf(stderr, "failed to write buf[%d], %s\n", argc-4, strerror(errno));
return -1;
}
}
return 0;
}

View File

@ -1,109 +0,0 @@
/******************************************************************
* $File: main.c
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#include <stdio.h>
#include "nvram.h"
int32_t usage(int32_t reason)
{
if (reason != OK)
printf("Invalid usage! ");
fprintf(stderr, "Usage:\n"
"\tnvram get <section> <name>\n"
"\t\t Get a value from the section by name. It operates in cache.\n"
"\tnvram set <section> <name> <value>\n"
"\t\t Set a value into the section by name. It operates in cache.\n"
"\tnvram del <section> <name>\n"
"\t\t Delete an entry in the section by name. It operates in cache.\n"
"\tnvram commit\n"
"\t\t Flush cache into flash.\n"
"\tnvram layout\n"
"\t\t Display nvram sections layout.\n"
"\tnvram show [section]\n"
"\t\t Display all entries in nvram. Section name is optional.\n"
"\tnvram loadfile <section> <filename>\n"
"\t\t Load nvram entries from a file, and flush it into the section.\n"
"\tnvram clear <section>\n"
"\t\t DANGEROUS! Clear all nvram entries inside flash.\n"
);
return OK;
}
int32_t main(int32_t argc, char ** argv)
{
#if 0
int32_t i = 0;
for(i=0; i<argc; i++)
DEBUG("argv[%d]:%s\n", i, argv[i]);
#endif
if (argc < 2)
return usage(OK);
if (nvram_filecache(NVRAM_CACHE_FILE) != OK)
return NG;
if (nvram_parse(NULL, NVRAM_CACHE_FILE) != OK)
return NG;
if (0 == strcasecmp(argv[1], "commit"))
{
return nvram_commit(1);
}
else if (0 == strcasecmp(argv[1], "set"))
{
if (argc == 5)
return nvram_set(argv[2], argv[3], argv[4]);
else
return usage(NG);
}
else if (0 == strcasecmp(argv[1], "get"))
{
if (argc < 4)
return usage(NG);
else
nvram_get(argv[2], argv[3]);
}
else if (0 == strcasecmp(argv[1], "del"))
{
if (argc < 4)
return usage(NG);
else
nvram_del(argv[2], argv[3]);
}
else if (0 == strcasecmp(argv[1], "show"))
{
if (argc < 3)
return nvram_show(NULL);
else
return nvram_show(argv[2]);
}
else if (0 == strcasecmp(argv[1], "clear"))
{
return nvram_clear(argv[2]);
}
else if (0 == strcasecmp(argv[1], "layout"))
{
return nvram_layout();
}
else if (0 == strcasecmp(argv[1], "loadfile"))
{
if (argc < 4)
return usage(NG);
else
return nvram_loadfile(argv[2], argv[3]);
}
else
return usage(NG);
return OK;
}

View File

@ -1,585 +0,0 @@
/******************************************************************
* $File: nvram.c
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "nvram.h"
#include "crc32.h"
#include "flash.h"
#define MAX_ENTRY 500
typedef struct
{
char * name;
char * value;
} entry_t;
typedef struct
{
char * name;
uint32_t offset;
uint32_t size;
uint32_t flag;
uint32_t crc;
entry_t cache[MAX_ENTRY];
} section_t;
#define NV_RO (1) /* read only */
typedef struct
{
char * name;
uint32_t offset;
uint32_t size;
uint32_t flag;
} layout_t;
#include "layout.h"
#ifndef NVRAM_CUSTOM_LAYOUT
/* this is a demo layout,
please make your own layout in layout.h
*/
static layout_t nvlayout[] =
{
/* the first 4KB of "Config" is reserved for uboot. */
{
.name = "uboot",
.offset = 0x0,
.size = 0x1000,
.flag = NV_RO,
},
{
.name = "readonly",
.offset = 0x1000,
.size = 0x1000,
.flag = NV_RO,
},
{
.name = "test1",
.offset = 0x2000,
.size = 0x4000,
.flag = 0,
},
{
.name = "test2",
.offset = 0x6000,
.size = 0x2000,
.flag = 0,
},
{
.name = "test3",
.offset = 0x8000,
.size = 0x8000,
},
};
#endif
static uint32_t nvram_mtd_size = 0;
static section_t * nvramcache = NULL;
static uint32_t sectionnum = sizeof(nvlayout)/sizeof(layout_t);
static section_t * _nvram_section(char * name)
{
int32_t i = 0;
for (i=0; i<sectionnum; i++)
{
if (0 == strcmp(nvramcache[i].name, name))
return &nvramcache[i];
}
fprintf(stderr, "no section named \"%s\"\n", name);
return NULL;
}
static int32_t _nvram_buf_del(char * section, char * key)
{
int32_t i = 0;
section_t * sect = NULL;
DEBUG("%s(%s, %s)\n", __FUNCTION__, section, key);
sect = _nvram_section(section);
if (!sect)
return NG;
if (sect->flag & NV_RO)
{
fprintf(stderr, "section \"%s\"is read-only!\n", section);
return NG;
}
/* check if name exists */
for (i=0; i<MAX_ENTRY; i++)
{
if (sect->cache[i].name &&
0 == strcmp(key, sect->cache[i].name))
break;
}
if (i >= MAX_ENTRY)
{
fprintf(stderr, "no such entry!\n");
return NG;
}
sfree(sect->cache[i].name);
sfree(sect->cache[i].value);
return OK;
}
static int32_t _nvram_buf_set(char * section, char * key, char * value)
{
int32_t i = 0;
section_t * sect = NULL;
DEBUG("%s(%s,%s,%s)\n", __FUNCTION__, section, key, value);
sect = _nvram_section(section);
if (!sect)
return NG;
if (sect->flag & NV_RO)
{
fprintf(stderr, "section \"%s\"is read-only!\n", section);
return NG;
}
/* check if name exists */
for (i=0; i<MAX_ENTRY; i++)
{
if (sect->cache[i].name &&
0 == strcmp(key, sect->cache[i].name))
break;
}
if (i < MAX_ENTRY)
goto __set;
/* else, find an empty room */
for (i=0; i<MAX_ENTRY; i++)
{
if (!sect->cache[i].name)
break;
}
if (i >= MAX_ENTRY)
{
fprintf(stderr, "no empty room found! %s\n", __FUNCTION__);
return NG;
}
ASSERT(!sect->cache[i].name);
ASSERT(!sect->cache[i].value);
__set:
sect->cache[i].name = strdup(key);
sect->cache[i].value = strdup(value);
return OK;
}
static char * _nvram_buf_get(char * section, char * key)
{
int32_t i = 0;
section_t * sect = NULL;
DEBUG("%s(%s,%s)\n", __FUNCTION__, section, key);
sect = _nvram_section(section);
if (!sect)
return NULL;
for (i=0; i<MAX_ENTRY; i++)
{
if (sect->cache[i].name &&
0 == strcmp(sect->cache[i].name, key))
{
printf("%s\n", sect->cache[i].value);
return sect->cache[i].value;
}
}
fprintf(stderr, "no such entry!\n");
return NULL;
}
int32_t nvram_parse(char * section, char * cachefile)
{
int32_t rc = 0;
FILE * fp = NULL;
size_t len = 0;
char * data, * p = NULL, * q = NULL;
int32_t i = 0, j = 0;
API();
fp = fopen(cachefile, "r+b");
if (!fp)
{
fprintf(stderr, "failed to load %s, %s, %s\n", cachefile, strerror(errno), __FUNCTION__);
return NG;
}
fseek(fp, 0, SEEK_END);
len = ftell(fp);
fseek(fp, 0, SEEK_SET);
data = (char *)malloc(len);
if(!data)
{
fprintf(stderr, "failed to alloc buffer (%zu) for nvram! %s.\n", len, __FUNCTION__);
fclose(fp);
return NG;
}
memset(data, 0, len);
rc = fread(data, 1, len, fp);
DEBUG("rc %d, len %zu\n", rc, len);
ASSERT(rc == len);
nvramcache = (section_t *)malloc(sizeof(section_t)*sectionnum);
memset(nvramcache, 0, sizeof(sizeof(section_t)*sectionnum));
for (i = 0; i<sectionnum; i++)
{
uint32_t secrc = 0;
nvramcache[i].name = nvlayout[i].name;
nvramcache[i].flag = nvlayout[i].flag;
nvramcache[i].size = nvlayout[i].size;
nvramcache[i].offset = nvlayout[i].offset;
j = 0;
p = data+nvramcache[i].offset;
secrc = *(uint32_t *)p;
nvramcache[i].crc =
crc32(0, (uint8_t *)(data + nvramcache[i].offset+4), nvramcache[i].size-4);
//DEBUG("section crc: %x, cal crc: %x\n", secrc, nvramcache[i].crc);
if (secrc == 0 || secrc != nvramcache[i].crc)
{
fprintf(stderr, "warning! crc error in section %s: expect 0x%x, got 0x%x!\n",
nvramcache[i].name, nvramcache[i].crc, secrc);
//continue;
}
p = p + 4;
/* parsing the content, k=v\0k1=v1\0......kx=vx */
while (p < data+nvramcache[i].offset+nvramcache[i].size && j < MAX_ENTRY)
{
if (*p < 32 || *p > 128) break;
q = strchr(p, '=');
if (!q)
{
fprintf(stderr, "nvram format error, offset %d, in %s!\n",
(int32_t)(p-data), nvlayout[i].name);
break;
}
*q = 0;
q++;
DEBUG("\t<%s>=<%s>\n", p, q);
nvramcache[i].cache[j].name = strdup(p);
nvramcache[i].cache[j].value = strdup(q);
p = q + strlen(q) + 1;
j++;
}
}
if (data) free(data);
fclose(fp);
return OK;
}
int32_t nvram_commit(char flash)
{
int32_t rc = OK;
int32_t sect = 0, i = 0;
FILE * fp = NULL;
char * buffer = NULL, * p = NULL, * q = NULL;
API();
fp = fopen(NVRAM_CACHE_FILE, "r+");
if(!fp)
{
fprintf(stderr, "failed to open %s, %s.\n", NVRAM_CACHE_FILE, __FUNCTION__);
rc = NG;
goto __quit;
}
buffer = (char *)malloc(nvram_mtd_size);
if(!buffer)
{
fprintf(stderr, "failed to alloc buffer (%d) for nvram! %s.\n", nvram_mtd_size, __FUNCTION__);
rc = NG;
goto __quit;
}
for (sect=0; sect<sectionnum; sect++)
{
p = buffer + nvramcache[sect].offset + 4; /* reserve 4 bytes for crc32 */
q = p + nvramcache[sect].size;
for (i=0; i<MAX_ENTRY; i++)
{
if (nvramcache[sect].cache[i].name)
{
int32_t l;
ASSERT(nvramcache[sect].cache[i].value);
l = strlen(nvramcache[sect].cache[i].name)
+ strlen(nvramcache[sect].cache[i].value) + 2;
if (p+l>=q)
{
fprintf(stderr, "exceed nvram section size %u!\n", nvramcache[sect].size);
rc = NG;
goto __quit;
}
sprintf(p, "%s=%s",
nvramcache[sect].cache[i].name,
nvramcache[sect].cache[i].value);
p += l;
}
}
*p = '\0'; // just make sure
nvramcache[sect].crc =
crc32(0, (uint8_t *)(buffer + nvramcache[sect].offset+4), nvramcache[sect].size-4);
*(uint32_t *)(buffer + nvramcache[sect].offset) = nvramcache[sect].crc;
DEBUG("cal crc32 = 0x%8x!\n", nvramcache[sect].crc);
fseek(fp, nvramcache[sect].offset, SEEK_SET);
DEBUG("write nvram raw data, offset %u, size %u!\n",
nvramcache[sect].offset, nvramcache[sect].size);
i = fwrite(buffer + nvramcache[sect].offset, 1, nvramcache[sect].size, fp);
ASSERT(i == nvramcache[sect].size);
}
if (flash)
{
i = flash_write(NVRAM_MTD_NAME, buffer, 0, nvram_mtd_size);
ASSERT(i>0);
}
__quit:
sfree(buffer);
fclose(fp);
return rc;
}
char * nvram_get(char * section, char * key)
{
API();
return _nvram_buf_get(section, key);
}
int32_t nvram_del(char * section, char * key)
{
API();
if (OK == _nvram_buf_del(section, key))
return nvram_commit(0);
return NG;
}
int32_t nvram_set(char * section, char * key, char * value)
{
API();
if (OK == _nvram_buf_set(section, key, value))
return nvram_commit(0);
return NG;
}
int32_t nvram_show(char * section)
{
int32_t i = 0, j = 0;
API();
for (i=0; i<sectionnum; i++)
{
if (section && 0 != strcmp(section, nvramcache[i].name))
continue;
for (j=0; j<MAX_ENTRY; j++)
{
if (nvramcache[i].cache[j].name)
printf("%s=%s\n",nvramcache[i].cache[j].name, nvramcache[i].cache[j].value);
}
}
return OK;
}
int32_t nvram_layout(void)
{
int32_t i = 0;
char flagstr[20];
for (i=0; i<sizeof(nvlayout)/sizeof(nvlayout[0]); i++)
{
printf("--------------------------------\n");
printf("| name: %-20s |\n", nvlayout[i].name);
printf("| offset: %-20u |\n", nvlayout[i].offset);
printf("| size: %-20u |\n", nvlayout[i].size);
flagstr[0] = 0;
if (nvlayout[i].flag & NV_RO)
strcat(flagstr, "RO ");
if (nvlayout[i].flag == 0)
strcat(flagstr, "0");
printf("| flag: %-20s |\n", flagstr);
}
printf("--------------------------------\n");
return OK;
}
int32_t nvram_clear(char * section)
{
int32_t i = 0;
FILE * fp = NULL;
section_t * sec = NULL;
char * buffer = NULL;
API();
fp = fopen(NVRAM_CACHE_FILE, "r+b");
if (!fp)
{
fprintf(stderr, "failed to create %s, %s, %s\n", NVRAM_CACHE_FILE, strerror(errno), __FUNCTION__);
return NG;
}
sec = _nvram_section(section);
if(!sec || (sec->flag & NV_RO))
{
fprintf(stderr, "invalid section!\n");
return NG;
}
fseek(fp, sec->offset, SEEK_SET);
buffer = (char *)malloc(sec->size);
if(!buffer)
{
fprintf(stderr, "failed to alloc buffer (%d) for nvram! %s.\n", sec->size, __FUNCTION__);
fclose(fp);
return NG;
}
memset(buffer, 0, sec->size);
sec->crc =
crc32(0, (uint8_t *)(buffer+4), sec->size-4);
*(uint32_t *)(buffer) = sec->crc;
i = fwrite(buffer, sec->size, 1, fp);
ASSERT(i == 1);
fclose(fp);
return OK;
}
int32_t nvram_loadfile(char * section, char * defile)
{
API();
if (OK == nvram_parse(section, defile))
return nvram_commit(1);
return NG;
}
int32_t nvram_filecache(char * defile)
{
int32_t rc = OK;
FILE * fp = NULL;
struct stat statbuf;
char * buffer = NULL;
int32_t i;
API();
nvram_mtd_size = mtd_size(NVRAM_MTD_NAME);
DEBUG("mtd_size(%s) = %u\n", NVRAM_MTD_NAME, nvram_mtd_size);
if (nvram_mtd_size <= 0)
return NG;
/* create a cache file */
rc = stat(defile, &statbuf);
if (!rc)
{
DEBUG("cache file %s is ready.\n", defile);
return OK;
}
fp = fopen(defile, "w+b");
if (!fp)
{
fprintf(stderr, "failed to create %s, %s, %s\n",
defile, strerror(errno), __FUNCTION__);
return NG;
}
DEBUG("cache file %s, created.\n", defile);
buffer = (char *)malloc(nvram_mtd_size);
if(!buffer)
{
fprintf(stderr, "failed to alloc %d bytes for , %s, %s\n",
nvram_mtd_size, defile, __FUNCTION__);
fclose(fp);
return NG;
}
rc = fwrite(buffer, 1, nvram_mtd_size, fp);
ASSERT(rc == nvram_mtd_size);
/* dump nvram partition into a cache file. */
for (i=0; i<sizeof(nvlayout)/sizeof(nvlayout[0]); i++)
{
memset(buffer, 0, nvram_mtd_size);
DEBUG("read %s data from flash.\n", nvlayout[i].name);
if (flash_read(NVRAM_MTD_NAME, buffer, nvlayout[i].offset, nvlayout[i].size) != nvlayout[i].size)
{
fprintf(stderr, "failed to read %s, %s, %s\n",
nvlayout[i].name, strerror(errno), __FUNCTION__);
continue;
}
DEBUG("write %s into cache file at offset 0x%x.\n", nvlayout[i].name, nvlayout[i].offset);
fseek(fp, nvlayout[i].offset, SEEK_SET);
rc = fwrite(buffer, 1, nvlayout[i].size, fp);
if (rc != nvlayout[i].size)
{
fprintf(stderr, "failed to write %s data into %s, %s, %s\n",
nvlayout[i].name, defile, strerror(errno), __FUNCTION__);
return NG;
}
}
fclose(fp);
return OK;
}

View File

@ -1,58 +0,0 @@
/******************************************************************
* $File: nvram.h
*
* $Author: Hua Shao
* $Date: Oct, 2014
*
******************************************************************/
#ifndef NVRAM_H
#define NVRAM_H
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#ifndef NVRAM_CACHE_FILE
#define NVRAM_CACHE_FILE "/tmp/.nvramcache"
#endif
#ifndef NVRAM_MTD_NAME
#define NVRAM_MTD_NAME "Config"
#endif
#define OK (0)
#define NG (-1)
#if 0
#define DEBUG(...) do{ fprintf(stderr, "<nvram> ");printf(__VA_ARGS__);} while(0)
#define API() fprintf(stderr, "<nvram> api: %s.\n", __FUNCTION__)
#else
#define DEBUG(...)
#define API()
#endif
#define ASSERT(cond) \
do { \
if(!(cond)) \
{ \
fprintf(stderr, "<nvram> assert [%s] fail, %s L%d\n", #cond, __FUNCTION__, __LINE__); \
exit(-1); \
} \
} while(0)
#define sfree(p) do {if(p) { free(p); p = NULL;} } while(0)
char * nvram_get(char * section, char * key);
int32_t nvram_set(char * section, char * key, char * value);
int32_t nvram_del(char * section, char * key);
int32_t nvram_show(char * section);
int32_t nvram_layout(void);
int32_t nvram_loadfile(char * section, char * defile);
int32_t nvram_filecache(char * defile);
int32_t nvram_clear(char * section);
int32_t nvram_parse(char * section, char * cachefile);
int32_t nvram_commit(char flash);
#endif /* NVRAM_H */

View File

@ -1,48 +0,0 @@
#
# hua.shao@mediatek.com
#
# MTK Property Software.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=uci2dat
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS:=
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
include $(INCLUDE_DIR)/package.mk
define Package/uci2dat
SECTION:=MTK Properties
CATEGORY:=MTK Properties
DEPENDS:=+libuci
TITLE:=Translate uci config into MTK/Ralink WiFi profile
SUBMENU:=Applications
endef
define Package/uci2dat/description
Translate uci config into ralink wifi dat format
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
TARGET_CFLAGS += -luci -Wall
TARGET_CFLAGS += -Wno-error=format-security
define Build/Configure
endef
define Package/uci2dat/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci2dat $(1)/usr/bin
endef
$(eval $(call BuildPackage,uci2dat))

View File

@ -1,7 +0,0 @@
uci2dat:
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ uci2dat.c
clean:
-rm -f *.o *.elf *.gbd

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +0,0 @@
#
# Hua Shao <nossiac@163.com>
#
include $(TOPDIR)/rules.mk
PKG_NAME:=wificonf
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS:=
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
include $(INCLUDE_DIR)/package.mk
define Package/wificonf
SECTION:=MTK Properties
CATEGORY:=MTK Properties
TITLE:=Read/Write MTK WiFi profiles
DEPENDS:=
SUBMENU:=Applications
MENU:=1
endef
define Package/wificonf/description
Read/Write MTK WiFi profiles
endef
define Package/wificonf/config
if PACKAGE_wificonf
config SUPPORT_LSDK_NVRAM_CMD
bool "Provide compatible usage for LSDK nvram command"
default n
endif
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
make -C src clean
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
TARGET_CFLAGS += -Wall
TARGET_CFLAGS += -Wno-error=format-security
define Package/wificonf/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wificonf $(1)/usr/bin
if [ "$$(CONFIG_SUPPORT_LSDK_NVRAM_CMD)" != "" ]; then \
$(INSTALL_BIN) ./files/usr/bin/nvram_get $(1)/usr/bin/nvram_get; \
$(LN) /usr/bin/nvram_get $(1)/usr/bin/nvram_set; \
fi
endef
$(eval $(call BuildPackage,wificonf))

View File

@ -1,93 +0,0 @@
#!/bin/sh
# usage:
# nvram_get [dev] <key>
# nvram_set [dev] <key> <value>
usage()
{
echo "Usage:"
echo " nvram_get [dev] <key>"
echo " nvram_set [dev] <key> <value>"
echo ""
echo "This a wrapper script which provides compatible tools as LSDK \"nvram_set\" and \"nvram_get\"."
echo "It uses \"wificonf\" as a underlying tool, check \"wificonf -h\" for more usage."
}
if [ "$0" == "nvram_set" -o "$0" == "/usr/bin/nvram_set" ]; then
CMD=set
if [ 2 == $# ]; then
KEY=$1
VAL=$2
elif [ 3 == $# ]; then
DEV=$1
KEY=$2
VAL=$3
else
usage
exit 1
fi
else
CMD=get
if [ 1 == $# ]; then
KEY=$1
elif [ 2 == $# ]; then
DEV=$1
KEY=$2
else
usage
exit 1
fi
fi
# first, check if there're soft-links for wifi profiles
if [ "$DEV" != "" ]; then
PROFILE=`readlink /tmp/mtk/wifi/$1`
fi
# else, try default mapping with l1profile:
# 2880 -> 1st card
# rtdev -> 2nd card
# wifi3 -> 3rd card
if [ "$PROFILE" == "" ]; then
if [ -f /etc/wireless/l1profile.dat ]; then
# first line "Default" is illegal in shell
cat /etc/wireless/l1profile.dat | tail -n +2 > /tmp/l1profile.sh;
. /tmp/l1profile.sh;
case "$DEV" in
2880)
PROFILE=$INDEX0_profile_path
;;
rtdev)
PROFILE=$INDEX1_profile_path
;;
wifi3)
PROFILE=$INDEX2_profile_path
;;
*)
PROFILE=$INDEX0_profile_path
;;
esac
fi
fi
# Fatal error: still cannot find correct $PROFILE !
if [ "$PROFILE" == "" ]; then
echo "Error: nvram_$CMD is not configured properly!" >&2
echo "Either you don't have a valid \"/etc/wireless/l1profile.dat\" , or you forgot to do something like:" >&2
echo " mkdir -p /tmp/mtk/wifi" >&2
echo " ln -s /etc/wireless/mt76xx/mt76xx.dat /tmp/mtk/wifi/xxxx" >&2
exit 1
fi
############ Final Wrapper ############
if [ -f /usr/bin/wificonf ]; then
/usr/bin/wificonf -f $PROFILE $CMD $KEY $VAL
else
echo "Error: unabled to locate wificonf!" >&2
exit 1
fi

View File

@ -1,7 +0,0 @@
wificonf: wificonf.c
$(CC) -Wall -Werror $(CFLAGS) $(LDFLAGS) -o $@ wificonf.c
clean:
-rm -f *.o *.elf *.gbd wificonf

View File

@ -1,679 +0,0 @@
/****************************************************************************
*
* Copyright (c) Hua Shao <nossiac@163.com>
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <memory.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#undef OK
#undef NG
#undef SHDBG
#undef IS_SPACE
#undef IS_NEWLINE
#undef ASSERT
#define OK (0)
#define NG (-1)
#define SHDBG(...) if(!__quiet) fprintf(stderr, __VA_ARGS__)
#define IS_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
#define IS_NEWLINE(c) ((c) == '\r' || (c) == '\n')
#define ASSERT(_cond_) \
do { \
if (!(_cond_)) {\
SHDBG("assert failure: %s, %s, %s L%d.\n", #_cond_, errno != 0?strerror(errno):"", __FUNCTION__, __LINE__); \
exit(-1); \
} \
} while(0);
int __quiet = 0;
int __base64 = 0;
char * __profile = NULL;
char * EMPTY = "";
int base64 = 0;
static const unsigned char base64_table[65] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
unsigned char * base64_encode(const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char *out, *pos;
const unsigned char *end, *in;
size_t olen;
int line_len;
olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
olen += olen / 72; /* line feeds */
olen++; /* nul termination */
if (olen < len)
return NULL; /* integer overflow */
out = malloc(olen+1); /* null terminated */
if (out == NULL)
return NULL;
out[olen] = 0;
end = src + len;
in = src;
pos = out;
line_len = 0;
while (end - in >= 3)
{
*pos++ = base64_table[in[0] >> 2];
*pos++ = base64_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
*pos++ = base64_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
*pos++ = base64_table[in[2] & 0x3f];
in += 3;
line_len += 4;
if (line_len >= 72)
{
*pos++ = '\n';
line_len = 0;
}
}
if (end - in)
{
*pos++ = base64_table[in[0] >> 2];
if (end - in == 1)
{
*pos++ = base64_table[(in[0] & 0x03) << 4];
*pos++ = '=';
}
else
{
*pos++ = base64_table[((in[0] & 0x03) << 4) |
(in[1] >> 4)];
*pos++ = base64_table[(in[1] & 0x0f) << 2];
}
*pos++ = '=';
line_len += 4;
}
if (line_len)
*pos++ = '\n';
*pos = '\0';
if (out_len)
*out_len = pos - out;
return out;
}
unsigned char * base64_decode(const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char dtable[256], *out, *pos, block[4], tmp;
size_t i, count, olen;
int pad = 0;
memset(dtable, 0x80, 256);
for (i = 0; i < sizeof(base64_table) - 1; i++)
dtable[base64_table[i]] = (unsigned char) i;
dtable['='] = 0;
count = 0;
for (i = 0; i < len; i++)
{
if (dtable[src[i]] != 0x80)
count++;
}
if (count == 0 || count % 4)
return NULL;
olen = count / 4 * 3;
pos = out = malloc(olen+1);
if (out == NULL)
return NULL;
pos[olen] = 0;
count = 0;
for (i = 0; i < len; i++)
{
tmp = dtable[src[i]];
if (tmp == 0x80)
continue;
if (src[i] == '=')
pad++;
block[count] = tmp;
count++;
if (count == 4)
{
*pos++ = (block[0] << 2) | (block[1] >> 4);
*pos++ = (block[1] << 4) | (block[2] >> 2);
*pos++ = (block[2] << 6) | block[3];
count = 0;
if (pad)
{
if (pad == 1)
pos--;
else if (pad == 2)
pos -= 2;
else
{
/* Invalid padding */
free(out);
return NULL;
}
break;
}
}
}
if (out_len)
*out_len = pos - out;
return out;
}
char * __get_token(char * str, int idx)
{
int i = 0;
char * p = NULL;
char * q = NULL;
char * tmp = strdup(str);
char * new = EMPTY;
do
{
p = strchr(tmp, '=');
if (!p) break;
p++;
i = 0;
while(i<idx)
{
if (*p == 0) break;
if (*p == ';') i++;
p++;
}
if (i == idx)
{
q = p;
while(*q != ';' && *q != 0) q++;
*q = 0;
new = strdup(p);
}
}
while(0);
free(tmp);
return new;
}
char * __set_token(char * str, int idx, char * value)
{
int i = 0;
char * p = NULL;
char * q = NULL;
char * tmp = strdup(str);
char * new = calloc(1, strlen(str)+strlen(value));
do
{
p = strchr(tmp, '=');
if (!p) break;
p++;
memcpy(new+strlen(new), tmp, p-tmp);
i = 0;
do
{
q = p;
while (*q != ';' && *q != 0) q++;
if (i == idx)
strncat(new, value, strlen(value));
else
strncat(new, p, q-p);
strncat(new, q, 1); /* now q == 0 or ';' */
i++;
p = q + 1;
}
while(p <= (tmp + strlen(tmp)));
/* every thing is fine */
free(tmp);
return new;
}
while(0);
/* you got here only if something was wrong! */
free(tmp);
return str;
}
/* return it's line number, if not found, return -1 */
int __locate_key(FILE * fp, char * key)
{
int offset = -1;
char buffer[1024] = {0};
char * p = NULL;
char * q = NULL;
ASSERT(fp);
ASSERT(key);
fseek(fp, 0, SEEK_SET);
do
{
offset = ftell(fp); /* record current pos */
memset(buffer, 0, sizeof(buffer));
p = fgets(buffer, sizeof(buffer), fp);
if(!p) break;
q = strstr(buffer, "=");
if(!q) continue;
*q = 0; /* cut off the part from '=' */
while(IS_SPACE(*p)) p++; /* trim leading spaces */
if(*p == 0) continue; /* skip empty line */
if(*p == '#') continue; /* skip comment line */
if (0 == strcmp(key, p))
break;
}
while(1);
fseek(fp, offset, SEEK_SET);
return offset;
}
char * __get_profile(char * alias)
{
int ret;
char * profile = NULL;
char * link = alias? alias : "/tmp/.wificonf/current";
struct stat sb;
if (__profile) return __profile;
if (lstat(link, &sb) == -1)
{
SHDBG("use \"wificonf use <profile>\" first\n");
exit(-1);
}
profile = (char *)malloc(sb.st_size + 1);
ASSERT(profile);
ret = readlink(link, profile, sb.st_size+1);
if (ret < 0)
{
SHDBG("use \"wificonf use <profile>\" first\n");
return NULL;
}
ASSERT(ret <= sb.st_size+1);
profile[sb.st_size] = 0;
return profile;
}
int conf_get(char * key)
{
int offset = 0;
FILE * fp = NULL;
char buffer[1024] = {0};
char * p = NULL;
char * q = NULL;
char * profile = NULL;
profile = __get_profile(NULL);
ASSERT(profile);
fp = fopen(profile, "rb");
ASSERT(fp);
offset = __locate_key(fp, key);
ASSERT(offset >= 0);
memset(buffer, 0, sizeof(buffer));
fseek(fp, offset, SEEK_SET);
p = fgets(buffer, sizeof(buffer)-1, fp);
if(!p) return OK;
p = strstr(buffer, "=");
if(!p) return OK;
p++;
while(IS_SPACE(*p)) p++; /* trim head spaces */
q = p;
while(*q != 0) q++;
q--;/* q points to the last character */
while(q > p && IS_SPACE(*q))
{
*q = 0;
q--;
}; /* trim tail spaces */
printf("%s\n", p);
if(fp) fclose(fp);
return OK;
}
int conf_set(char * key, char * value)
{
int ret = 0;
FILE * fp = NULL;
char * buffer = NULL;
int nbytes = 0;
char * profile = NULL;
char * p = NULL;
struct stat sb;
size_t len = strlen(value);
if (__base64)
{
value = (char *)base64_decode((unsigned char *)value, strlen(value), &len);
ASSERT(value);
}
profile = __get_profile(NULL);
ASSERT(profile);
fp = fopen(profile, "rb");
ASSERT(fp);
nbytes = __locate_key(fp, key);
ASSERT(nbytes >= 0);
ASSERT(stat(profile, &sb) == 0);
buffer = (char *)malloc(sb.st_size + 1);
ASSERT(buffer);
buffer[sb.st_size] = 0;
fseek(fp, 0, SEEK_SET);
ret = fread(buffer, 1, sb.st_size, fp);
ASSERT(ret == sb.st_size);
fclose(fp);
fp = fopen(profile, "wb");
ASSERT(fp);
ret = fwrite(buffer, 1, nbytes, fp);
ASSERT(ret == nbytes);
fprintf(fp, "%s=", key);
for (ret=0; ret<len; ret++)
fprintf(fp, "%c", value[ret]);
fprintf(fp, "\n");
p = buffer + nbytes;
while('\n' != *p && 0 != *p) p++;
if (0 != *p) p++; /* now p is the next line */
nbytes = buffer + sb.st_size - p; /* remain data */
ret = fwrite(p, 1, nbytes, fp);
ASSERT(ret == nbytes);
if(fp) fclose(fp);
return OK;
}
int conf_get_token(char * key, int idx)
{
int offset = 0;
FILE * fp = NULL;
char buffer[1024] = {0};
char * p = NULL;
char * profile = NULL;
ASSERT(key);
ASSERT(idx >= 0);
profile = __get_profile(NULL);
ASSERT(profile);
fp = fopen(profile, "rb");
ASSERT(fp);
offset = __locate_key(fp, key);
ASSERT(offset>=0);
fseek(fp, offset, SEEK_SET);
memset(buffer, 0, sizeof(buffer));
p = fgets(buffer, sizeof(buffer)-1, fp);
if(!p) return OK;
printf("%s\n", __get_token(buffer, idx));
if(fp) fclose(fp);
return OK;
}
int conf_set_token(char * key, int idx, char * value)
{
int ret = 0;
int nbytes = 0;
FILE * fp = NULL;
char * buffer = NULL;
char * p = NULL;
char * q = NULL;
char * profile = NULL;
struct stat sb;
size_t len = strlen(value);
ASSERT(key);
ASSERT(idx >= 0 && idx < 32);
if (__base64)
{
value = (char *)base64_decode((unsigned char *)value, strlen(value), &len);
ASSERT(value);
}
profile = __get_profile(NULL);
ASSERT(profile);
ASSERT(stat(profile, &sb) == 0);
buffer = (char *)malloc(sb.st_size + 1);
ASSERT(buffer);
buffer[sb.st_size] = 0;
fp = fopen(profile, "rb");
ASSERT(fp);
ret = fread(buffer, 1, sb.st_size, fp);
ASSERT(ret == sb.st_size);
nbytes = __locate_key(fp, key);
ASSERT(nbytes>=0);
fclose(fp);
/* write the first part. */
fp = fopen(profile, "wb");
ASSERT(fp);
ret = fwrite(buffer, 1, nbytes, fp);
ASSERT(ret == nbytes);
/* write new key-value. */
p = buffer+nbytes;
q = p;
while(*q != '\n' && q != 0) q++;
*q = 0;
q++;
p = __set_token(p, idx, value);
fprintf(fp, "%s\n", p);
/* write rest data */
nbytes = buffer + sb.st_size - q; /* remain data */
ret = fwrite(q, 1, nbytes, fp);
ASSERT(ret == nbytes);
if(fp) fclose(fp);
return OK;
}
int usage(void)
{
printf("Usage:\n"
" wificonf [option] use <profile>\n"
" wificonf [option] get <key>\n"
" wificonf [option] get <key> [idx]\n"
" wificonf [option] set <key> <value>\n"
" wificonf [option] set <key> <idx> <value>\n"
"\n"
"Options:\n"
" -e use base64 encoded <value>.\n"
" -f specify the profile.\n"
" -q be quiet, no error will be reported.\n"
"\n\n"
"Examples:\n"
" 1. set the default profile you want to access\n"
" wificonf use /etc/wireless/mt7603.dat\n"
" wificonf get SSID1\n"
" 2. change the default profile you want to access\n"
" wificonf use /etc/wireless/mt7615.dat\n"
" wificonf set SSID1 MasterNet\n"
" wificonf set SSID2 GuestNet\n"
" wificonf set BssidNum 2\n"
" 3. also you can specify the profile with each command\n"
" wificonf -f /etc/wireless/mt7603.dat set SSID1 WiFi-7603\n"
" 4. access a key that has a list of values\n"
" wificonf set TestKey \"1;2;3;4\"\n"
" wificonf get TestKey --> 1;2;3;4\n"
" wificonf set TestKey 0 99\n"
" wificonf get TestKey --> 99;2;3;4\n"
);
return OK;
}
int use_profile(char * profile, char * alias)
{
char softlink[512];
int ret;
struct stat st;
if (stat("/tmp/.wificonf", &st) < 0)
{
ret = mkdir("/tmp/.wificonf", 0700);
ASSERT(ret == 0);
}
snprintf(softlink, sizeof(softlink), "/tmp/.wificonf/current");
if (lstat(softlink, &st) == 0)
{
ret = unlink(softlink);
ASSERT(ret == 0);
}
ret = symlink(profile, softlink);
ASSERT(ret == 0);
if (!alias) return OK;
snprintf(softlink, sizeof(softlink), "/tmp/.wificonf/%s", alias);
if (lstat(softlink, &st) == 0)
{
SHDBG("you are overwritting %s to %s\n", softlink, profile);
ret = unlink(softlink);
ASSERT(ret == 0);
}
ret = symlink(profile, softlink);
ASSERT(ret == 0);
return OK;
}
int main(int argn, char ** args)
{
int argc = 1;
int c;
int i;
char * argv[8];
argv[0] = strdup(args[0]);
while ((c = getopt (argn, args, "ef:qh")) != -1)
{
switch (c)
{
case 'f':
__profile = optarg;
break;
case 'q':
__quiet = 1;
break;
case 'e':
__base64 = 1;
break;
case 'h':
default:
return usage();
}
}
for (i = optind; i < argn; i++)
argv[argc++] = args[i];
if (argc < 2)
return usage();
if (0 == strcmp(argv[1], "use"))
{
if (argc == 3)
return use_profile(argv[2], NULL);
else if (argc == 4)
return use_profile(argv[2], argv[3]);
else
return usage();
}
if (0 == strcmp(argv[1], "get"))
{
/* case 1: wificonf get <key> */
/* case 2: wificonf get <key> <idx> */
if (argc == 3)
return conf_get(argv[2]);
else if (argc == 4)
return conf_get_token(argv[2], atoi(argv[3]));
else
return usage();
}
if (0 == strcmp(argv[1], "set"))
{
/* case 1: wificonf set <key> <value> */
/* case 2: wificonf set <key> <idx> <value> */
if (argc == 4)
return conf_set(argv[2], argv[3]);
else if (argc == 5)
return conf_set_token(argv[2], atoi(argv[3]), argv[4]);
else
return usage();
}
return OK;
}

View File

@ -1,231 +0,0 @@
# All rights reserved.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mt_wifi
P4REV:=
PKG_VERSION:=5.0.2.0
PKG_SOURCE:=MT7621_7615.tar.xz
#PKG_SOURCE:=MT7615_MT7622_LinuxAP.tar.bz2
#PKG_SOURCE:=MT7615_MT7622_LinuxAP_$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
PKG_KCONFIG:= \
AP_SUPPORT \
RT_FIRST_CARD \
RT_SECOND_CARD \
RT_FIRST_IF_RF_OFFSET \
RT_SECOND_IF_RF_OFFSET \
MT_WIFI \
WIFI_BASIC_FUNC \
MT_WIFI_PATH \
FIRST_IF_NONE \
FIRST_IF_EEPROM_FLASH \
FIRST_IF_EEPROM_EFUSE \
RT_FIRST_CARD_EEPROM \
SECOND_IF_NONE \
SECOND_IF_EEPROM_FLASH \
SECOND_IF_EEPROM_PROM \
SECOND_IF_EEPROM_EFUSE \
RT_SECOND_CARD_EEPROM \
MULTI_INF_SUPPORT \
WIFI_BASIC_FUNC \
WIRELESS_EXT \
WEXT_SPY \
WEXT_PRIV \
DOT11_N_SUPPORT \
DOT11_VHT_AC \
WIFI_DRIVER \
G_BAND_256QAM_SUPPORT \
BRCM_256QAM_SUPPORT \
ICAP_SUPPORT \
MT_AP_SUPPORT \
BACKGROUND_SCAN_SUPPORT \
SMART_CARRIER_SENSE_SUPPORT \
MT_DFS_SUPPORT \
HDR_TRANS_TX_SUPPORT \
CHIP_MT7615E \
HDR_TRANS_RX_SUPPORT \
DBDC_MODE \
MULTI_PROFILE_SUPPORT \
DEFAULT_5G_PROFILE \
SUPPORT_DYNAMIC_TXOP \
WSC_INCLUDED \
MT_STA_SUPPORT \
WSC_V2_SUPPORT \
DOT11W_PMF_SUPPORT \
PASSPOINT_R2 \
TXBF_SUPPORT \
IGMP_SNOOP_SUPPORT \
RATE_ADAPTION \
RATE_ADAPT_AGBS_SUPPORT \
RTMP_FLASH_SUPPORT \
ATE_SUPPORT \
UAPSD \
RLT_MAC \
RLT_BBP \
RLT_RF \
RTMP_MAC \
RTMP_BBP \
RTMP_RF \
RTMP_PCI_SUPPORT \
RTMP_USB_SUPPORT \
RTMP_RBUS_SUPPORT \
WIFI_MODE_AP \
WIFI_MODE_STA \
WIRELESS_EXT \
WEXT_SPY \
WEXT_PRIV \
WDS_SUPPORT \
MBSS_SUPPORT \
APCLI_SUPPORT \
APCLI_CERT_SUPPORT \
MAC_REPEATER_SUPPORT \
RALINK_RT6352 \
RALINK_MT7620 \
RALINK_MT7603E \
CON_WPS_SUPPORT \
VOW_SUPPORT \
BAND_STEERING \
TXOP_ARBITER \
CFG_SUPPORT_DYNAMIC_TXOP \
WIFI_MODE_BOTH \
WIFI_RLT_MAC \
RLT_MAC \
WIFI_RTMP_MAC \
RTMP_MAC \
WIFI_MT_MAC \
CHIP_MT7603E \
CHIP_MT7615E \
MT_MAC \
RATE_ADAPTION \
SUPPORT_OPENWRT \
SDK_USER_LIGHTY \
MUMIMO_SUPPORT \
MU_RA_SUPPORT \
LED_CONTROL_SUPPORT \
RA_HW_NAT \
RA_HW_NAT_WIFI_NEW_ARCH \
CFG80211_SUPPORT \
SER_SUPPORT \
GREENAP_SUPPORT \
RADIUS_ACCOUNTING_SUPPORT \
TPC_SUPPORT \
RLM_CAL_CACHE_SUPPORT \
RF_LOCKDOWN_SUPPORT \
PASSPOINT_R2 \
RED_SUPPORT \
FIRST_IF_EPAELNA \
FIRST_IF_IPAILNA \
FIRST_IF_IPAELNA \
FIRST_IF_EPAILNA \
SECOND_IF_EPAELNA \
SECOND_IF_IPAILNA \
SECOND_IF_IPAELNA \
SECOND_IF_EPAILNA \
THIRD_IF_EPAELNA \
THIRD_IF_IPAILNA \
THIRD_IF_IPAELNA \
THIRD_IF_EPAILNA \
WIFI_PKT_FWD \
DOT11K_RRM_SUPPORT \
DOT11R_FT_SUPPORT \
MBO_SUPPORT \
WIFI_PKT_FWD_V1 \
FIRST_IF_MT7615E \
FIRST_IF_MT7622 \
FIRST_IF_MT7626 \
SECOND_IF_MT7615E \
THIRD_IF_NONE \
THIRD_IF_MT7615E \
RT_THIRD_CARD \
RT_THIRD_IF_RF_OFFSET \
THIRD_IF_EEPROM_FLASH \
THIRD_IF_EEPROM_PROM \
THIRD_IF_EEPROM_EFUSE \
RT_THIRD_CARD_EEPROM \
SPECTRUM_SUPPORT \
MULTI_PROFILE_SUPPORT \
PRE_CAL_TRX_SET1_SUPPORT \
MWDS \
MCAST_RATE_SPECIFIC \
WLAN_HOOK \
COEX_SUPPORT \
EASY_SETUP_SUPPORT \
EVENT_NOTIFIER_SUPPORT \
AIR_MONITOR \
WNM_SUPPORT \
INTERWORKING \
LINUX_NET_TXQ_SUPPORT \
CHIP_MT7622 \
CHIP_MT7626 \
WHNAT_SUPPORT \
FAST_NAT_SUPPORT \
PRE_CAL_TRX_SET2_SUPPORT \
LINK_TEST_SUPPORT \
TCP_RACK_SUPPORT \
FQ_SCH_SUPPORT \
BRCM_256QAM_SUPPORT \
VHT_TXBF_2G_EPIGRAM_IE_SUPPORT \
DSCP_PRI_SUPPORT \
PCIE_ASPM_DYM_CTRL_SUPPORT \
PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_MTK_$c),CONFIG_$(c)))
include $(INCLUDE_DIR)/package.mk
TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
define KernelPackage/mt_wifi
CATEGORY:=MTK Properties
TITLE:=MTK wifi AP driver
DEPENDS:=+wifi-l1profile
ifneq ($(CONFIG_MTK_WHNAT_SUPPORT), )
FILES:=$(PKG_BUILD_DIR)/mt_wifi_ap/mt_wifi.ko \
$(PKG_BUILD_DIR)/mt_wifi/embedded/tools/plug_in/whnat/mt_whnat.ko
AUTOLOAD:=$(call AutoProbe,mt_wifi mt_whnat)
else
FILES:=$(PKG_BUILD_DIR)/mt_wifi_ap/mt_wifi.ko
AUTOLOAD:=$(call AutoProbe,mt_wifi)
endif
SUBMENU:=Drivers
MENU:=1
endef
define KernelPackage/mt_wifi/config
source "$(SOURCE)/config.in"
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=1 \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)/mt_wifi_ap" \
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_MTK_$c),CONFIG_$(c)=$(CONFIG_MTK_$(c)))) \
modules
endef
define KernelPackage/mt_wifi/install
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/lib/wifi/
$(INSTALL_DIR) $(1)/etc/wireless/mediatek/
$(INSTALL_DIR) $(1)/etc/Wireless/RT2860/
$(INSTALL_DIR) $(1)/etc/wireless/mt7615/
$(INSTALL_DIR) $(1)/etc/RT2860/
$(INSTALL_BIN) ./files/mt7615.1.2G.dat $(1)/etc/wireless/mt7615/
$(INSTALL_BIN) ./files/mt7615.1.5G.dat $(1)/etc/wireless/mt7615/
$(INSTALL_BIN) ./files/mt7615e-sku.dat $(1)/etc/wireless/mediatek/
$(INSTALL_BIN) ./files/mt7615e-sku-bf.dat $(1)/etc/wireless/mediatek/
echo $(PKG_VERSION) > $(1)/etc/wireless/mediatek/version
$(INSTALL_BIN) ./files/mt7615e*.lua $(1)/lib/wifi/
$(INSTALL_BIN) ./files/wifi_services.lua $(1)/lib/wifi/
$(INSTALL_BIN) ./files/firmware.sh $(1)/etc/init.d/
endef
$(eval $(call KernelPackage,mt_wifi))

View File

@ -1,80 +0,0 @@
if [ -d wifi_driver ]; then
mkdir -p mt_wifi_ap
mkdir -p mt_wifi_sta
cp -a wifi_driver/os/linux/Kconfig.mt_wifi_ap ./mt_wifi_ap/Kconfig
cp -a wifi_driver/os/linux/Makefile.mt_wifi_ap ./mt_wifi_ap/Makefile
cp -a wifi_driver/os/linux/Kconfig.mt_wifi_sta ./mt_wifi_sta/Kconfig
cp -a wifi_driver/os/linux/Makefile.mt_wifi_sta ./mt_wifi_sta/Makefile
cp -a wifi_driver/os/linux/Kconfig.mt_wifi wifi_driver/embedded/Kconfig
cp -rf wifi_driver mt_wifi
#if [ -d mt_wifi ]; then
# rm -rf mt_wifi
#fi
#mv wifi_driver mt_wifi
echo "7622 mt_wifi autobuild"
RT28xx_DIR=./mt_wifi
CHIPSET=mt7622
RT28xx_MODE=AP
HAS_WOW_SUPPORT=n
HAS_FPGA_MODE=n
HAS_RX_CUT_THROUGH=n
RT28xx_BIN_DIR=.
export RT28xx_DIR CHIPSET RT28xx_MODE HAS_WOW_SUPPORT HAS_FPGA_MODE HAS_RX_CUT_THROUGH RT28xx_BIN_DIR
make -C mt_wifi/embedded build_tools
./mt_wifi/embedded/tools/bin2h
make -C mt_wifi/embedded build_sku_tables
./mt_wifi/txpwr/dat2h
echo "7615 mt_wifi autobuild"
RT28xx_DIR=./mt_wifi
CHIPSET=mt7615
RT28xx_MODE=AP
HAS_WOW_SUPPORT=n
HAS_FPGA_MODE=n
HAS_RX_CUT_THROUGH=n
RT28xx_BIN_DIR=.
export RT28xx_DIR CHIPSET RT28xx_MODE HAS_WOW_SUPPORT HAS_FPGA_MODE HAS_RX_CUT_THROUGH RT28xx_BIN_DIR
make -C mt_wifi/embedded build_tools
./mt_wifi/embedded/tools/bin2h
make -C mt_wifi/embedded build_sku_tables
./mt_wifi/txpwr/dat2h
echo "7626 mt_wifi autobuild"
RT28xx_DIR=./mt_wifi
CHIPSET=mt7626
RT28xx_MODE=AP
HAS_WOW_SUPPORT=n
HAS_FPGA_MODE=n
HAS_RX_CUT_THROUGH=n
RT28xx_BIN_DIR=.
export RT28xx_DIR CHIPSET RT28xx_MODE HAS_WOW_SUPPORT HAS_FPGA_MODE HAS_RX_CUT_THROUGH RT28xx_BIN_DIR
make -C mt_wifi/embedded build_tools
./mt_wifi/embedded/tools/bin2h
make -C mt_wifi/embedded build_sku_tables
./mt_wifi/txpwr/dat2h
elif [ -d rlt_wifi ]; then
mkdir -p mt_wifi_ap
mkdir -p mt_wifi_sta
cp -a rlt_wifi/os/linux/Kconfig.mt_wifi_ap ./mt_wifi_ap/Kconfig
cp -a rlt_wifi/os/linux/Makefile.mt_wifi_ap ./mt_wifi_ap/Makefile
cp -a rlt_wifi/os/linux/Kconfig.mt_wifi_sta ./mt_wifi_sta/Kconfig
cp -a rlt_wifi/os/linux/Makefile.mt_wifi_sta ./mt_wifi_sta/Makefile
cp -a rlt_wifi/os/linux/Kconfig.mt_wifi rlt_wifi/embedded/Kconfig
if [ -d mt_wifi ]; then
rm -rf mt_wifi
fi
mv rlt_wifi mt_wifi
echo "7615e rlt_wifi autobuild"
RT28xx_DIR=./mt_wifi
CHIPSET=mt7615
RT28xx_MODE=AP
HAS_WOW_SUPPORT=n
HAS_FPGA_MODE=n
HAS_RX_CUT_THROUGH=n
RT28xx_BIN_DIR=.
export RT28xx_DIR CHIPSET RT28xx_MODE HAS_WOW_SUPPORT HAS_FPGA_MODE HAS_RX_CUT_THROUGH RT28xx_BIN_DIR
make -C mt_wifi/embedded build_tools
./mt_wifi/embedded/tools/bin2h
make -C mt_wifi/embedded build_sku_tables
./mt_wifi/txpwr/dat2h
else
exit 1
fi

View File

@ -1,868 +0,0 @@
if PACKAGE_kmod-mt_wifi
config MTK_SUPPORT_OPENWRT
bool
default y
depends on PACKAGE_kmod-mt_wifi
config MTK_WIFI_DRIVER
bool
default y
depends on PACKAGE_kmod-mt_wifi
select MTK_WIFI_MT_MAC
select MTK_MT_MAC
#select MTK_FIRST_IF_MT7615E
#select MTK_CHIP_MT7622
#select MTK_CHIP_MT7626
#select MTK_SECOND_IF_MT7615E
#select MTK_THIRD_IF_MT7615E
#select MTK_CHIP_MT7615E
if MTK_WIFI_DRIVER
choice
prompt "Choose First WiFi Interface"
config MTK_FIRST_IF_NONE
bool "None"
config MTK_FIRST_IF_MT7615E
bool "MT7615E"
select MTK_WIFI_MT_MAC
select MTK_MT_MAC
select MTK_CHIP_MT7615E
config MTK_FIRST_IF_MT7622
bool "MT7622"
select MTK_WIFI_MT_MAC
select MTK_MT_MAC
select MTK_CHIP_MT7622
config MTK_FIRST_IF_MT7626
bool "MT7626"
select MTK_WIFI_MT_MAC
select MTK_MT_MAC
select MTK_CHIP_MT7626
endchoice
choice
prompt "Choose Second WiFi Interface"
config MTK_SECOND_IF_NONE
bool "None"
config MTK_SECOND_IF_MT7615E
bool "MT7615E"
select MTK_WIFI_MT_MAC
select MTK_CHIP_MT7615E
select MTK_MULTI_INF_SUPPORT
endchoice
choice
prompt "Choose Third WiFi Interface"
config MTK_THIRD_IF_NONE
bool "None"
config MTK_THIRD_IF_MT7615E
bool "MT7615E"
select MTK_WIFI_MT_MAC
select MTK_CHIP_MT7615E
select MTK_MULTI_INF_SUPPORT
endchoice
config MTK_RT_FIRST_CARD
int
depends on ! MTK_FIRST_IF_NONE
default 7615 if MTK_FIRST_IF_MT7615E
default 7622 if MTK_FIRST_IF_MT7622
default 7626 if MTK_FIRST_IF_MT7626
config MTK_RT_SECOND_CARD
int
depends on ! MTK_SECOND_IF_NONE
default 7615 if MTK_SECOND_IF_MT7615E
config MTK_RT_THIRD_CARD
int
depends on ! MTK_THIRD_IF_NONE
default 7615 if MTK_THIRD_IF_MT7615E
config MTK_RT_FIRST_IF_RF_OFFSET
hex
depends on ! MTK_FIRST_IF_NONE
default 0xc0000
config MTK_RT_SECOND_IF_RF_OFFSET
hex
depends on ! MTK_SECOND_IF_NONE
default 0xc8000
config MTK_RT_THIRD_IF_RF_OFFSET
hex
depends on ! MTK_THIRD_IF_NONE
default 0xd0000
config MTK_MT_WIFI
tristate "MT WIFI Driver"
select MTK_WIFI_BASIC_FUNC if MTK_MT_WIFI
config MTK_MT_WIFI_PATH
string
depends on MTK_MT_WIFI
default "mt_wifi"
if MTK_MT_WIFI
menu "WiFi Generic Feature Options"
choice
prompt "EEPROM Type of 1st Card"
depends on ! MTK_FIRST_IF_NONE
config MTK_FIRST_IF_EEPROM_FLASH
bool "FLASH"
config MTK_FIRST_IF_EEPROM_PROM
bool "EEPROM"
config MTK_FIRST_IF_EEPROM_EFUSE
bool "EFUSE"
endchoice
config MTK_RT_FIRST_CARD_EEPROM
string
depends on ! MTK_FIRST_IF_NONE
default "prom" if MTK_FIRST_IF_EEPROM_PROM
default "efuse" if MTK_FIRST_IF_EEPROM_EFUSE
default "flash" if MTK_FIRST_IF_EEPROM_FLASH
choice
prompt "EEPROM Type of 2nd Card"
depends on ! MTK_SECOND_IF_NONE
config MTK_SECOND_IF_EEPROM_FLASH
bool "FLASH"
config MTK_SECOND_IF_EEPROM_PROM
bool "EEPROM"
config MTK_SECOND_IF_EEPROM_EFUSE
bool "EFUSE"
endchoice
config MTK_RT_SECOND_CARD_EEPROM
string
depends on ! MTK_SECOND_IF_NONE
default "prom" if MTK_SECOND_IF_EEPROM_PROM
default "efuse" if MTK_SECOND_IF_EEPROM_EFUSE
default "flash" if MTK_SECOND_IF_EEPROM_FLASH
choice
prompt "EEPROM Type of 3th Card"
depends on ! MTK_THIRD_IF_NONE
config MTK_THIRD_IF_EEPROM_FLASH
bool "FLASH"
config MTK_THIRD_IF_EEPROM_PROM
bool "EEPROM"
config MTK_THIRD_IF_EEPROM_EFUSE
bool "EFUSE"
endchoice
config MTK_RT_THIRD_CARD_EEPROM
string
depends on ! MTK_THIRD_IF_NONE
default "prom" if MTK_THIRD_IF_EEPROM_PROM
default "efuse" if MTK_THIRD_IF_EEPROM_EFUSE
default "flash" if MTK_THIRD_IF_EEPROM_FLASH
config MTK_MULTI_INF_SUPPORT
bool
default y if !MTK_FIRST_IF_NONE && !MTK_SECOND_IF_NONE
config MTK_WIFI_BASIC_FUNC
bool "Basic Functions"
select MTK_WIRELESS_EXT
select MTK_WEXT_SPY
select MTK_WEXT_PRIV
config MTK_DOT11_N_SUPPORT
bool "802.11n support"
default y
config MTK_DOT11_VHT_AC
bool "802.11AC support"
depends on MTK_WIFI_DRIVER
depends on MTK_DOT11_N_SUPPORT
default y
config MTK_G_BAND_256QAM_SUPPORT
bool "2.4G 256QAM support"
depends on MTK_WIFI_DRIVER
depends on MTK_DOT11_VHT_AC
default y
config MTK_BRCM_256QAM_SUPPORT
bool "BRCM 2.4G 256QAM support"
depends on MTK_WIFI_DRIVER
depends on MTK_G_BAND_256QAM_SUPPORT
default n
config MTK_VHT_TXBF_2G_EPIGRAM_IE_SUPPORT
bool "BRCM 2.4G VHT Sounding support"
depends on MTK_WIFI_DRIVER
default n
config MTK_TPC_SUPPORT
bool "802.11h TPC Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_ICAP_SUPPORT
bool "ICAP Support"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT
default y
config MTK_SPECTRUM_SUPPORT
bool "Wifi Spectrum Support"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT
default y
config MTK_BACKGROUND_SCAN_SUPPORT
bool "Background Scan Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_SMART_CARRIER_SENSE_SUPPORT
bool "Smart Carrier Sense Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_MT_DFS_SUPPORT
bool "Dynamic Frequency Selection Support"
depends on MTK_WIFI_DRIVER
default y
#config WFA_VHT_R2_PF
# bool "WFA VHT R2 Plugfest"
# depends on DOT11_VHT_AC
# default n
config MTK_HDR_TRANS_TX_SUPPORT
bool "Tx Header Translation"
depends on MTK_CHIP_MT7615E || MTK_CHIP_MT7622 || MTK_CHIP_MT7626
default y
config MTK_HDR_TRANS_RX_SUPPORT
bool "Rx Header Translation"
depends on MTK_CHIP_MT7615E || MTK_CHIP_MT7622 || MTK_CHIP_MT7626
default y
config MTK_DBDC_MODE
bool "dbdc mode support"
depends on MTK_CHIP_MT7615E || MTK_CHIP_MT7626
select MULTI_PROFILE_SUPPORT
select DEFAULT_5G_PROFILE
default y
config MTK_MULTI_PROFILE_SUPPORT
bool "Multi Profile Support"
depends on MTK_DBDC_MODE
default y
config MTK_DEFAULT_5G_PROFILE
bool "5G default profile for DBDC"
depends on MTK_DBDC_MODE
# depends on MTK_MULTI_PROFILE_SUPPORT
default y
config MTK_WSC_INCLUDED
bool "WSC (WiFi Simple Config)"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT || MTK_MT_STA_SUPPORT
default y
config MTK_WSC_V2_SUPPORT
bool "WSC V2(WiFi Simple Config Version 2.0)"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT || MTK_MT_STA_SUPPORT
default y
config MTK_DOT11W_PMF_SUPPORT
bool "PMF"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT || MTK_MT_STA_SUPPORT
default y
config MTK_TXBF_SUPPORT
bool "Tx Bean Forming Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_FAST_NAT_SUPPORT
bool "Fast-NAT support"
# depends on RA_HW_NAT_WIFI
default n
config MTK_WHNAT_SUPPORT
tristate "Wifi Hardware NAT support"
depends on MTK_CHIP_MT7615E
depends on MTK_WLAN_HOOK
depends on MTK_FAST_NAT_SUPPORT
select PACKAGE_kmod-hw_nat
default n
#config LLTD_SUPPORT
# bool "LLTD (Link Layer Topology Discovery Protocol)"
# depends on WIFI_DRIVER
# depends on MT_AP_SUPPORT
# default n
#config QOS_DLS_SUPPORT
# bool "802.11e DLS ((Direct-Link Setup) Support"
# depends on WIFI_DRIVER
# depends on MT_AP_SUPPORT
# default n
#config WAPI_SUPPORT
# bool "WAPI Support"
# depends on WIFI_DRIVER
# default n
config MTK_FTM_SUPPORT
bool "FTM Support"
depends on MTK_WIFI_DRIVER
select MTK_PASSPOINT_R2
default n
#config CARRIER_DETECTION_SUPPORT
# bool "Carrier Detect"
# depends on WIFI_DRIVER
# default n
config MTK_IGMP_SNOOP_SUPPORT
bool "IGMP snooping"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT
default y
#config BLOCK_NET_IF
# bool "NETIF Block"
# depends on WIFI_DRIVER
# depends on MT_AP_SUPPORT
# default n
# help
# Support Net interface block while Tx-Sw queue full
#config RATE_ADAPTION
# bool "New Rate Adaptation support"
# depends on WIFI_DRIVER
# default y
#config NEW_RATE_ADAPT_SUPPORT
# bool "Intelligent Rate Adaption"
# depends on WIFI_DRIVER && RATE_ADAPTION
# default y
#config AGS_SUPPORT
# bool "Adaptive Group Switching"
# depends on WIFI_DRIVER && RATE_ADAPTION
# depends on MT_AP_SUPPORT || MT_STA_SUPPORT
# default n
#config RATE_ADAPT_AGBS_SUPPORT
# bool "Adaptive AGBS Mode"
# depends on WIFI_DRIVER && RATE_ADAPTION
# depends on MT_AP_SUPPORT || MT_STA_SUPPORT
# default y
#config IDS_SUPPORT
# bool "IDS (Intrusion Detection System) Support"
# depends on WIFI_DRIVER
# depends on MT_AP_SUPPORT
# default n
#config WIFI_WORK_QUEUE
# bool "Work Queue"
# depends on WIFI_DRIVER
# default n
#config WIFI_SKB_RECYCLE
# bool "SKB Recycle(Linux)"
# depends on WIFI_DRIVER
# depends on MT_AP_SUPPORT
# default n
config MTK_RTMP_FLASH_SUPPORT
bool "Flash Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_PRE_CAL_TRX_SET1_SUPPORT
bool "Calibration To Flash/BinFile Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_RLM_CAL_CACHE_SUPPORT
bool "RlmCalibrationCache Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_PRE_CAL_TRX_SET2_SUPPORT
bool "Pre-calibration to Flash Support"
depends on MTK_WIFI_DRIVER
default y
config MTK_RF_LOCKDOWN_SUPPORT
bool "RF Lockdown Support"
depends on MTK_WIFI_DRIVER
default n
config MTK_LINK_TEST_SUPPORT
bool "Link Test Support"
depends on MTK_WIFI_DRIVER
default n
#config MTK_LED_CONTROL_SUPPORT
# bool "LED Support"
# depends on MTK_WIFI_DRIVER
# depends on MTK_MT_AP_SUPPORT
# default n
config MTK_ATE_SUPPORT
bool "ATE/QA Support"
depends on MTK_WIFI_DRIVER
default y
#config MTK_MEMORY_OPTIMIZATION
# bool "Memory Optimization"
# depends on MTK_WIFI_DRIVER
# default n
config MTK_PASSPOINT_R2
bool "Passpoint Release-2 Support"
depends on MTK_WIFI_DRIVER
select MTK_DOT11W_PMF_SUPPORT
depends on MTK_MT_AP_SUPPORT
default n
config MTK_MBO_SUPPORT
bool "MBO Support"
depends on MTK_WIFI_DRIVER
select MTK_INTERWORKING
select MTK_WNM_SUPPORT
select MTK_DOT11K_RRM_SUPPORT
select MTK_DOT11R_FT_SUPPORT
select MTK_DOT11W_PMF_SUPPORT
default n
#config TRACE_TCP_PKT
# bool "TCP DATA/ACK packets trace log"
# depends on WIFI_DRIVER
# default n
config MTK_UAPSD
bool "UAPSD support"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT || MTK_MT_STA_SUPPORT
default y
config MTK_TCP_RACK_SUPPORT
bool "TCP Reduced ACK support"
depends on MTK_WIFI_DRIVER
default n
#### PA_LNA_Type choice
config MTK_RED_SUPPORT
bool "RED(Random Early Drop) support"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT || MTK_MT_STA_SUPPORT
default y
config MTK_FQ_SCH_SUPPORT
bool "Fair Queueing support"
depends on MTK_WIFI_DRIVER
depends on MTK_MT_AP_SUPPORT && MTK_VOW_SUPPORT
depends on MTK_CHIP_MT7622
default y
config MTK_FDB_SUPPORT
bool "FW Debug Port"
depends on MTK_WIFI_DRIVER
default n
choice
prompt "PA LNA Type of 1st Card"
depends on ! MTK_FIRST_IF_NONE
config MTK_FIRST_IF_EPAELNA
bool "ePAeLNA"
config MTK_FIRST_IF_IPAILNA
bool "iPAiLNA"
config MTK_FIRST_IF_IPAELNA
bool "iPAeLNA"
# config MTK_FIRST_IF_EPAILNA
# bool "ePAiLNA"
endchoice
choice
prompt "PA LNA Type of 2nd Card"
depends on ! MTK_SECOND_IF_NONE
config MTK_SECOND_IF_EPAELNA
bool "ePAeLNA"
config MTK_SECOND_IF_IPAILNA
bool "iPAiLNA"
config MTK_SECOND_IF_IPAELNA
bool "iPAeLNA"
# config MTK_SECOND_IF_EPAILNA
# bool "ePAiLNA"
endchoice
choice
prompt "PA LNA Type of 3rd Card"
depends on ! MTK_THIRD_IF_NONE
config MTK_THIRD_IF_EPAELNA
bool "ePAeLNA"
config MTK_THIRD_IF_IPAILNA
bool "iPAiLNA"
config MTK_THIRD_IF_IPAELNA
bool "iPAeLNA"
# config MTK_THIRD_IF_EPAILNA
# bool "ePAiLNA"
endchoice
#### PA_LNA_Type choice END
#
# Section for chip architectures
#
# "RLT MAC Support"
config MTK_RLT_MAC
bool
depends on MTK_WIFI_DRIVER
default n
config MTK_RLT_BBP
bool
config MTK_RLT_RF
bool
# "RTMP MAC Support"
config MTK_RTMP_MAC
bool
depends on MTK_WIFI_DRIVER
default n
config MTK_RTMP_BBP
bool
config MTK_RTMP_RF
bool
#
# Section for interfaces
#
config MTK_RTMP_PCI_SUPPORT
bool
config MTK_RTMP_USB_SUPPORT
bool
config MTK_RTMP_RBUS_SUPPORT
bool
endmenu
menu "WiFi Operation Modes"
choice
prompt "Main Mode"
default MTK_WIFI_MODE_AP
config MTK_WIFI_MODE_AP
tristate "AP"
select MTK_MT_AP_SUPPORT
config MTK_WIFI_MODE_STA
tristate "STA"
select MTK_MT_STA_SUPPORT
config MTK_WIFI_MODE_BOTH
tristate "APSTA"
select MTK_MT_AP_SUPPORT
select MTK_MT_STA_SUPPORT
endchoice
config MTK_MT_AP_SUPPORT
tristate "Ralink RT2860 802.11n AP support"
# depends on NET_RADIO
select MTK_WIRELESS_EXT
select MTK_WEXT_SPY
select MTK_WEXT_PRIV
config MTK_WDS_SUPPORT
bool "WDS"
depends on MTK_MT_AP_SUPPORT
default y
config MTK_MBSS_SUPPORT
bool "MBSSID"
depends on MTK_MT_AP_SUPPORT
default y
#config NEW_MBSSID_MODE
# bool "New MBSSID MODE"
# depends on MT_AP_SUPPORT && MBSS_SUPPORT
# depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 || RALINK_MT7620
# default y
#config ENHANCE_NEW_MBSSID_MODE
# bool "Enhanced MBSSID mode"
# depends on NEW_MBSSID_MODE
# default y
config MTK_APCLI_SUPPORT
bool "AP-Client Support"
depends on MTK_MT_AP_SUPPORT
default y
config MTK_APCLI_CERT_SUPPORT
bool "AP-Client TGn Cert Support"
depends on MTK_MT_AP_SUPPORT
depends on MTK_APCLI_SUPPORT
default n
config MTK_MAC_REPEATER_SUPPORT
bool "MAC Repeater Support"
depends on MTK_MT_AP_SUPPORT
depends on MTK_APCLI_SUPPORT
depends on MTK_RALINK_RT6352 || MTK_RALINK_MT7620 || MTK_RALINK_MT7603E || MTK_MT_AP_SUPPORT
default y
config MTK_MWDS
bool "Mixed WDS(MWDS)"
depends on MTK_MT_AP_SUPPORT
select MTK_APCLI_SUPPORT
default n
config MTK_MUMIMO_SUPPORT
bool "MU-MIMO Support"
depends on MTK_WIFI_DRIVER
select MTK_MU_RA_SUPPORT
default y
config MTK_MU_RA_SUPPORT
bool "MU-RGA Support"
depends on MTK_MUMIMO_SUPPORT
config MTK_DOT11R_FT_SUPPORT
bool "802.11r Fast BSS Transition"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_DOT11K_RRM_SUPPORT
bool "802.11k Radio Resource Management"
depends on MTK_MT_AP_SUPPORT
default n
#config SNIFFER_SUPPORT
# bool "SNIFFER"
# depends on MT_AP_SUPPORT
# default n
config MTK_CFG80211_SUPPORT
bool "CFG80211"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_DSCP_PRI_SUPPORT
bool "Dscp Priority Mapping Support"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_CON_WPS_SUPPORT
bool "Concurrent WPS Support"
depends on MTK_MT_AP_SUPPORT
depends on MTK_APCLI_SUPPORT
depends on MTK_WSC_INCLUDED
depends on MTK_WSC_V2_SUPPORT
# depends on MTK_MULTI_INF_SUPPORT
default n
#config LLTD_SUPPORT
# bool "LLTD (Link Layer Topology Discovery Protocol)"
# depends on MT_AP_SUPPORT
#config COC_SUPPORT
# bool "CoC Support"
# depends on MT_AP_SUPPORT
# default n
#config RT2860V2_SNMP
# bool "Net-SNMP Support"
# depends on MT_AP_SUPPORT
config MTK_MCAST_RATE_SPECIFIC
bool "User specific tx rate of mcast pkt"
depends on MTK_MT_AP_SUPPORT
default y
#config EXT_BUILD_CHANNEL_LIST
# bool "Extension Channel List"
# depends on MT_AP_SUPPORT
#config AUTO_CH_SELECT_ENHANCE
# bool "Auto Channel Selection Enhancement"
# depends on MT_AP_SUPPORT
config MTK_VOW_SUPPORT
bool "MediaAir(VOW) support"
depends on MTK_MT_AP_SUPPORT
default y
#config AIRPLAY_SUPPORT
# bool "AIRPLAY Support"
# depends on MT_AP_SUPPORT
# default n
config MTK_BAND_STEERING
bool "Band Steering"
depends on MTK_MT_AP_SUPPORT
default y
config MTK_LED_CONTROL_SUPPORT
bool "LED Control Support"
default n
config MTK_WLAN_HOOK
bool "WLAN hook Support"
depends on MTK_WIFI_DRIVER
default n
config MTK_RADIUS_ACCOUNTING_SUPPORT
bool "Radius Accounting Support"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_GREENAP_SUPPORT
bool "GreenAP Support"
depends on MTK_MT_AP_SUPPORT
default y
config MTK_PCIE_ASPM_DYM_CTRL_SUPPORT
bool "Pcie Aspm Dynamic Control Support"
depends on MTK_MT_AP_SUPPORT
default y
config MTK_COEX_SUPPORT
bool "Coex Support"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_EASY_SETUP_SUPPORT
bool "Whole Home Coverage - Easy Setup"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_EVENT_NOTIFIER_SUPPORT
bool "Whole Home Coverage - Event Notifier"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_AIR_MONITOR
bool "Air Monitor"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_WNM_SUPPORT
bool "802.11v WNM Support"
depends on MTK_MT_AP_SUPPORT
default n
config MTK_INTERWORKING
bool "802.11u Interworking"
depends on MTK_MT_AP_SUPPORT
default n
#config ROAMING_ENHANCE_SUPPORT
# bool "Roaming Enhance Support"
# depends on MT_AP_SUPPORT
# depends on APCLI_SUPPORT
# default n
config MTK_LINUX_NET_TXQ_SUPPORT
bool "NET TX Queue Support"
default n
#config WIFI_FWD_SUPPORT
# bool "WiFi Forwarding Support"
# default n
endmenu
endif
config MTK_WIFI_MT_MAC
bool
default y
depends on MTK_MT_WIFI
if MTK_WIFI_RLT_MAC
config MTK_RLT_MAC
bool
default y
endif
if MTK_WIFI_RTMP_MAC
config MTK_RTMP_MAC
bool
default y
endif
if MTK_WIFI_MT_MAC
config MTK_MT_MAC
bool
default y
config MTK_CHIP_MT7603E
bool
default n
config MTK_CHIP_MT7615E
bool
default n
config MTK_CHIP_MT7622
bool
default n
config MTK_CHIP_MT7663E
bool
default n
config MTK_CHIP_MT7626
bool
default n
endif
if MTK_CHIP_MT7615E || MTK_CHIP_MT7622 || MTK_CHIP_MT7626
config MTK_MT_MAC
bool
default y
select MTK_RATE_ADAPTION
select MTK_RATE_ADAPT_AGBS_SUPPORT
select MTK_DOT11_N_SUPPORT
select MTK_DOT11_VHT_AC
select MTK_HDR_TRANS_TX_SUPPORT
select MTK_HDR_TRANS_RX_SUPPORT
endif
endif #MTK_WIFI_DRIVER#
endif #PACKAGE_kmod-mt_wifi#

View File

@ -1,16 +0,0 @@
#!/bin/sh /etc/rc.common
START=15
STOP=15
USE_PROCD=1
start_service() {
[ -f /etc/hotplug.d/firmware/11-mtk-wifi-e2p ] && sh /etc/hotplug.d/firmware/11-mtk-wifi-e2p
}
stop_service() {
echo 'do nothing' > /dev/null
}

View File

@ -1,375 +0,0 @@
Default
AccessControlList0=
AccessControlList1=
AccessControlList10=
AccessControlList11=
AccessControlList12=
AccessControlList13=
AccessControlList14=
AccessControlList15=
AccessControlList2=
AccessControlList3=
AccessControlList4=
AccessControlList5=
AccessControlList6=
AccessControlList7=
AccessControlList8=
AccessControlList9=
AccessPolicy0=0
AccessPolicy1=0
AccessPolicy10=0
AccessPolicy11=0
AccessPolicy12=0
AccessPolicy13=0
AccessPolicy14=0
AccessPolicy15=0
AccessPolicy2=0
AccessPolicy3=0
AccessPolicy4=0
AccessPolicy5=0
AccessPolicy6=0
AccessPolicy7=0
AccessPolicy8=0
AccessPolicy9=0
AckPolicy=0;0;0;0
APACM=0;0;0;0
APAifsn=3;7;1;1
ApCliAuthMode=
ApCliBssid=
ApCliDefaultKeyID=
ApCliEnable=
ApCliEncrypType=
ApCliKey1Str=
ApCliKey1Str1=
ApCliKey1Type=
ApCliKey2Str=
ApCliKey2Str1=
ApCliKey2Type=
ApCliKey3Str=
ApCliKey3Str1=
ApCliKey3Type=
ApCliKey4Str=
ApCliKey4Str1=
ApCliKey4Type=
ApCliSsid=
ApCliWirelessMode=
ApCliWPAPSK=
ApCliWPAPSK1=
APCwmax=6;10;4;3
APCwmin=4;4;3;2
APSDCapable=1
APTxop=0;0;94;47
AuthMode=OPEN
AutoChannelSelect=0
AutoChannelSkipList=
AutoProvisionEn=0
BandSteering=0
BasicRate=15
BeaconPeriod=100
BFBACKOFFenable=0
BgndScanSkipCh=
BGProtection=0
BndStrgBssIdx=
BSSACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmax=10;10;4;3
BSSCwmin=4;4;3;2
BssidNum=1
BSSTxop=0;0;94;47
BW_Enable=0
BW_Guarantee_Rate=
BW_Maximum_Rate=
BW_Priority=
BW_Root=0
CalCacheApply=0
CarrierDetect=0
Channel=6
ChannelGrp=
CountryCode=US
CountryRegion=5
CountryRegionABand=7
CP_SUPPORT=2
CSPeriod=6
DBDC_MODE=1
DebugFlags=0
DefaultKeyID=1
DfsCalibration=0
DfsEnable=0
DfsFalseAlarmPrevent=1
DfsZeroWait=0
DfsZeroWaitCacTime=255
DisableOLBC=0
DtimPeriod=1
E2pAccessMode=2
EAPifname=br0
EDCCAEnable=1
EncrypType=NONE
EthConvertMode=dongle
EtherTrafficBand=0
Ethifname=
ETxBfEnCond=1
FineAGC=0
FixedTxMode=
ForceRoamSupport=
FragThreshold=2346
FreqDelta=0
FtSupport=0
GreenAP=1
G_BAND_256QAM=1
HideSSID=0
HT_AMSDU=1
HT_AutoBA=1
HT_BADecline=0
HT_BAWinSize=64
HT_BSSCoexistence=1
HT_BW=1
HT_DisallowTKIP=1
HT_EXTCHA=1
HT_GI=1
HT_HTC=1
HT_LDPC=1
HT_LinkAdapt=0
HT_MCS=33
HT_MpduDensity=5
HT_OpMode=0
HT_PROTECT=1
HT_RxStream=2
HT_STBC=1
HT_TxStream=2
IcapMode=0
idle_timeout_interval=0
IEEE80211H=1
IEEE8021X=0
IgmpSnEnable=0
ITxBfEn=1
Key1Str=
Key1Str1=
Key1Str10=
Key1Str11=
Key1Str12=
Key1Str13=
Key1Str14=
Key1Str15=
Key1Str16=
Key1Str2=
Key1Str3=
Key1Str4=
Key1Str5=
Key1Str6=
Key1Str7=
Key1Str8=
Key1Str9=
Key1Type=0
Key2Str=
Key2Str1=
Key2Str10=
Key2Str11=
Key2Str12=
Key2Str13=
Key2Str14=
Key2Str15=
Key2Str16=
Key2Str2=
Key2Str3=
Key2Str4=
Key2Str5=
Key2Str6=
Key2Str7=
Key2Str8=
Key2Str9=
Key2Type=0
Key3Str=
Key3Str1=
Key3Str10=
Key3Str11=
Key3Str12=
Key3Str13=
Key3Str14=
Key3Str15=
Key3Str16=
Key3Str2=
Key3Str3=
Key3Str4=
Key3Str5=
Key3Str6=
Key3Str7=
Key3Str8=
Key3Str9=
Key3Type=0
Key4Str=
Key4Str1=
Key4Str10=
Key4Str11=
Key4Str12=
Key4Str13=
Key4Str14=
Key4Str15=
Key4Str16=
Key4Str2=
Key4Str3=
Key4Str4=
Key4Str5=
Key4Str6=
Key4Str7=
Key4Str8=
Key4Str9=
Key4Type=0
LinkTestSupport=0
MACRepeaterEn=
MACRepeaterOuiMode=2
MUTxRxEnable=0
NoForwarding=0
NoForwardingBTNBSSID=0
own_ip_addr=10.10.10.254
PcieAspm=0
PERCENTAGEenable=0
PhyRateLimit=0
PMFMFPC=1
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=10
PowerUpCckOfdm=0:0:0:0:0:0:0
PowerUpHT20=0:0:0:0:0:0:0
PowerUpHT40=0:0:0:0:0:0:0
PowerUpVHT160=0:0:0:0:0:0:0
PowerUpVHT20=0:0:0:0:0:0:0
PowerUpVHT40=0:0:0:0:0:0:0
PowerUpVHT80=0:0:0:0:0:0:0
PreAntSwitch=
PreAuth=0
PreAuthifname=br0
RadioLinkSelection=0
RadioOn=1
RADIUS_Acct_Key=
RADIUS_Acct_Port=1813
RADIUS_Acct_Server=
RADIUS_Key1=
RADIUS_Key10=
RADIUS_Key11=
RADIUS_Key12=
RADIUS_Key13=
RADIUS_Key14=
RADIUS_Key15=
RADIUS_Key16=
RADIUS_Key2=
RADIUS_Key3=
RADIUS_Key4=
RADIUS_Key5=
RADIUS_Key6=
RADIUS_Key7=
RADIUS_Key8=
RADIUS_Key9=
RADIUS_Port=1812
RADIUS_Server=0
RDRegion=
RED_Enable=1
RekeyInterval=3600
RekeyMethod=DISABLE
RRMEnable=0
RTSThreshold=2347
session_timeout_interval=0
ShortSlot=1
SKUenable=0
SSID=
SSID1=K2P_2G
SSID10=
SSID11=
SSID12=
SSID13=
SSID14=
SSID15=
SSID16=
SSID2=
SSID3=
SSID4=
SSID5=
SSID6=
SSID7=
SSID8=
SSID9=
StationKeepAlive=0
StreamMode=0
StreamModeMac0=
StreamModeMac1=
StreamModeMac2=
StreamModeMac3=
TGnWifiTest=0
ThermalRecal=0
TxBurst=1
TxPower=100
TxPreamble=1
VHT_BW=1
VHT_BW_SIGNAL=0
VHT_LDPC=1
VHT_Sec80_Channel=0
VHT_SGI=1
VHT_STBC=1
VLANID=0
VLANPriority=0
VLANTag=0
VOW_Airtime_Ctrl_En=
VOW_Airtime_Fairness_En=1
VOW_BW_Ctrl=0
VOW_Group_Backlog=
VOW_Group_DWRR_Max_Wait_Time=
VOW_Group_DWRR_Quantum=
VOW_Group_Max_Airtime_Bucket_Size=
VOW_Group_Max_Rate=
VOW_Group_Max_Rate_Bucket_Size=
VOW_Group_Max_Ratio=
VOW_Group_Max_Wait_Time=
VOW_Group_Min_Airtime_Bucket_Size=
VOW_Group_Min_Rate=
VOW_Group_Min_Rate_Bucket_Size=
VOW_Group_Min_Ratio=
VOW_Rate_Ctrl_En=
VOW_Refill_Period=
VOW_RX_En=1
VOW_Sta_BE_DWRR_Quantum=
VOW_Sta_BK_DWRR_Quantum=
VOW_Sta_DWRR_Max_Wait_Time=
VOW_Sta_VI_DWRR_Quantum=
VOW_Sta_VO_DWRR_Quantum=
VOW_WATF_Enable=
VOW_WATF_MAC_LV0=
VOW_WATF_MAC_LV1=
VOW_WATF_MAC_LV2=
VOW_WATF_MAC_LV3=
VOW_WATF_Q_LV0=
VOW_WATF_Q_LV1=
VOW_WATF_Q_LV2=
VOW_WATF_Q_LV3=
VOW_WMM_Search_Rule_Band0=
VOW_WMM_Search_Rule_Band1=
WCNTest=0
Wds0Key=
Wds1Key=
Wds2Key=
Wds3Key=
WdsEnable=0
WdsEncrypType=NONE
WdsList=
WdsPhyMode=0
WHNAT=0
WiFiTest=0
WirelessMode=9
WmmCapable=1
WPAPSK=
WPAPSK1=12345678
WPAPSK10=
WPAPSK11=
WPAPSK12=
WPAPSK13=
WPAPSK14=
WPAPSK15=
WPAPSK16=
WPAPSK2=
WPAPSK3=
WPAPSK4=
WPAPSK5=
WPAPSK6=
WPAPSK7=
WPAPSK8=
WPAPSK9=
WscConfMode=0
WscConfStatus=2

View File

@ -1,375 +0,0 @@
Default
AccessControlList0=
AccessControlList1=
AccessControlList10=
AccessControlList11=
AccessControlList12=
AccessControlList13=
AccessControlList14=
AccessControlList15=
AccessControlList2=
AccessControlList3=
AccessControlList4=
AccessControlList5=
AccessControlList6=
AccessControlList7=
AccessControlList8=
AccessControlList9=
AccessPolicy0=0
AccessPolicy1=0
AccessPolicy10=0
AccessPolicy11=0
AccessPolicy12=0
AccessPolicy13=0
AccessPolicy14=0
AccessPolicy15=0
AccessPolicy2=0
AccessPolicy3=0
AccessPolicy4=0
AccessPolicy5=0
AccessPolicy6=0
AccessPolicy7=0
AccessPolicy8=0
AccessPolicy9=0
AckPolicy=0;0;0;0
APACM=0;0;0;0
APAifsn=3;7;1;1
ApCliAuthMode=
ApCliBssid=
ApCliDefaultKeyID=
ApCliEnable=
ApCliEncrypType=
ApCliKey1Str=
ApCliKey1Str1=
ApCliKey1Type=
ApCliKey2Str=
ApCliKey2Str1=
ApCliKey2Type=
ApCliKey3Str=
ApCliKey3Str1=
ApCliKey3Type=
ApCliKey4Str=
ApCliKey4Str1=
ApCliKey4Type=
ApCliSsid=
ApCliWirelessMode=
ApCliWPAPSK=
ApCliWPAPSK1=
APCwmax=6;10;4;3
APCwmin=4;4;3;2
APSDCapable=1
APTxop=0;0;94;47
AuthMode=OPEN
AutoChannelSelect=0
AutoChannelSkipList=
AutoProvisionEn=0
BandSteering=0
BasicRate=15
BeaconPeriod=100
BFBACKOFFenable=0
BgndScanSkipCh=
BGProtection=0
BndStrgBssIdx=
BSSACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmax=10;10;4;3
BSSCwmin=4;4;3;2
BssidNum=1
BSSTxop=0;0;94;47
BW_Enable=0
BW_Guarantee_Rate=
BW_Maximum_Rate=
BW_Priority=
BW_Root=0
CalCacheApply=0
CarrierDetect=0
Channel=36
ChannelGrp=
CountryCode=US
CountryRegion=5
CountryRegionABand=7
CP_SUPPORT=2
CSPeriod=6
DBDC_MODE=1
DebugFlags=0
DefaultKeyID=1
DfsCalibration=0
DfsEnable=1
DfsFalseAlarmPrevent=1
DfsZeroWait=0
DfsZeroWaitCacTime=255
DisableOLBC=0
DtimPeriod=1
E2pAccessMode=2
EAPifname=br0
EDCCAEnable=1
EncrypType=NONE
EthConvertMode=dongle
EtherTrafficBand=0
Ethifname=
ETxBfEnCond=1
FineAGC=0
FixedTxMode=
ForceRoamSupport=
FragThreshold=2346
FreqDelta=0
FtSupport=0
GreenAP=1
G_BAND_256QAM=1
HideSSID=0
HT_AMSDU=1
HT_AutoBA=1
HT_BADecline=0
HT_BAWinSize=64
HT_BSSCoexistence=1
HT_BW=1
HT_DisallowTKIP=1
HT_EXTCHA=1
HT_GI=1
HT_HTC=1
HT_LDPC=1
HT_LinkAdapt=0
HT_MCS=33
HT_MpduDensity=5
HT_OpMode=0
HT_PROTECT=1
HT_RxStream=2
HT_STBC=1
HT_TxStream=2
IcapMode=0
idle_timeout_interval=0
IEEE80211H=1
IEEE8021X=0
IgmpSnEnable=0
ITxBfEn=1
Key1Str=
Key1Str1=
Key1Str10=
Key1Str11=
Key1Str12=
Key1Str13=
Key1Str14=
Key1Str15=
Key1Str16=
Key1Str2=
Key1Str3=
Key1Str4=
Key1Str5=
Key1Str6=
Key1Str7=
Key1Str8=
Key1Str9=
Key1Type=0
Key2Str=
Key2Str1=
Key2Str10=
Key2Str11=
Key2Str12=
Key2Str13=
Key2Str14=
Key2Str15=
Key2Str16=
Key2Str2=
Key2Str3=
Key2Str4=
Key2Str5=
Key2Str6=
Key2Str7=
Key2Str8=
Key2Str9=
Key2Type=0
Key3Str=
Key3Str1=
Key3Str10=
Key3Str11=
Key3Str12=
Key3Str13=
Key3Str14=
Key3Str15=
Key3Str16=
Key3Str2=
Key3Str3=
Key3Str4=
Key3Str5=
Key3Str6=
Key3Str7=
Key3Str8=
Key3Str9=
Key3Type=0
Key4Str=
Key4Str1=
Key4Str10=
Key4Str11=
Key4Str12=
Key4Str13=
Key4Str14=
Key4Str15=
Key4Str16=
Key4Str2=
Key4Str3=
Key4Str4=
Key4Str5=
Key4Str6=
Key4Str7=
Key4Str8=
Key4Str9=
Key4Type=0
LinkTestSupport=0
MACRepeaterEn=
MACRepeaterOuiMode=2
MUTxRxEnable=1
NoForwarding=0
NoForwardingBTNBSSID=0
own_ip_addr=10.10.10.254
PcieAspm=0
PERCENTAGEenable=0
PhyRateLimit=0
PMFMFPC=1
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=10
PowerUpCckOfdm=0:0:0:0:0:0:0
PowerUpHT20=0:0:0:0:0:0:0
PowerUpHT40=0:0:0:0:0:0:0
PowerUpVHT160=0:0:0:0:0:0:0
PowerUpVHT20=0:0:0:0:0:0:0
PowerUpVHT40=0:0:0:0:0:0:0
PowerUpVHT80=0:0:0:0:0:0:0
PreAntSwitch=
PreAuth=0
PreAuthifname=br0
RadioLinkSelection=0
RadioOn=1
RADIUS_Acct_Key=
RADIUS_Acct_Port=1813
RADIUS_Acct_Server=
RADIUS_Key1=
RADIUS_Key10=
RADIUS_Key11=
RADIUS_Key12=
RADIUS_Key13=
RADIUS_Key14=
RADIUS_Key15=
RADIUS_Key16=
RADIUS_Key2=
RADIUS_Key3=
RADIUS_Key4=
RADIUS_Key5=
RADIUS_Key6=
RADIUS_Key7=
RADIUS_Key8=
RADIUS_Key9=
RADIUS_Port=1812
RADIUS_Server=0
RDRegion=
RED_Enable=1
RekeyInterval=3600
RekeyMethod=DISABLE
RRMEnable=0
RTSThreshold=2347
session_timeout_interval=0
ShortSlot=1
SKUenable=0
SSID=
SSID1=K2P_5G
SSID10=
SSID11=
SSID12=
SSID13=
SSID14=
SSID15=
SSID16=
SSID2=
SSID3=
SSID4=
SSID5=
SSID6=
SSID7=
SSID8=
SSID9=
StationKeepAlive=0
StreamMode=0
StreamModeMac0=
StreamModeMac1=
StreamModeMac2=
StreamModeMac3=
TGnWifiTest=0
ThermalRecal=0
TxBurst=1
TxPower=100
TxPreamble=1
VHT_BW=1
VHT_BW_SIGNAL=0
VHT_LDPC=1
VHT_Sec80_Channel=0
VHT_SGI=1
VHT_STBC=1
VLANID=0
VLANPriority=0
VLANTag=0
VOW_Airtime_Ctrl_En=
VOW_Airtime_Fairness_En=1
VOW_BW_Ctrl=0
VOW_Group_Backlog=
VOW_Group_DWRR_Max_Wait_Time=
VOW_Group_DWRR_Quantum=
VOW_Group_Max_Airtime_Bucket_Size=
VOW_Group_Max_Rate=
VOW_Group_Max_Rate_Bucket_Size=
VOW_Group_Max_Ratio=
VOW_Group_Max_Wait_Time=
VOW_Group_Min_Airtime_Bucket_Size=
VOW_Group_Min_Rate=
VOW_Group_Min_Rate_Bucket_Size=
VOW_Group_Min_Ratio=
VOW_Rate_Ctrl_En=
VOW_Refill_Period=
VOW_RX_En=1
VOW_Sta_BE_DWRR_Quantum=
VOW_Sta_BK_DWRR_Quantum=
VOW_Sta_DWRR_Max_Wait_Time=
VOW_Sta_VI_DWRR_Quantum=
VOW_Sta_VO_DWRR_Quantum=
VOW_WATF_Enable=
VOW_WATF_MAC_LV0=
VOW_WATF_MAC_LV1=
VOW_WATF_MAC_LV2=
VOW_WATF_MAC_LV3=
VOW_WATF_Q_LV0=
VOW_WATF_Q_LV1=
VOW_WATF_Q_LV2=
VOW_WATF_Q_LV3=
VOW_WMM_Search_Rule_Band0=
VOW_WMM_Search_Rule_Band1=
WCNTest=0
Wds0Key=
Wds1Key=
Wds2Key=
Wds3Key=
WdsEnable=0
WdsEncrypType=NONE
WdsList=
WdsPhyMode=0
WHNAT=0
WiFiTest=0
WirelessMode=14
WmmCapable=1
WPAPSK=
WPAPSK1=12345678
WPAPSK10=
WPAPSK11=
WPAPSK12=
WPAPSK13=
WPAPSK14=
WPAPSK15=
WPAPSK16=
WPAPSK2=
WPAPSK3=
WPAPSK4=
WPAPSK5=
WPAPSK6=
WPAPSK7=
WPAPSK8=
WPAPSK9=
WscConfMode=0
WscConfStatus=2

View File

@ -1,65 +0,0 @@
# Single SKU Max Power Table | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
# 2.4G Channel |CCK | | | |OFDM | | | | | | | |VHT20 | | | | | | | | | |VHT40 | | | | | | | | | |Txstream_Delta | | | | | | | | | | | | | | | | | | | | |
Band: 2.4G |CCK_1M |CCK_2M |CCK_5.5M |CCK_11M |OFDM_6M |OFDM_9M |OFDM_12M |OFDM_18M |OFDM_24M |OFDM_36M |OFDM_48M |OFDM_54M |VHT20_MCS0 |VHT20_MCS1 |VHT20_MCS2 |VHT20_MCS3 |VHT20_MCS4 |VHT20_MCS5 |VHT20_MCS6 |VHT20_MCS7 |VHT20_MCS8 |VHT20_MCS9 |VHT40_MCS0 |VHT40_MCS1 |VHT40_MCS2 |VHT40_MCS3 |VHT40_MCS4 |VHT40_MCS5 |VHT40_MCS6 |VHT40_MCS7 |VHT40_MCS8 |VHT40_MCS9 |Txstream_3T |Txstream_2T |Txstream_1T | | | | | | | | | | | | | | | | | | |
Ch1 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |20 |12 |18 |16 |8 | |8 | |8 | |9 |11 |12 |2 |1 |3 | | | | | | | | | | | | | | | | | | |
Ch2 |8 | |8 | |8 | |8 | |8 | |8 |8 |15 |8 | |8 | |8 | |19 |19 |10 |12 |8 | |8 | |8 | |9 |16 |12 |5 |4 |0 | | | | | | | | | | | | | | | | | | |
Ch3 |8 | |8 | |8 | |8 | |8 | |8 |8 |18 |8 | |8 | |8 | |17 |18 |16 |20 |8 | |8 | |8 | |12 |8 |20 |0 |2 |0 | | | | | | | | | | | | | | | | | | |
Ch4 |8 | |8 | |8 | |8 | |8 | |8 |8 |9 |8 | |8 | |8 | |14 |10 |14 |18 |8 | |8 | |8 | |14 |12 |10 |3 |4 |5 | | | | | | | | | | | | | | | | | | |
Ch5 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |10 |13 |11 |8 |8 | |8 | |8 | |12 |8 |9 |4 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch6 |8 | |8 | |8 | |8 | |8 | |8 |8 |13 |8 | |8 | |8 | |11 |9 |12 |16 |8 | |8 | |8 | |9 |17 |11 |5 |2 |1 | | | | | | | | | | | | | | | | | | |
Ch7 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |14 |11 |13 |18 |8 | |8 | |8 | |16 |13 |10 |2 |5 |4 | | | | | | | | | | | | | | | | | | |
Ch8 |8 | |8 | |8 | |8 | |8 | |8 |8 |15 |8 | |8 | |8 | |14 |9 |11 |10 |8 | |8 | |8 | |11 |14 |8 |5 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch9 |8 | |8 | |8 | |8 | |8 | |8 |8 |11 |8 | |8 | |8 | |12 |9 |15 |19 |8 | |8 | |8 | |14 |20 |12 |2 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch10 |8 | |8 | |8 | |8 | |8 | |8 |8 |14 |8 | |8 | |8 | |17 |14 |17 |15 |8 | |8 | |8 | |9 |17 |8 |2 |4 |2 | | | | | | | | | | | | | | | | | | |
Ch11 |8 | |8 | |8 | |8 | |8 | |8 |8 |14 |8 | |8 | |8 | |20 |10 |20 |18 |8 | |8 | |8 | |12 |8 |20 |3 |1 |4 | | | | | | | | | | | | | | | | | | |
Ch12 |8 | |8 | |8 | |8 | |8 | |8 |8 |18 |8 | |8 | |8 | |20 |16 |17 |9 |8 | |8 | |8 | |11 |20 |9 |0 |0 |1 | | | | | | | | | | | | | | | | | | |
Ch13 |8 | |8 | |8 | |8 | |8 | |8 |8 |8 |8 | |8 | |8 | |11 |16 |19 |16 |8 | |8 | |8 | |15 |12 |12 |2 |0 |2 | | | | | | | | | | | | | | | | | | |
Ch14 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |15 |17 |16 |14 |8 | |8 | |8 | |12 |14 |20 |4 |1 |5 | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
# 5G Channel |OFDM | | | | | | | |VHT20 | | | | | | | | | |VHT40 | | | | | | | | | |VHT80 | | | | | | | | | |VHT160 | | | | | | | | | |Txstream_Delta | | | | |
Band: 5G |OFDM_6M |OFDM_9M |OFDM_12M |OFDM_18M |OFDM_24M |OFDM_36M |OFDM_48M |OFDM_54M |VHT20_MCS0 |VHT20_MCS1 |VHT20_MCS2 |VHT20_MCS3 |VHT20_MCS4 |VHT20_MCS5 |VHT20_MCS6 |VHT20_MCS7 |VHT20_MCS8 |VHT20_MCS9 |VHT40_MCS0 |VHT40_MCS1 |VHT40_MCS2 |VHT40_MCS3 |VHT40_MCS4 |VHT40_MCS5 |VHT40_MCS6 |VHT40_MCS7 |VHT40_MCS8 |VHT40_MCS9 |VHT80_MCS0 |VHT80_MCS1 |VHT80_MCS2 |VHT80_MCS3 |VHT80_MCS4 |VHT80_MCS5 |VHT80_MCS6 |VHT80_MCS7 |VHT80_MCS8 |VHT80_MCS9 |VHT160_MCS0 |VHT160_MCS1 |VHT160_MCS2 |VHT160_MCS3 |VHT160_MCS4 |VHT160_MCS5 |VHT160_MCS6 |VHT160_MCS7 |VHT160_MCS8 |VHT160_MCS9 |Txstream_3T |Txstream_2T |Txstream_1T | | |
Ch184 |18 | |18 | |18 | |18 |18 |15 |18 | |12 | |13 | |11 |14 |16 |16 |12 | |12 | |13 | |20 |17 |16 |17 |18 | |9 | |16 | |17 |20 |18 |16 |19 | |15 | |9 | |17 |8 |17 |0 |4 |4 | | |
Ch188 |18 | |18 | |18 | |18 |18 |16 |20 | |9 | |9 | |11 |8 |12 |18 |15 | |11 | |11 | |14 |8 |17 |16 |16 | |16 | |12 | |8 |13 |19 |18 |11 | |9 | |12 | |14 |8 |13 |5 |2 |0 | | |
Ch192 |18 | |18 | |18 | |18 |18 |15 |9 | |11 | |9 | |15 |14 |11 |19 |15 | |8 | |18 | |20 |20 |8 |9 |9 | |9 | |11 | |18 |13 |14 |20 |18 | |10 | |14 | |12 |13 |16 |0 |2 |0 | | |
Ch196 |18 | |18 | |18 | |18 |18 |10 |11 | |19 | |13 | |12 |11 |10 |13 |11 | |19 | |10 | |16 |20 |15 |15 |8 | |14 | |8 | |18 |20 |15 |17 |17 | |14 | |12 | |12 |8 |16 |4 |3 |2 | | |
Ch8 |18 | |18 | |18 | |18 |18 |18 |13 | |19 | |20 | |18 |10 |9 |8 |8 | |17 | |15 | |17 |9 |18 |19 |11 | |12 | |15 | |20 |12 |12 |13 |9 | |9 | |15 | |10 |11 |17 |4 |3 |3 | | |
Ch12 |18 | |18 | |18 | |18 |18 |17 |20 | |14 | |10 | |10 |16 |15 |13 |11 | |15 | |16 | |17 |11 |15 |9 |18 | |8 | |20 | |19 |11 |9 |20 |8 | |18 | |8 | |8 |18 |18 |1 |3 |4 | | |
Ch16 |18 | |18 | |18 | |18 |18 |10 |18 | |18 | |8 | |19 |8 |12 |19 |16 | |19 | |18 | |16 |19 |12 |18 |18 | |9 | |10 | |18 |20 |20 |20 |9 | |11 | |20 | |17 |14 |16 |2 |2 |2 | | |
Ch36 |18 | |18 | |18 | |18 |18 |18 |19 | |8 | |11 | |16 |10 |9 |19 |11 | |19 | |9 | |8 |19 |8 |11 |17 | |20 | |14 | |9 |19 |19 |20 |13 | |12 | |19 | |13 |17 |9 |5 |1 |2 | | |
Ch40 |18 | |18 | |18 | |18 |18 |13 |20 | |13 | |19 | |16 |11 |14 |17 |17 | |14 | |8 | |13 |8 |10 |20 |10 | |9 | |14 | |11 |14 |17 |9 |20 | |15 | |19 | |9 |8 |11 |3 |1 |1 | | |
Ch44 |18 | |18 | |18 | |18 |18 |10 |14 | |19 | |20 | |17 |16 |12 |18 |8 | |17 | |18 | |15 |19 |14 |11 |13 | |14 | |12 | |16 |16 |19 |13 |14 | |19 | |14 | |20 |20 |11 |5 |1 |0 | | |
Ch48 |18 | |18 | |18 | |18 |18 |8 |12 | |12 | |19 | |11 |8 |11 |20 |12 | |12 | |11 | |15 |16 |10 |12 |16 | |11 | |15 | |18 |19 |17 |16 |17 | |11 | |8 | |10 |16 |16 |5 |5 |0 | | |
Ch52 |18 | |18 | |18 | |18 |18 |15 |12 | |15 | |20 | |9 |10 |10 |14 |8 | |20 | |10 | |16 |17 |18 |11 |16 | |17 | |10 | |17 |12 |13 |17 |17 | |13 | |18 | |18 |20 |13 |4 |3 |4 | | |
Ch56 |18 | |18 | |18 | |18 |18 |13 |16 | |15 | |13 | |15 |20 |13 |14 |11 | |10 | |20 | |10 |8 |16 |12 |10 | |16 | |11 | |9 |11 |14 |17 |12 | |17 | |13 | |18 |10 |19 |0 |3 |3 | | |
Ch60 |18 | |18 | |18 | |18 |18 |14 |11 | |8 | |20 | |13 |16 |13 |11 |20 | |9 | |17 | |16 |11 |8 |12 |17 | |15 | |8 | |16 |10 |20 |19 |15 | |13 | |9 | |17 |18 |11 |4 |1 |2 | | |
Ch64 |18 | |18 | |18 | |18 |18 |13 |14 | |8 | |12 | |17 |8 |12 |18 |17 | |17 | |14 | |18 |8 |8 |20 |17 | |16 | |20 | |9 |15 |11 |10 |11 | |18 | |10 | |10 |15 |19 |2 |1 |4 | | |
Ch68 |18 | |18 | |18 | |18 |18 |14 |19 | |17 | |9 | |18 |19 |20 |12 |14 | |8 | |14 | |20 |20 |18 |9 |18 | |11 | |19 | |19 |10 |11 |8 |18 | |9 | |8 | |16 |11 |8 |3 |3 |1 | | |
Ch72 |18 | |18 | |18 | |18 |18 |19 |13 | |20 | |11 | |16 |9 |19 |20 |19 | |14 | |8 | |9 |17 |13 |19 |15 | |8 | |9 | |19 |14 |19 |15 |18 | |16 | |12 | |13 |15 |10 |4 |3 |1 | | |
Ch76 |18 | |18 | |18 | |18 |18 |17 |13 | |16 | |20 | |16 |8 |9 |20 |11 | |17 | |11 | |8 |18 |9 |20 |9 | |17 | |16 | |11 |11 |11 |18 |10 | |13 | |W | |20 |17 |8 |1 |3 |3 | | |
Ch80 |18 | |18 | |18 | |18 |18 |14 |20 | |13 | |13 | |17 |8 |10 |16 |8 | |9 | |19 | |16 |17 |17 |19 |15 | |9 | |13 | |16 |13 |14 |12 |9 | |20 | |20 | |14 |18 |18 |0 |4 |2 | | |
Ch84 |18 | |18 | |18 | |18 |18 |11 |18 | |20 | |9 | |13 |14 |11 |16 |15 | |12 | |11 | |9 |19 |13 |11 |11 | |9 | |15 | |16 |18 |13 |12 |8 | |8 | |8 | |10 |12 |15 |3 |2 |5 | | |
Ch88 |18 | |18 | |18 | |18 |18 |18 |19 | |9 | |17 | |15 |8 |19 |11 |11 | |14 | |9 | |14 |20 |20 |11 |11 | |15 | |12 | |14 |11 |8 |18 |15 | |19 | |18 | |12 |20 |16 |5 |5 |1 | | |
Ch92 |18 | |18 | |18 | |18 |18 |11 |8 | |15 | |13 | |13 |13 |13 |16 |14 | |14 | |9 | |9 |15 |20 |11 |17 | |10 | |14 | |13 |17 |11 |8 |18 | |20 | |8 | |10 |19 |18 |1 |4 |4 | | |
Ch96 |18 | |18 | |18 | |18 |18 |8 |12 | |16 | |9 | |13 |12 |9 |8 |11 | |8 | |8 | |19 |11 |15 |16 |8 | |11 | |16 | |18 |16 |9 |19 |9 | |10 | |15 | |19 |19 |15 |4 |2 |4 | | |
Ch100 |18 | |18 | |18 | |18 |18 |18 |13 | |20 | |20 | |12 |9 |19 |10 |9 | |14 | |8 | |19 |10 |17 |9 |10 | |10 | |8 | |13 |12 |11 |20 |11 | |16 | |18 | |14 |16 |19 |1 |1 |2 | | |
Ch104 |18 | |18 | |18 | |18 |18 |19 |12 | |20 | |14 | |16 |15 |9 |19 |11 | |15 | |11 | |12 |18 |15 |11 |15 | |19 | |10 | |14 |15 |19 |9 |13 | |19 | |13 | |11 |11 |17 |2 |2 |0 | | |
Ch108 |18 | |18 | |18 | |18 |18 |18 |15 | |13 | |16 | |11 |19 |19 |18 |19 | |12 | |17 | |8 |9 |10 |8 |8 | |18 | |8 | |10 |11 |17 |15 |10 | |19 | |13 | |16 |10 |15 |0 |2 |3 | | |
Ch112 |18 | |18 | |18 | |18 |18 |8 |13 | |9 | |17 | |9 |15 |17 |10 |19 | |9 | |19 | |11 |16 |14 |16 |8 | |18 | |13 | |16 |13 |17 |19 |11 | |8 | |8 | |18 |14 |17 |5 |2 |5 | | |
Ch116 |18 | |18 | |18 | |18 |18 |8 |20 | |11 | |15 | |8 |11 |8 |18 |15 | |13 | |17 | |14 |13 |9 |8 |14 | |14 | |11 | |9 |19 |17 |11 |11 | |8 | |20 | |8 |10 |20 |5 |2 |1 | | |
Ch120 |18 | |18 | |18 | |18 |18 |14 |20 | |8 | |20 | |14 |10 |10 |17 |12 | |16 | |20 | |10 |20 |17 |18 |9 | |15 | |14 | |17 |13 |14 |16 |8 | |18 | |10 | |15 |12 |12 |1 |5 |3 | | |
Ch124 |18 | |18 | |18 | |18 |18 |20 |9 | |17 | |12 | |12 |8 |14 |8 |8 | |20 | |17 | |16 |20 |13 |14 |16 | |10 | |14 | |20 |15 |17 |8 |10 | |13 | |13 | |11 |13 |9 |5 |0 |5 | | |
Ch128 |18 | |18 | |18 | |18 |18 |9 |19 | |9 | |14 | |8 |14 |11 |9 |14 | |16 | |15 | |14 |10 |15 |14 |14 | |20 | |10 | |16 |15 |11 |12 |13 | |13 | |13 | |12 |15 |20 |1 |4 |3 | | |
Ch132 |18 | |18 | |18 | |18 |18 |20 |16 | |13 | |8 | |18 |11 |20 |12 |11 | |11 | |14 | |12 |13 |8 |12 |13 | |10 | |20 | |19 |12 |13 |14 |12 | |11 | |19 | |19 |20 |8 |3 |1 |4 | | |
Ch136 |18 | |18 | |18 | |18 |18 |12 |12 | |19 | |10 | |20 |10 |8 |17 |8 | |12 | |10 | |10 |13 |13 |12 |8 | |11 | |18 | |14 |12 |17 |8 |14 | |14 | |9 | |11 |18 |14 |1 |2 |2 | | |
Ch140 |18 | |18 | |18 | |18 |18 |12 |10 | |13 | |9 | |16 |8 |20 |10 |17 | |8 | |15 | |13 |20 |15 |10 |18 | |13 | |12 | |12 |16 |18 |12 |17 | |10 | |16 | |11 |15 |14 |3 |2 |5 | | |
Ch144 |18 | |18 | |18 | |18 |18 |19 |9 | |15 | |8 | |13 |18 |17 |9 |19 | |16 | |11 | |20 |12 |15 |19 |10 | |17 | |15 | |17 |14 |9 |9 |13 | |17 | |16 | |10 |9 |10 |1 |5 |2 | | |
Ch149 |18 | |18 | |18 | |18 |18 |15 |20 | |12 | |19 | |19 |19 |10 |10 |13 | |15 | |19 | |12 |19 |10 |14 |15 | |10 | |15 | |9 |8 |11 |15 |13 | |10 | |16 | |15 |18 |12 |5 |5 |2 | | |
Ch153 |18 | |18 | |18 | |18 |18 |20 |17 | |8 | |19 | |16 |20 |13 |16 |18 | |14 | |11 | |10 |16 |16 |19 |15 | |13 | |17 | |19 |18 |19 |20 |8 | |18 | |9 | |17 |11 |11 |1 |2 |1 | | |
Ch157 |18 | |18 | |18 | |18 |18 |13 |17 | |12 | |19 | |16 |8 |17 |11 |12 | |15 | |14 | |18 |11 |12 |9 |18 | |20 | |13 | |16 |13 |20 |17 |19 | |10 | |12 | |20 |18 |16 |5 |2 |3 | | |
Ch161 |18 | |18 | |18 | |18 |18 |12 |12 | |16 | |12 | |15 |11 |18 |11 |13 | |17 | |19 | |11 |13 |13 |9 |15 | |10 | |10 | |19 |13 |20 |13 |9 | |8 | |8 | |20 |14 |12 |0 |4 |1 | | |
Ch165 |18 | |18 | |18 | |18 |18 |13 |16 | |15 | |13 | |15 |8 |19 |15 |10 | |17 | |13 | |13 |19 |20 |8 |18 | |15 | |20 | |16 |9 |14 |11 |20 | |11 | |19 | |15 |16 |8 |1 |2 |0 | | |
Ch169 |18 | |18 | |18 | |18 |18 |8 |17 | |17 | |13 | |16 |8 |14 |18 |11 | |8 | |18 | |20 |14 |8 |17 |8 | |13 | |18 | |19 |20 |19 |20 |17 | |13 | |20 | |9 |15 |18 |0 |3 |4 | | |
Ch173 |18 | |18 | |18 | |18 |18 |14 |9 | |13 | |12 | |15 |14 |15 |10 |10 | |18 | |16 | |16 |8 |13 |16 |11 | |11 | |13 | |13 |15 |12 |20 |15 | |14 | |13 | |16 |11 |14 |3 |3 |4 | | |
Ch177 |18 | |18 | |18 | |18 |18 |19 |18 | |16 | |10 | |20 |13 |11 |16 |12 | |16 | |18 | |18 |11 |18 |8 |13 | |14 | |11 | |18 |14 |16 |16 |19 | |16 | |13 | |15 |8 |13 |5 |0 |0 | | |
Ch181 |18 | |18 | |18 | |18 |18 |20 |11 | |10 | |9 | |8 |9 |15 |15 |8 | |8 | |12 | |11 |9 |18 |20 |11 | |17 | |11 | |8 |15 |8 |18 |12 | |18 | |16 | |19 |9 |14 |4 |1 |4 | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

View File

@ -1,65 +0,0 @@
# Single SKU Max Power Table | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
# 2.4G Channel |CCK | | | |OFDM | | | | | | | |VHT20 | | | | | | | | | |VHT40 | | | | | | | | | |Txstream_Delta | | | | | | | | | | | | | | | | | | | | |
Band: 2.4G |CCK_1M |CCK_2M |CCK_5.5M |CCK_11M |OFDM_6M |OFDM_9M |OFDM_12M |OFDM_18M |OFDM_24M |OFDM_36M |OFDM_48M |OFDM_54M |VHT20_MCS0 |VHT20_MCS1 |VHT20_MCS2 |VHT20_MCS3 |VHT20_MCS4 |VHT20_MCS5 |VHT20_MCS6 |VHT20_MCS7 |VHT20_MCS8 |VHT20_MCS9 |VHT40_MCS0 |VHT40_MCS1 |VHT40_MCS2 |VHT40_MCS3 |VHT40_MCS4 |VHT40_MCS5 |VHT40_MCS6 |VHT40_MCS7 |VHT40_MCS8 |VHT40_MCS9 |Txstream_3T |Txstream_2T |Txstream_1T | | | | | | | | | | | | | | | | | | |
Ch1 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |20 |12 |18 |16 |8 | |8 | |8 | |9 |11 |12 |2 |1 |3 | | | | | | | | | | | | | | | | | | |
Ch2 |8 | |8 | |8 | |8 | |8 | |8 |8 |15 |8 | |8 | |8 | |19 |19 |10 |12 |8 | |8 | |8 | |9 |16 |12 |5 |4 |0 | | | | | | | | | | | | | | | | | | |
Ch3 |8 | |8 | |8 | |8 | |8 | |8 |8 |18 |8 | |8 | |8 | |17 |18 |16 |20 |8 | |8 | |8 | |12 |8 |20 |0 |2 |0 | | | | | | | | | | | | | | | | | | |
Ch4 |8 | |8 | |8 | |8 | |8 | |8 |8 |9 |8 | |8 | |8 | |14 |10 |14 |18 |8 | |8 | |8 | |14 |12 |10 |3 |4 |5 | | | | | | | | | | | | | | | | | | |
Ch5 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |10 |13 |11 |8 |8 | |8 | |8 | |12 |8 |9 |4 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch6 |8 | |8 | |8 | |8 | |8 | |8 |8 |13 |8 | |8 | |8 | |11 |9 |12 |16 |8 | |8 | |8 | |9 |17 |11 |5 |2 |1 | | | | | | | | | | | | | | | | | | |
Ch7 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |14 |11 |13 |18 |8 | |8 | |8 | |16 |13 |10 |2 |5 |4 | | | | | | | | | | | | | | | | | | |
Ch8 |8 | |8 | |8 | |8 | |8 | |8 |8 |15 |8 | |8 | |8 | |14 |9 |11 |10 |8 | |8 | |8 | |11 |14 |8 |5 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch9 |8 | |8 | |8 | |8 | |8 | |8 |8 |11 |8 | |8 | |8 | |12 |9 |15 |19 |8 | |8 | |8 | |14 |20 |12 |2 |5 |3 | | | | | | | | | | | | | | | | | | |
Ch10 |8 | |8 | |8 | |8 | |8 | |8 |8 |14 |8 | |8 | |8 | |17 |14 |17 |15 |8 | |8 | |8 | |9 |17 |8 |2 |4 |2 | | | | | | | | | | | | | | | | | | |
Ch11 |8 | |8 | |8 | |8 | |8 | |8 |8 |14 |8 | |8 | |8 | |20 |10 |20 |18 |8 | |8 | |8 | |12 |8 |20 |3 |1 |4 | | | | | | | | | | | | | | | | | | |
Ch12 |8 | |8 | |8 | |8 | |8 | |8 |8 |18 |8 | |8 | |8 | |20 |16 |17 |9 |8 | |8 | |8 | |11 |20 |9 |0 |0 |1 | | | | | | | | | | | | | | | | | | |
Ch13 |8 | |8 | |8 | |8 | |8 | |8 |8 |8 |8 | |8 | |8 | |11 |16 |19 |16 |8 | |8 | |8 | |15 |12 |12 |2 |0 |2 | | | | | | | | | | | | | | | | | | |
Ch14 |8 | |8 | |8 | |8 | |8 | |8 |8 |10 |8 | |8 | |8 | |15 |17 |16 |14 |8 | |8 | |8 | |12 |14 |20 |4 |1 |5 | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
# 5G Channel |OFDM | | | | | | | |VHT20 | | | | | | | | | |VHT40 | | | | | | | | | |VHT80 | | | | | | | | | |VHT160 | | | | | | | | | |Txstream_Delta | | | | |
Band: 5G |OFDM_6M |OFDM_9M |OFDM_12M |OFDM_18M |OFDM_24M |OFDM_36M |OFDM_48M |OFDM_54M |VHT20_MCS0 |VHT20_MCS1 |VHT20_MCS2 |VHT20_MCS3 |VHT20_MCS4 |VHT20_MCS5 |VHT20_MCS6 |VHT20_MCS7 |VHT20_MCS8 |VHT20_MCS9 |VHT40_MCS0 |VHT40_MCS1 |VHT40_MCS2 |VHT40_MCS3 |VHT40_MCS4 |VHT40_MCS5 |VHT40_MCS6 |VHT40_MCS7 |VHT40_MCS8 |VHT40_MCS9 |VHT80_MCS0 |VHT80_MCS1 |VHT80_MCS2 |VHT80_MCS3 |VHT80_MCS4 |VHT80_MCS5 |VHT80_MCS6 |VHT80_MCS7 |VHT80_MCS8 |VHT80_MCS9 |VHT160_MCS0 |VHT160_MCS1 |VHT160_MCS2 |VHT160_MCS3 |VHT160_MCS4 |VHT160_MCS5 |VHT160_MCS6 |VHT160_MCS7 |VHT160_MCS8 |VHT160_MCS9 |Txstream_3T |Txstream_2T |Txstream_1T | | |
Ch184 |18 | |18 | |18 | |18 |18 |15 |18 | |12 | |13 | |11 |14 |16 |16 |12 | |12 | |13 | |20 |17 |16 |17 |18 | |9 | |16 | |17 |20 |18 |16 |19 | |15 | |9 | |17 |8 |17 |0 |4 |4 | | |
Ch188 |18 | |18 | |18 | |18 |18 |16 |20 | |9 | |9 | |11 |8 |12 |18 |15 | |11 | |11 | |14 |8 |17 |16 |16 | |16 | |12 | |8 |13 |19 |18 |11 | |9 | |12 | |14 |8 |13 |5 |2 |0 | | |
Ch192 |18 | |18 | |18 | |18 |18 |15 |9 | |11 | |9 | |15 |14 |11 |19 |15 | |8 | |18 | |20 |20 |8 |9 |9 | |9 | |11 | |18 |13 |14 |20 |18 | |10 | |14 | |12 |13 |16 |0 |2 |0 | | |
Ch196 |18 | |18 | |18 | |18 |18 |10 |11 | |19 | |13 | |12 |11 |10 |13 |11 | |19 | |10 | |16 |20 |15 |15 |8 | |14 | |8 | |18 |20 |15 |17 |17 | |14 | |12 | |12 |8 |16 |4 |3 |2 | | |
Ch8 |18 | |18 | |18 | |18 |18 |18 |13 | |19 | |20 | |18 |10 |9 |8 |8 | |17 | |15 | |17 |9 |18 |19 |11 | |12 | |15 | |20 |12 |12 |13 |9 | |9 | |15 | |10 |11 |17 |4 |3 |3 | | |
Ch12 |18 | |18 | |18 | |18 |18 |17 |20 | |14 | |10 | |10 |16 |15 |13 |11 | |15 | |16 | |17 |11 |15 |9 |18 | |8 | |20 | |19 |11 |9 |20 |8 | |18 | |8 | |8 |18 |18 |1 |3 |4 | | |
Ch16 |18 | |18 | |18 | |18 |18 |10 |18 | |18 | |8 | |19 |8 |12 |19 |16 | |19 | |18 | |16 |19 |12 |18 |18 | |9 | |10 | |18 |20 |20 |20 |9 | |11 | |20 | |17 |14 |16 |2 |2 |2 | | |
Ch36 |18 | |18 | |18 | |18 |18 |18 |19 | |8 | |11 | |16 |10 |9 |19 |11 | |19 | |9 | |8 |19 |8 |11 |17 | |20 | |14 | |9 |19 |19 |20 |13 | |12 | |19 | |13 |17 |9 |5 |1 |2 | | |
Ch40 |18 | |18 | |18 | |18 |18 |13 |20 | |13 | |19 | |16 |11 |14 |17 |17 | |14 | |8 | |13 |8 |10 |20 |10 | |9 | |14 | |11 |14 |17 |9 |20 | |15 | |19 | |9 |8 |11 |3 |1 |1 | | |
Ch44 |18 | |18 | |18 | |18 |18 |10 |14 | |19 | |20 | |17 |16 |12 |18 |8 | |17 | |18 | |15 |19 |14 |11 |13 | |14 | |12 | |16 |16 |19 |13 |14 | |19 | |14 | |20 |20 |11 |5 |1 |0 | | |
Ch48 |18 | |18 | |18 | |18 |18 |8 |12 | |12 | |19 | |11 |8 |11 |20 |12 | |12 | |11 | |15 |16 |10 |12 |16 | |11 | |15 | |18 |19 |17 |16 |17 | |11 | |8 | |10 |16 |16 |5 |5 |0 | | |
Ch52 |18 | |18 | |18 | |18 |18 |15 |12 | |15 | |20 | |9 |10 |10 |14 |8 | |20 | |10 | |16 |17 |18 |11 |16 | |17 | |10 | |17 |12 |13 |17 |17 | |13 | |18 | |18 |20 |13 |4 |3 |4 | | |
Ch56 |18 | |18 | |18 | |18 |18 |13 |16 | |15 | |13 | |15 |20 |13 |14 |11 | |10 | |20 | |10 |8 |16 |12 |10 | |16 | |11 | |9 |11 |14 |17 |12 | |17 | |13 | |18 |10 |19 |0 |3 |3 | | |
Ch60 |18 | |18 | |18 | |18 |18 |14 |11 | |8 | |20 | |13 |16 |13 |11 |20 | |9 | |17 | |16 |11 |8 |12 |17 | |15 | |8 | |16 |10 |20 |19 |15 | |13 | |9 | |17 |18 |11 |4 |1 |2 | | |
Ch64 |18 | |18 | |18 | |18 |18 |13 |14 | |8 | |12 | |17 |8 |12 |18 |17 | |17 | |14 | |18 |8 |8 |20 |17 | |16 | |20 | |9 |15 |11 |10 |11 | |18 | |10 | |10 |15 |19 |2 |1 |4 | | |
Ch68 |18 | |18 | |18 | |18 |18 |14 |19 | |17 | |9 | |18 |19 |20 |12 |14 | |8 | |14 | |20 |20 |18 |9 |18 | |11 | |19 | |19 |10 |11 |8 |18 | |9 | |8 | |16 |11 |8 |3 |3 |1 | | |
Ch72 |18 | |18 | |18 | |18 |18 |19 |13 | |20 | |11 | |16 |9 |19 |20 |19 | |14 | |8 | |9 |17 |13 |19 |15 | |8 | |9 | |19 |14 |19 |15 |18 | |16 | |12 | |13 |15 |10 |4 |3 |1 | | |
Ch76 |18 | |18 | |18 | |18 |18 |17 |13 | |16 | |20 | |16 |8 |9 |20 |11 | |17 | |11 | |8 |18 |9 |20 |9 | |17 | |16 | |11 |11 |11 |18 |10 | |13 | |W | |20 |17 |8 |1 |3 |3 | | |
Ch80 |18 | |18 | |18 | |18 |18 |14 |20 | |13 | |13 | |17 |8 |10 |16 |8 | |9 | |19 | |16 |17 |17 |19 |15 | |9 | |13 | |16 |13 |14 |12 |9 | |20 | |20 | |14 |18 |18 |0 |4 |2 | | |
Ch84 |18 | |18 | |18 | |18 |18 |11 |18 | |20 | |9 | |13 |14 |11 |16 |15 | |12 | |11 | |9 |19 |13 |11 |11 | |9 | |15 | |16 |18 |13 |12 |8 | |8 | |8 | |10 |12 |15 |3 |2 |5 | | |
Ch88 |18 | |18 | |18 | |18 |18 |18 |19 | |9 | |17 | |15 |8 |19 |11 |11 | |14 | |9 | |14 |20 |20 |11 |11 | |15 | |12 | |14 |11 |8 |18 |15 | |19 | |18 | |12 |20 |16 |5 |5 |1 | | |
Ch92 |18 | |18 | |18 | |18 |18 |11 |8 | |15 | |13 | |13 |13 |13 |16 |14 | |14 | |9 | |9 |15 |20 |11 |17 | |10 | |14 | |13 |17 |11 |8 |18 | |20 | |8 | |10 |19 |18 |1 |4 |4 | | |
Ch96 |18 | |18 | |18 | |18 |18 |8 |12 | |16 | |9 | |13 |12 |9 |8 |11 | |8 | |8 | |19 |11 |15 |16 |8 | |11 | |16 | |18 |16 |9 |19 |9 | |10 | |15 | |19 |19 |15 |4 |2 |4 | | |
Ch100 |18 | |18 | |18 | |18 |18 |18 |13 | |20 | |20 | |12 |9 |19 |10 |9 | |14 | |8 | |19 |10 |17 |9 |10 | |10 | |8 | |13 |12 |11 |20 |11 | |16 | |18 | |14 |16 |19 |1 |1 |2 | | |
Ch104 |18 | |18 | |18 | |18 |18 |19 |12 | |20 | |14 | |16 |15 |9 |19 |11 | |15 | |11 | |12 |18 |15 |11 |15 | |19 | |10 | |14 |15 |19 |9 |13 | |19 | |13 | |11 |11 |17 |2 |2 |0 | | |
Ch108 |18 | |18 | |18 | |18 |18 |18 |15 | |13 | |16 | |11 |19 |19 |18 |19 | |12 | |17 | |8 |9 |10 |8 |8 | |18 | |8 | |10 |11 |17 |15 |10 | |19 | |13 | |16 |10 |15 |0 |2 |3 | | |
Ch112 |18 | |18 | |18 | |18 |18 |8 |13 | |9 | |17 | |9 |15 |17 |10 |19 | |9 | |19 | |11 |16 |14 |16 |8 | |18 | |13 | |16 |13 |17 |19 |11 | |8 | |8 | |18 |14 |17 |5 |2 |5 | | |
Ch116 |18 | |18 | |18 | |18 |18 |8 |20 | |11 | |15 | |8 |11 |8 |18 |15 | |13 | |17 | |14 |13 |9 |8 |14 | |14 | |11 | |9 |19 |17 |11 |11 | |8 | |20 | |8 |10 |20 |5 |2 |1 | | |
Ch120 |18 | |18 | |18 | |18 |18 |14 |20 | |8 | |20 | |14 |10 |10 |17 |12 | |16 | |20 | |10 |20 |17 |18 |9 | |15 | |14 | |17 |13 |14 |16 |8 | |18 | |10 | |15 |12 |12 |1 |5 |3 | | |
Ch124 |18 | |18 | |18 | |18 |18 |20 |9 | |17 | |12 | |12 |8 |14 |8 |8 | |20 | |17 | |16 |20 |13 |14 |16 | |10 | |14 | |20 |15 |17 |8 |10 | |13 | |13 | |11 |13 |9 |5 |0 |5 | | |
Ch128 |18 | |18 | |18 | |18 |18 |9 |19 | |9 | |14 | |8 |14 |11 |9 |14 | |16 | |15 | |14 |10 |15 |14 |14 | |20 | |10 | |16 |15 |11 |12 |13 | |13 | |13 | |12 |15 |20 |1 |4 |3 | | |
Ch132 |18 | |18 | |18 | |18 |18 |20 |16 | |13 | |8 | |18 |11 |20 |12 |11 | |11 | |14 | |12 |13 |8 |12 |13 | |10 | |20 | |19 |12 |13 |14 |12 | |11 | |19 | |19 |20 |8 |3 |1 |4 | | |
Ch136 |18 | |18 | |18 | |18 |18 |12 |12 | |19 | |10 | |20 |10 |8 |17 |8 | |12 | |10 | |10 |13 |13 |12 |8 | |11 | |18 | |14 |12 |17 |8 |14 | |14 | |9 | |11 |18 |14 |1 |2 |2 | | |
Ch140 |18 | |18 | |18 | |18 |18 |12 |10 | |13 | |9 | |16 |8 |20 |10 |17 | |8 | |15 | |13 |20 |15 |10 |18 | |13 | |12 | |12 |16 |18 |12 |17 | |10 | |16 | |11 |15 |14 |3 |2 |5 | | |
Ch144 |18 | |18 | |18 | |18 |18 |19 |9 | |15 | |8 | |13 |18 |17 |9 |19 | |16 | |11 | |20 |12 |15 |19 |10 | |17 | |15 | |17 |14 |9 |9 |13 | |17 | |16 | |10 |9 |10 |1 |5 |2 | | |
Ch149 |18 | |18 | |18 | |18 |18 |15 |20 | |12 | |19 | |19 |19 |10 |10 |13 | |15 | |19 | |12 |19 |10 |14 |15 | |10 | |15 | |9 |8 |11 |15 |13 | |10 | |16 | |15 |18 |12 |5 |5 |2 | | |
Ch153 |18 | |18 | |18 | |18 |18 |20 |17 | |8 | |19 | |16 |20 |13 |16 |18 | |14 | |11 | |10 |16 |16 |19 |15 | |13 | |17 | |19 |18 |19 |20 |8 | |18 | |9 | |17 |11 |11 |1 |2 |1 | | |
Ch157 |18 | |18 | |18 | |18 |18 |13 |17 | |12 | |19 | |16 |8 |17 |11 |12 | |15 | |14 | |18 |11 |12 |9 |18 | |20 | |13 | |16 |13 |20 |17 |19 | |10 | |12 | |20 |18 |16 |5 |2 |3 | | |
Ch161 |18 | |18 | |18 | |18 |18 |12 |12 | |16 | |12 | |15 |11 |18 |11 |13 | |17 | |19 | |11 |13 |13 |9 |15 | |10 | |10 | |19 |13 |20 |13 |9 | |8 | |8 | |20 |14 |12 |0 |4 |1 | | |
Ch165 |18 | |18 | |18 | |18 |18 |13 |16 | |15 | |13 | |15 |8 |19 |15 |10 | |17 | |13 | |13 |19 |20 |8 |18 | |15 | |20 | |16 |9 |14 |11 |20 | |11 | |19 | |15 |16 |8 |1 |2 |0 | | |
Ch169 |18 | |18 | |18 | |18 |18 |8 |17 | |17 | |13 | |16 |8 |14 |18 |11 | |8 | |18 | |20 |14 |8 |17 |8 | |13 | |18 | |19 |20 |19 |20 |17 | |13 | |20 | |9 |15 |18 |0 |3 |4 | | |
Ch173 |18 | |18 | |18 | |18 |18 |14 |9 | |13 | |12 | |15 |14 |15 |10 |10 | |18 | |16 | |16 |8 |13 |16 |11 | |11 | |13 | |13 |15 |12 |20 |15 | |14 | |13 | |16 |11 |14 |3 |3 |4 | | |
Ch177 |18 | |18 | |18 | |18 |18 |19 |18 | |16 | |10 | |20 |13 |11 |16 |12 | |16 | |18 | |18 |11 |18 |8 |13 | |14 | |11 | |18 |14 |16 |16 |19 | |16 | |13 | |15 |8 |13 |5 |0 |0 | | |
Ch181 |18 | |18 | |18 | |18 |18 |20 |11 | |10 | |9 | |8 |9 |15 |15 |8 | |8 | |12 | |11 |9 |18 |20 |11 | |17 | |11 | |8 |15 |8 |18 |12 | |18 | |16 | |19 |9 |14 |4 |1 |4 | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

View File

@ -1,410 +0,0 @@
#The word of "Default" must not be removed
Default
AccessControlList0=
AccessControlList1=
AccessControlList10=
AccessControlList11=
AccessControlList12=
AccessControlList13=
AccessControlList14=
AccessControlList15=
AccessControlList2=
AccessControlList3=
AccessControlList4=
AccessControlList5=
AccessControlList6=
AccessControlList7=
AccessControlList8=
AccessControlList9=
AccessPolicy0=0
AccessPolicy1=0
AccessPolicy10=0
AccessPolicy11=0
AccessPolicy12=0
AccessPolicy13=0
AccessPolicy14=0
AccessPolicy15=0
AccessPolicy2=0
AccessPolicy3=0
AccessPolicy4=0
AccessPolicy5=0
AccessPolicy6=0
AccessPolicy7=0
AccessPolicy8=0
AccessPolicy9=0
AckPolicy=0;0;0;0
APACM=0;0;0;0
APAifsn=3;7;1;1
ApCliAuthMode=
ApCliBssid=
ApCliDefaultKeyID=
ApCliEnable=
ApCliKey1Str=
ApCliKey1Str1=
ApCliKey1Type=
ApCliKey2Str=
ApCliKey2Str1=
ApCliKey2Type=
ApCliKey3Str=
ApCliKey3Str1=
ApCliKey3Type=
ApCliKey4Str=
ApCliKey4Str1=
ApCliKey4Type=
ApCliSsid=
ApCliWirelessMode=
ApCliWPAPSK=
ApCliWPAPSK1=
APCwmax=6;10;4;3
APCwmin=4;4;3;2
APSDCapable=1
APTxop=0;0;94;47
AuthMode=OPEN
AutoChannelSelect=3
AutoChannelSkipList=
AutoProvisionEn=0
BandSteering=0
BasicRate=15
BeaconPeriod=100
BFBACKOFFenable=0
BgndScanSkipCh=
BGProtection=0
BndStrgBssIdx=
BSSACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmax=10;10;4;3
BSSCwmin=4;4;3;2
BssidNum=1
BSSTxop=0;0;94;47
BW_Enable=0
BW_Guarantee_Rate=
BW_Maximum_Rate=
BW_Priority=
BW_Root=0
CalCacheApply=0
CarrierDetect=0
Channel=0
ChannelGrp=
CountryCode=US
CountryRegion=5
CountryRegionABand=7
CP_SUPPORT=2
CSPeriod=6
DBDC_MODE=0
DebugFlags=0
DefaultKeyID=1
DfsCalibration=0
DfsEnable=0
DfsFalseAlarmPrevent=1
DfsZeroWait=0
DfsZeroWaitCacTime=255
DisableOLBC=0
DtimPeriod=1
E2pAccessMode=2
EAPifname=br-lan
EDCCAEnable=1
EncrypType=NONE
EthConvertMode=dongle
EtherTrafficBand=0
Ethifname=
ETxBfEnCond=1
FineAGC=0
FixedTxMode=
ForceRoamSupport=
FragThreshold=2346
FreqDelta=0
FtSupport=0
GreenAP=1
G_BAND_256QAM=1
HideSSID=0
HT_AMSDU=1
HT_AutoBA=1
HT_BADecline=0
HT_BAWinSize=64
HT_BSSCoexistence=1
HT_BW=1
HT_DisallowTKIP=1
HT_EXTCHA=1
HT_GI=1
HT_HTC=1
HT_LDPC=1
HT_LinkAdapt=0
HT_MCS=33
HT_MpduDensity=5
HT_OpMode=0
HT_PROTECT=1
HT_RDG=0
HT_RxStream=4
HT_STBC=1
HT_TxStream=4
IcapMode=0
idle_timeout_interval=0
IEEE80211H=1
IEEE8021X=0
IgmpSnEnable=0
ITxBfEn=1
Key1Str=
Key1Str1=
Key1Str10=
Key1Str11=
Key1Str12=
Key1Str13=
Key1Str14=
Key1Str15=
Key1Str16=
Key1Str2=
Key1Str3=
Key1Str4=
Key1Str5=
Key1Str6=
Key1Str7=
Key1Str8=
Key1Str9=
Key1Type=0
Key2Str=
Key2Str1=
Key2Str10=
Key2Str11=
Key2Str12=
Key2Str13=
Key2Str14=
Key2Str15=
Key2Str16=
Key2Str2=
Key2Str3=
Key2Str4=
Key2Str5=
Key2Str6=
Key2Str7=
Key2Str8=
Key2Str9=
Key2Type=0
Key3Str=
Key3Str1=
Key3Str10=
Key3Str11=
Key3Str12=
Key3Str13=
Key3Str14=
Key3Str15=
Key3Str16=
Key3Str2=
Key3Str3=
Key3Str4=
Key3Str5=
Key3Str6=
Key3Str7=
Key3Str8=
Key3Str9=
Key3Type=0
Key4Str=
Key4Str1=
Key4Str10=
Key4Str11=
Key4Str12=
Key4Str13=
Key4Str14=
Key4Str15=
Key4Str16=
Key4Str2=
Key4Str3=
Key4Str4=
Key4Str5=
Key4Str6=
Key4Str7=
Key4Str8=
Key4Str9=
Key4Type=0
LinkTestSupport=0
MACRepeaterEn=
MACRepeaterOuiMode=2
MeshAuthMode=
MeshAutoLink=0
MeshDefaultkey=0
MeshEncrypType=
MeshId=
MeshWEPKEY=
MeshWPAKEY=
MUTxRxEnable=0
NoForwarding=0
NoForwardingBTNBSSID=0
own_ip_addr=192.168.1.1
PcieAspm=0
PERCENTAGEenable=0
PhyRateLimit=0
PMFMFPC=1
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=10
PowerUpCckOfdm=0:0:0:0:0:0:0
PowerUpHT20=0:0:0:0:0:0:0
PowerUpHT40=0:0:0:0:0:0:0
PowerUpVHT160=0:0:0:0:0:0:0
PowerUpVHT20=0:0:0:0:0:0:0
PowerUpVHT40=0:0:0:0:0:0:0
PowerUpVHT80=0:0:0:0:0:0:0
PreAntSwitch=
PreAuth=0
PreAuthifname=br-lan
RadioLinkSelection=0
RadioOn=1
RADIUS_Acct_Key=
RADIUS_Acct_Port=1813
RADIUS_Acct_Server=
RADIUS_Key1=
RADIUS_Key10=
RADIUS_Key11=
RADIUS_Key12=
RADIUS_Key13=
RADIUS_Key14=
RADIUS_Key15=
RADIUS_Key16=
RADIUS_Key2=
RADIUS_Key3=
RADIUS_Key4=
RADIUS_Key5=
RADIUS_Key6=
RADIUS_Key7=
RADIUS_Key8=
RADIUS_Key9=
RADIUS_Port=1812
RADIUS_Server=0
RDRegion=
RED_Enable=1
RekeyInterval=3600
RekeyMethod=DISABLE
RRMEnable=0
RTSThreshold=2347
session_timeout_interval=0
ShortSlot=1
SKUenable=0
SSID=
SSID1=WITHUSP-5.0
SSID10=
SSID11=
SSID12=
SSID13=
SSID14=
SSID15=
SSID16=
SSID2=
SSID3=
SSID4=
SSID5=
SSID6=
SSID7=
SSID8=
SSID9=
StationKeepAlive=0
StreamMode=0
StreamModeMac0=
StreamModeMac1=
StreamModeMac2=
StreamModeMac3=
TGnWifiTest=0
ThermalRecal=0
TxBurst=1
TxPower=100
TxPreamble=1
VHT_BW=1
VHT_BW_SIGNAL=0
VHT_LDPC=1
VHT_Sec80_Channel=0
VHT_SGI=1
VHT_STBC=1
VLANID=0
VLANPriority=0
VLANTag=0
VOW_Airtime_Ctrl_En=0
VOW_Airtime_Fairness_En=1
VOW_BW_Ctrl=0
VOW_Group_Backlog=
VOW_Group_DWRR_Max_Wait_Time=
VOW_Group_DWRR_Quantum=
VOW_Group_Max_Airtime_Bucket_Size=
VOW_Group_Max_Rate=
VOW_Group_Max_Rate_Bucket_Size=
VOW_Group_Max_Ratio=
VOW_Group_Max_Wait_Time=
VOW_Group_Min_Airtime_Bucket_Size=
VOW_Group_Min_Rate=
VOW_Group_Min_Rate_Bucket_Size=
VOW_Group_Min_Ratio=
VOW_Rate_Ctrl_En=0
VOW_Refill_Period=
VOW_RX_En=1
VOW_Sta_BE_DWRR_Quantum=
VOW_Sta_BK_DWRR_Quantum=
VOW_Sta_DWRR_Max_Wait_Time=
VOW_Sta_VI_DWRR_Quantum=
VOW_Sta_VO_DWRR_Quantum=
VOW_WATF_Enable=
VOW_WATF_MAC_LV0=
VOW_WATF_MAC_LV1=
VOW_WATF_MAC_LV2=
VOW_WATF_MAC_LV3=
VOW_WATF_Q_LV0=
VOW_WATF_Q_LV1=
VOW_WATF_Q_LV2=
VOW_WATF_Q_LV3=
VOW_WMM_Search_Rule_Band0=
VOW_WMM_Search_Rule_Band1=
WapiAsCertPath=
WapiAsIpAddr=
WapiAsPort=
Wapiifname=
WapiPsk1=
WapiPsk10=
WapiPsk11=
WapiPsk12=
WapiPsk13=
WapiPsk14=
WapiPsk15=
WapiPsk16=
WapiPsk2=
WapiPsk3=
WapiPsk4=
WapiPsk5=
WapiPsk6=
WapiPsk7=
WapiPsk8=
WapiPsk9=
WapiPskType=
WapiUserCertPath=
WCNTest=0
Wds0Key=
Wds1Key=
Wds2Key=
Wds3Key=
WdsEnable=0
WdsEncrypType=NONE
WdsList=
WdsPhyMode=0
WHNAT=1
WiFiTest=0
WirelessMode=14
WmmCapable=1
WPAPSK=
WPAPSK1=12345678
WPAPSK10=
WPAPSK11=
WPAPSK12=
WPAPSK13=
WPAPSK14=
WPAPSK15=
WPAPSK16=
WPAPSK2=
WPAPSK3=
WPAPSK4=
WPAPSK5=
WPAPSK6=
WPAPSK7=
WPAPSK8=
WPAPSK9=
WscConfMode=0
WscConfStatus=2
WEP1Type1=0
WEP2Type1=0
WEP3Type1=0
WEP4Type1=0
WPSRadio=0

View File

@ -1,412 +0,0 @@
#The word of "Default" must not be removed
Default
AccessControlList0=
AccessControlList1=
AccessControlList10=
AccessControlList11=
AccessControlList12=
AccessControlList13=
AccessControlList14=
AccessControlList15=
AccessControlList2=
AccessControlList3=
AccessControlList4=
AccessControlList5=
AccessControlList6=
AccessControlList7=
AccessControlList8=
AccessControlList9=
AccessPolicy0=0
AccessPolicy1=0
AccessPolicy10=0
AccessPolicy11=0
AccessPolicy12=0
AccessPolicy13=0
AccessPolicy14=0
AccessPolicy15=0
AccessPolicy2=0
AccessPolicy3=0
AccessPolicy4=0
AccessPolicy5=0
AccessPolicy6=0
AccessPolicy7=0
AccessPolicy8=0
AccessPolicy9=0
AckPolicy=0;0;0;0
APACM=0;0;0;0
APAifsn=3;7;1;1
ApCliAuthMode=
ApCliBssid=
ApCliDefaultKeyID=
ApCliEnable=
ApCliEncrypType=
ApCliKey1Str=
ApCliKey1Str1=
ApCliKey1Type=
ApCliKey2Str=
ApCliKey2Str1=
ApCliKey2Type=
ApCliKey3Str=
ApCliKey3Str1=
ApCliKey3Type=
ApCliKey4Str=
ApCliKey4Str1=
ApCliKey4Type=
ApCliSsid=
ApCliWirelessMode=
ApCliWPAPSK=
ApCliWPAPSK1=
APCwmax=6;10;4;3
APCwmin=4;4;3;2
APSDCapable=1
APTxop=0;0;94;47
AuthMode=OPEN
AutoChannelSelect=3
AutoChannelSkipList=
AutoProvisionEn=0
BandSteering=0
BasicRate=15
BeaconPeriod=100
BFBACKOFFenable=0
BgndScanSkipCh=
BGProtection=0
BndStrgBssIdx=
BSSACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmax=10;10;4;3
BSSCwmin=4;4;3;2
BssidNum=1
BSSTxop=0;0;94;47
BW_Enable=0
BW_Guarantee_Rate=
BW_Maximum_Rate=
BW_Priority=
BW_Root=0
CalCacheApply=0
CarrierDetect=0
Channel=0
ChannelGrp=
CountryCode=US
CountryRegion=5
CountryRegionABand=7
CP_SUPPORT=2
CSPeriod=6
DBDC_MODE=0
DebugFlags=0
DefaultKeyID=1
DfsCalibration=0
DfsEnable=0
DfsFalseAlarmPrevent=1
DfsZeroWait=0
DfsZeroWaitCacTime=255
DisableOLBC=0
DtimPeriod=1
E2pAccessMode=1
EAPifname=br-lan
EDCCAEnable=1
EncrypType=NONE
EthConvertMode=dongle
EtherTrafficBand=0
Ethifname=
ETxBfEnCond=1
FineAGC=0
FixedTxMode=
ForceRoamSupport=
FragThreshold=2346
FreqDelta=0
FtSupport=0
GreenAP=1
G_BAND_256QAM=1
HideSSID=0
HT_AMSDU=1
HT_AutoBA=1
HT_BADecline=0
HT_BAWinSize=64
HT_BSSCoexistence=1
HT_BW=1
HT_DisallowTKIP=1
HT_EXTCHA=1
HT_GI=1
HT_HTC=1
HT_LDPC=1
HT_LinkAdapt=0
HT_MCS=33
HT_MpduDensity=5
HT_OpMode=0
HT_PROTECT=1
HT_RDG=0
HT_RxStream=4
HT_STBC=1
HT_TxStream=4
IcapMode=0
idle_timeout_interval=0
IEEE80211H=1
IEEE8021X=0
IgmpSnEnable=0
ITxBfEn=1
Key1Str=
Key1Str1=
Key1Str10=
Key1Str11=
Key1Str12=
Key1Str13=
Key1Str14=
Key1Str15=
Key1Str16=
Key1Str2=
Key1Str3=
Key1Str4=
Key1Str5=
Key1Str6=
Key1Str7=
Key1Str8=
Key1Str9=
Key1Type=0
Key2Str=
Key2Str1=
Key2Str10=
Key2Str11=
Key2Str12=
Key2Str13=
Key2Str14=
Key2Str15=
Key2Str16=
Key2Str2=
Key2Str3=
Key2Str4=
Key2Str5=
Key2Str6=
Key2Str7=
Key2Str8=
Key2Str9=
Key2Type=0
Key3Str=
Key3Str1=
Key3Str10=
Key3Str11=
Key3Str12=
Key3Str13=
Key3Str14=
Key3Str15=
Key3Str16=
Key3Str2=
Key3Str3=
Key3Str4=
Key3Str5=
Key3Str6=
Key3Str7=
Key3Str8=
Key3Str9=
Key3Type=0
Key4Str=
Key4Str1=
Key4Str10=
Key4Str11=
Key4Str12=
Key4Str13=
Key4Str14=
Key4Str15=
Key4Str16=
Key4Str2=
Key4Str3=
Key4Str4=
Key4Str5=
Key4Str6=
Key4Str7=
Key4Str8=
Key4Str9=
Key4Type=0
LinkTestSupport=0
MACRepeaterEn=
MACRepeaterOuiMode=2
MeshAuthMode=
MeshAutoLink=0
MeshDefaultkey=0
MeshEncrypType=
MeshId=
MeshWEPKEY=
MeshWPAKEY=
MUTxRxEnable=0
NoForwarding=0
NoForwardingBTNBSSID=0
own_ip_addr=192.168.1.1
PcieAspm=0
PERCENTAGEenable=0
PhyRateLimit=0
PMFMFPC=1
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=10
PowerUpCckOfdm=0:0:0:0:0:0:0
PowerUpHT20=0:0:0:0:0:0:0
PowerUpHT40=0:0:0:0:0:0:0
PowerUpVHT160=0:0:0:0:0:0:0
PowerUpVHT20=0:0:0:0:0:0:0
PowerUpVHT40=0:0:0:0:0:0:0
PowerUpVHT80=0:0:0:0:0:0:0
PreAntSwitch=
PreAuth=0
PreAuthifname=br-lan
RadioLinkSelection=0
RadioOn=1
RADIUS_Acct_Key=
RADIUS_Acct_Port=1813
RADIUS_Acct_Server=
RADIUS_Key1=
RADIUS_Key10=
RADIUS_Key11=
RADIUS_Key12=
RADIUS_Key13=
RADIUS_Key14=
RADIUS_Key15=
RADIUS_Key16=
RADIUS_Key2=
RADIUS_Key3=
RADIUS_Key4=
RADIUS_Key5=
RADIUS_Key6=
RADIUS_Key7=
RADIUS_Key8=
RADIUS_Key9=
RADIUS_Port=1812
RADIUS_Server=0
RDRegion=
RED_Enable=1
RekeyInterval=3600
RekeyMethod=DISABLE
RRMEnable=0
RTSThreshold=2347
session_timeout_interval=0
ShortSlot=1
SKUenable=0
SSID=
SSID1=MTK_AP3
SSID10=
SSID11=
SSID12=
SSID13=
SSID14=
SSID15=
SSID16=
SSID2=
SSID3=
SSID4=
SSID5=
SSID6=
SSID7=
SSID8=
SSID9=
StationKeepAlive=0
StreamMode=0
StreamModeMac0=
StreamModeMac1=
StreamModeMac2=
StreamModeMac3=
TGnWifiTest=0
ThermalRecal=0
TxBurst=1
TxPower=100
TxPreamble=1
VHT_BW=1
VHT_BW_SIGNAL=0
VHT_LDPC=1
VHT_Sec80_Channel=0
VHT_SGI=1
VHT_STBC=1
VLANID=0
VLANPriority=0
VLANTag=0
VOW_Airtime_Ctrl_En=
VOW_Airtime_Fairness_En=1
VOW_BW_Ctrl=0
VOW_Group_Backlog=
VOW_Group_DWRR_Max_Wait_Time=
VOW_Group_DWRR_Quantum=
VOW_Group_Max_Airtime_Bucket_Size=
VOW_Group_Max_Rate=
VOW_Group_Max_Rate_Bucket_Size=
VOW_Group_Max_Ratio=
VOW_Group_Max_Wait_Time=
VOW_Group_Min_Airtime_Bucket_Size=
VOW_Group_Min_Rate=
VOW_Group_Min_Rate_Bucket_Size=
VOW_Group_Min_Ratio=
VOW_Rate_Ctrl_En=
VOW_Refill_Period=
VOW_RX_En=1
VOW_Sta_BE_DWRR_Quantum=
VOW_Sta_BK_DWRR_Quantum=
VOW_Sta_DWRR_Max_Wait_Time=
VOW_Sta_VI_DWRR_Quantum=
VOW_Sta_VO_DWRR_Quantum=
VOW_WATF_Enable=
VOW_WATF_MAC_LV0=
VOW_WATF_MAC_LV1=
VOW_WATF_MAC_LV2=
VOW_WATF_MAC_LV3=
VOW_WATF_Q_LV0=
VOW_WATF_Q_LV1=
VOW_WATF_Q_LV2=
VOW_WATF_Q_LV3=
VOW_WMM_Search_Rule_Band0=
VOW_WMM_Search_Rule_Band1=
WapiAsCertPath=
WapiAsIpAddr=
WapiAsPort=
Wapiifname=
WapiPsk1=
WapiPsk10=
WapiPsk11=
WapiPsk12=
WapiPsk13=
WapiPsk14=
WapiPsk15=
WapiPsk16=
WapiPsk2=
WapiPsk3=
WapiPsk4=
WapiPsk5=
WapiPsk6=
WapiPsk7=
WapiPsk8=
WapiPsk9=
WapiPskType=
WapiUserCertPath=
WCNTest=0
Wds0Key=
Wds1Key=
Wds2Key=
Wds3Key=
WdsEnable=0
WdsEncrypType=NONE
WdsList=
WdsPhyMode=0
WHNAT=1
WiFiTest=0
WirelessMode=14
WmmCapable=1
WPAPSK=
WPAPSK1=12345678
WPAPSK10=
WPAPSK11=
WPAPSK12=
WPAPSK13=
WPAPSK14=
WPAPSK15=
WPAPSK16=
WPAPSK2=
WPAPSK3=
WPAPSK4=
WPAPSK5=
WPAPSK6=
WPAPSK7=
WPAPSK8=
WPAPSK9=
WscConfMode=0
WscConfStatus=2
WEP1Type1=0
WEP2Type1=0
WEP3Type1=0
WEP4Type1=0
WPSRadio=0

View File

@ -1,301 +0,0 @@
#!/usr/bin/lua
-- Alternative for OpenWrt's /sbin/wifi.
-- Copyright Not Reserved.
-- Hua Shao <nossiac@163.com>
package.path = '/lib/wifi/?.lua;'..package.path
local vif_prefix = {"ra", "rai", "rae", "rax", "ray", "raz",
"apcli", "apclix", "apclii", "apcliy", "apclie", "apcliz", }
local function esc(x)
return (x:gsub('%%', '%%%%')
:gsub('^%^', '%%^')
:gsub('%$$', '%%$')
:gsub('%(', '%%(')
:gsub('%)', '%%)')
:gsub('%.', '%%.')
:gsub('%[', '%%[')
:gsub('%]', '%%]')
:gsub('%*', '%%*')
:gsub('%+', '%%+')
:gsub('%-', '%%-')
:gsub('%?', '%%?'))
end
function add_vif_into_lan(vif)
local mtkwifi = require("mtkwifi")
local brvifs = mtkwifi.__trim( mtkwifi.read_pipe("uci get network.lan.ifname"))
if not string.match(brvifs, esc(vif)) then
nixio.syslog("debug", "add "..vif.." into lan")
-- brvifs = brvifs.." "..vif
-- os.execute("uci set network.lan.ifname=\""..brvifs.."\"") --netifd will down vif form /etc/config/network
-- os.execute("uci commit")
-- os.execute("ubus call network.interface.lan add_device \"{\\\"name\\\":\\\""..vif.."\\\"}\"")
os.execute("brctl addif br-lan "..vif) -- double insurance for rare failure
end
end
function del_vif_from_lan(vif)
local mtkwifi = require("mtkwifi")
local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
if string.match(brvifs, esc(vif)) then
-- brvifs = mtkwifi.__trim(string.gsub(brvifs, esc(vif), ""))
nixio.syslog("debug", "del "..vif.." from lan")
-- os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
-- os.execute("uci commit")
-- os.execute("ubus call network.interface.lan remove_device \"{\\\"name\\\":\\\""..vif.."\\\"}\"")
os.execute("brctl delif br-lan "..vif)
end
end
function mt7615e_up(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
local wifi_services_exist = false
if mtkwifi.exists("/lib/wifi/wifi_services.lua") then
wifi_services_exist = require("wifi_services")
end
nixio.syslog("debug", "mt7615e_up called!")
local devs, l1parser = mtkwifi.__get_l1dat()
-- l1 profile present, good!
if l1parser and devs then
dev = devs.devname_ridx[devname]
if not dev then
nixio.syslog("err", "mt7615e_up: dev "..devname.." not found!")
return
end
-- we have to bring up main_ifname first, main_ifname will create all other vifs.
if mtkwifi.exists("/sys/class/net/"..dev.main_ifname) then
nixio.syslog("debug", "mt7615e_up: ifconfig "..dev.main_ifname.." up")
os.execute("ifconfig "..dev.main_ifname.." up")
add_vif_into_lan(dev.main_ifname)
if wifi_services_exist then
miniupnpd_chk(devname,dev.main_ifname,true)
end
else
nixio.syslog("err", "mt7615e_up: main_ifname "..dev.main_ifname.." missing, quit!")
return
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if vif ~= dev.main_ifname and
( string.match(vif, esc(dev.ext_ifname).."[0-9]+")
or string.match(vif, esc(dev.apcli_ifname).."[0-9]+")
or string.match(vif, esc(dev.wds_ifname).."[0-9]+")
or string.match(vif, esc(dev.mesh_ifname).."[0-9]+"))
then
nixio.syslog("debug", "mt7615e_up: ifconfig "..vif.."0 up")
os.execute("ifconfig "..vif.." up")
add_vif_into_lan(vif)
if wifi_services_exist and string.match(vif, esc(dev.ext_ifname).."[0-9]+") then
miniupnpd_chk(devname,vif, true)
end
-- else nixio.syslog("debug", "mt7615e_up: skip "..vif..", prefix not match "..pre)
end
end
os.execute("iwpriv "..dev.main_ifname.." set hw_nat_register=1")
if wifi_services_exist then
d8021xd_chk(devname,dev.ext_ifname,dev.main_ifname,true)
end
elseif mtkwifi.exists("/etc/wireless/mt7615e/"..devname..".dat") then
for _, pre in ipairs(vif_prefix) do
-- we have to bring up root vif first, root vif will create all other vifs.
if mtkwifi.exists("/sys/class/net/"..pre.."0") then
nixio.syslog("debug", "mt7615e_up: ifconfig "..pre.."0 up")
os.execute("ifconfig "..pre.."0 up")
add_vif_into_lan(pre.."0")
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
-- nixio.syslog("debug", "mt7615e_up: navigate "..pre)
if string.match(vif, pre.."[1-9]+") then
nixio.syslog("debug", "mt7615e_up: ifconfig "..vif.." up")
os.execute("ifconfig "..vif.." up")
add_vif_into_lan(vif)
if wifi_services_exist then
miniupnpd_chk(devname, vif, true)
end
-- else nixio.syslog("debug", "mt7615e_up: skip "..vif..", prefix not match "..pre)
end
end
if wifi_services_exist then
d8021xd_chk(devname,pre,pre.."0",true)
end
end
else nixio.syslog("debug", "mt7615e_up: skip "..devname..", config not exist")
end
-- M.A.N service
if mtkwifi.exists("/etc/init.d/man") then
os.execute("/etc/init.d/man stop")
os.execute("/etc/init.d/man start")
end
os.execute(" rm -rf /tmp/mtk/wifi/mt7615e*.need_reload")
end
function mt7615e_down(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
local wifi_services_exist = false
if mtkwifi.exists("/lib/wifi/wifi_services.lua") then
wifi_services_exist = require("wifi_services")
end
nixio.syslog("debug", "mt7615e_down called!")
-- M.A.N service
if mtkwifi.exists("/etc/init.d/man") then
os.execute("/etc/init.d/man stop")
end
local devs, l1parser = mtkwifi.__get_l1dat()
-- l1 profile present, good!
if l1parser and devs then
dev = devs.devname_ridx[devname]
if not dev then
nixio.syslog("err", "mt7615e_down: dev "..devname.." not found!")
return
end
os.execute("iwpriv "..dev.main_ifname.." set hw_nat_register=0")
if wifi_services_exist then
d8021xd_chk(devname,dev.ext_ifname,dev.main_ifname)
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if vif == dev.main_ifname
or string.match(vif, esc(dev.ext_ifname).."[0-9]+")
or string.match(vif, esc(dev.apcli_ifname).."[0-9]+")
or string.match(vif, esc(dev.wds_ifname).."[0-9]+")
or string.match(vif, esc(dev.mesh_ifname).."[0-9]+")
then
if wifi_services_exist then
if vif == dev.main_ifname
or string.match(vif, esc(dev.ext_ifname).."[0-9]+") then
miniupnpd_chk(devname,vif)
end
end
nixio.syslog("debug", "mt7615e_down: ifconfig "..vif.." down")
os.execute("ifconfig "..vif.." down")
del_vif_from_lan(vif)
-- else nixio.syslog("debug", "mt7615e_down: skip "..vif..", prefix not match "..pre)
end
end
elseif mtkwifi.exists("/etc/wireless/mt7615e/"..devname..".dat") then
for _, pre in ipairs(vif_prefix) do
if wifi_services_exist then
d8021xd_chk(devname,pre,pre.."0")
end
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
do
if string.match(vif, pre.."[0-9]+") then
nixio.syslog("debug", "mt7615e_down: ifconfig "..vif.."down")
os.execute("ifconfig "..vif.." down")
del_vif_from_lan(vif)
if wifi_services_exist then
miniupnpd_chk(devname,vif)
end
-- else nixio.syslog("debug", "mt7615e_down: skip "..vif..", prefix not match "..pre)
end
end
end
else nixio.syslog("debug", "mt7615e_down: skip "..devname..", config not exist")
end
os.execute(" rm -rf /tmp/mtk/wifi/mt7615e*.need_reload")
end
function mt7615e_reload(devname)
local nixio = require("nixio")
nixio.syslog("debug", "mt7615e_reload called!")
mt7615e_down(devname)
mt7615e_up(devname)
end
function mt7615e_restart(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
local devs, l1parser = mtkwifi.__get_l1dat()
nixio.syslog("debug", "mt7615e_restart called!")
if devname then
local dev = devs.devname_ridx[devname]
assert(mtkwifi.exists(dev.init_script))
local compatname = dev.init_compatible
for devname, dev in pairs(devs.devname_ridx) do
if dev.init_compatible == compatname then
mt7615e_down(devname)
end
end
else
for devname, dev in pairs(devs.devname_ridx) do
mt7615e_down(devname)
end
end
os.execute("rmmod wifi_forward")
os.execute("rmmod mt_whnat")
os.execute("rmmod mt_wifi")
os.execute("rmmod hw_nat")
os.execute("insmod /lib/modules/ralink/hw_nat.ko")
os.execute("modprobe mt_wifi")
os.execute("modprobe mt_whnat")
os.execute("modprobe wifi_forward")
if devname then
local dev = devs.devname_ridx[devname]
assert(mtkwifi.exists(dev.init_script))
local compatname = dev.init_compatible
for devname, dev in pairs(devs.devname_ridx) do
if dev.init_compatible == compatname then
mt7615e_up(devname)
end
end
else
for devname, dev in pairs(devs.devname_ridx) do
mt7615e_up(devname)
end
end
end
function mt7615e_reset(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
nixio.syslog("debug", "mt7615e_reset called!")
if mtkwifi.exists("/rom/etc/wireless/mt7615e/") then
os.execute("rm -rf /etc/wireless/mt7615e/")
os.execute("cp -rf /rom/etc/wireless/mt7615e/ /etc/wireless/")
mt7615e_reload(devname)
else
nixio.syslog("debug", "mt7615e_reset: /rom"..profile.." missing, unable to reset!")
end
end
function mt7615e_status(devname)
return wifi_common_status()
end
function mt7615e_detect(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
nixio.syslog("debug", "mt7615e_detect called!")
for _,dev in ipairs(mtkwifi.get_all_devs()) do
local relname = string.format("%s%d%d",dev.maindev,dev.mainidx,dev.subidx)
print([[
config wifi-device ]]..relname.."\n"..[[
option type mt7615e
option vendor ralink
]])
for _,vif in ipairs(dev.vifs) do
print([[
config wifi-iface
option device ]]..relname.."\n"..[[
option ifname ]]..vif.vifname.."\n"..[[
option network lan
option mode ap
option ssid ]]..vif.__ssid.."\n")
end
end
end

View File

@ -1,412 +0,0 @@
#The word of "Default" must not be removed
Default
AccessControlList0=
AccessControlList1=
AccessControlList10=
AccessControlList11=
AccessControlList12=
AccessControlList13=
AccessControlList14=
AccessControlList15=
AccessControlList2=
AccessControlList3=
AccessControlList4=
AccessControlList5=
AccessControlList6=
AccessControlList7=
AccessControlList8=
AccessControlList9=
AccessPolicy0=0
AccessPolicy1=0
AccessPolicy10=0
AccessPolicy11=0
AccessPolicy12=0
AccessPolicy13=0
AccessPolicy14=0
AccessPolicy15=0
AccessPolicy2=0
AccessPolicy3=0
AccessPolicy4=0
AccessPolicy5=0
AccessPolicy6=0
AccessPolicy7=0
AccessPolicy8=0
AccessPolicy9=0
AckPolicy=0;0;0;0
APACM=0;0;0;0
APAifsn=3;7;1;1
ApCliAuthMode=
ApCliBssid=
ApCliDefaultKeyID=
ApCliEnable=
ApCliEncrypType=
ApCliKey1Str=
ApCliKey1Str1=
ApCliKey1Type=
ApCliKey2Str=
ApCliKey2Str1=
ApCliKey2Type=
ApCliKey3Str=
ApCliKey3Str1=
ApCliKey3Type=
ApCliKey4Str=
ApCliKey4Str1=
ApCliKey4Type=
ApCliSsid=
ApCliWirelessMode=
ApCliWPAPSK=
ApCliWPAPSK1=
APCwmax=6;10;4;3
APCwmin=4;4;3;2
APSDCapable=1
APTxop=0;0;94;47
AuthMode=OPEN
AutoChannelSelect=3
AutoChannelSkipList=
AutoProvisionEn=0
BandSteering=0
BasicRate=15
BeaconPeriod=100
BFBACKOFFenable=0
BgndScanSkipCh=
BGProtection=0
BndStrgBssIdx=
BSSACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmax=10;10;4;3
BSSCwmin=4;4;3;2
BssidNum=1
BSSTxop=0;0;94;47
BW_Enable=0
BW_Guarantee_Rate=
BW_Maximum_Rate=
BW_Priority=
BW_Root=0
CalCacheApply=0
CarrierDetect=0
Channel=0
ChannelGrp=
CountryCode=US
CountryRegion=5
CountryRegionABand=7
CP_SUPPORT=2
CSPeriod=6
DBDC_MODE=0
DebugFlags=0
DefaultKeyID=1
DfsCalibration=0
DfsEnable=0
DfsFalseAlarmPrevent=1
DfsZeroWait=0
DfsZeroWaitCacTime=255
DisableOLBC=0
DtimPeriod=1
E2pAccessMode=2
EAPifname=br-lan
EDCCAEnable=1
EncrypType=NONE
EthConvertMode=dongle
EtherTrafficBand=0
Ethifname=
ETxBfEnCond=1
FineAGC=0
FixedTxMode=
ForceRoamSupport=
FragThreshold=2346
FreqDelta=0
FtSupport=0
GreenAP=1
G_BAND_256QAM=1
HideSSID=0
HT_AMSDU=1
HT_AutoBA=1
HT_BADecline=0
HT_BAWinSize=64
HT_BSSCoexistence=1
HT_BW=1
HT_DisallowTKIP=1
HT_EXTCHA=1
HT_GI=1
HT_HTC=1
HT_LDPC=1
HT_LinkAdapt=0
HT_MCS=33
HT_MpduDensity=5
HT_OpMode=0
HT_PROTECT=1
HT_RDG=0
HT_RxStream=4
HT_STBC=1
HT_TxStream=4
IcapMode=0
idle_timeout_interval=0
IEEE80211H=1
IEEE8021X=0
IgmpSnEnable=0
ITxBfEn=1
Key1Str=
Key1Str1=
Key1Str10=
Key1Str11=
Key1Str12=
Key1Str13=
Key1Str14=
Key1Str15=
Key1Str16=
Key1Str2=
Key1Str3=
Key1Str4=
Key1Str5=
Key1Str6=
Key1Str7=
Key1Str8=
Key1Str9=
Key1Type=0
Key2Str=
Key2Str1=
Key2Str10=
Key2Str11=
Key2Str12=
Key2Str13=
Key2Str14=
Key2Str15=
Key2Str16=
Key2Str2=
Key2Str3=
Key2Str4=
Key2Str5=
Key2Str6=
Key2Str7=
Key2Str8=
Key2Str9=
Key2Type=0
Key3Str=
Key3Str1=
Key3Str10=
Key3Str11=
Key3Str12=
Key3Str13=
Key3Str14=
Key3Str15=
Key3Str16=
Key3Str2=
Key3Str3=
Key3Str4=
Key3Str5=
Key3Str6=
Key3Str7=
Key3Str8=
Key3Str9=
Key3Type=0
Key4Str=
Key4Str1=
Key4Str10=
Key4Str11=
Key4Str12=
Key4Str13=
Key4Str14=
Key4Str15=
Key4Str16=
Key4Str2=
Key4Str3=
Key4Str4=
Key4Str5=
Key4Str6=
Key4Str7=
Key4Str8=
Key4Str9=
Key4Type=0
LinkTestSupport=0
MACRepeaterEn=
MACRepeaterOuiMode=2
MeshAuthMode=
MeshAutoLink=0
MeshDefaultkey=0
MeshEncrypType=
MeshId=
MeshWEPKEY=
MeshWPAKEY=
MUTxRxEnable=0
NoForwarding=0
NoForwardingBTNBSSID=0
own_ip_addr=192.168.1.1
PcieAspm=0
PERCENTAGEenable=0
PhyRateLimit=0
PMFMFPC=1
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=10
PowerUpCckOfdm=0:0:0:0:0:0:0
PowerUpHT20=0:0:0:0:0:0:0
PowerUpHT40=0:0:0:0:0:0:0
PowerUpVHT160=0:0:0:0:0:0:0
PowerUpVHT20=0:0:0:0:0:0:0
PowerUpVHT40=0:0:0:0:0:0:0
PowerUpVHT80=0:0:0:0:0:0:0
PreAntSwitch=
PreAuth=0
PreAuthifname=br-lan
RadioLinkSelection=0
RadioOn=1
RADIUS_Acct_Key=
RADIUS_Acct_Port=1813
RADIUS_Acct_Server=
RADIUS_Key1=
RADIUS_Key10=
RADIUS_Key11=
RADIUS_Key12=
RADIUS_Key13=
RADIUS_Key14=
RADIUS_Key15=
RADIUS_Key16=
RADIUS_Key2=
RADIUS_Key3=
RADIUS_Key4=
RADIUS_Key5=
RADIUS_Key6=
RADIUS_Key7=
RADIUS_Key8=
RADIUS_Key9=
RADIUS_Port=1812
RADIUS_Server=0
RDRegion=
RED_Enable=1
RekeyInterval=3600
RekeyMethod=DISABLE
RRMEnable=0
RTSThreshold=2347
session_timeout_interval=0
ShortSlot=1
SKUenable=0
SSID=
SSID1=WITHUSP-2.4
SSID10=
SSID11=
SSID12=
SSID13=
SSID14=
SSID15=
SSID16=
SSID2=
SSID3=
SSID4=
SSID5=
SSID6=
SSID7=
SSID8=
SSID9=
StationKeepAlive=0
StreamMode=0
StreamModeMac0=
StreamModeMac1=
StreamModeMac2=
StreamModeMac3=
TGnWifiTest=0
ThermalRecal=0
CCKTxStream=4
TxBurst=1
TxPower=100
TxPreamble=1
VHT_BW=0
VHT_BW_SIGNAL=0
VHT_LDPC=1
VHT_Sec80_Channel=0
VHT_SGI=1
VHT_STBC=1
VLANID=0
VLANPriority=0
VLANTag=0
VOW_Airtime_Ctrl_En=0
VOW_Airtime_Fairness_En=1
VOW_BW_Ctrl=0
VOW_Group_Backlog=
VOW_Group_DWRR_Max_Wait_Time=
VOW_Group_DWRR_Quantum=
VOW_Group_Max_Airtime_Bucket_Size=
VOW_Group_Max_Rate=
VOW_Group_Max_Rate_Bucket_Size=
VOW_Group_Max_Ratio=
VOW_Group_Max_Wait_Time=
VOW_Group_Min_Airtime_Bucket_Size=
VOW_Group_Min_Rate=
VOW_Group_Min_Rate_Bucket_Size=
VOW_Group_Min_Ratio=
VOW_Rate_Ctrl_En=0
VOW_Refill_Period=
VOW_RX_En=1
VOW_Sta_BE_DWRR_Quantum=
VOW_Sta_BK_DWRR_Quantum=
VOW_Sta_DWRR_Max_Wait_Time=
VOW_Sta_VI_DWRR_Quantum=
VOW_Sta_VO_DWRR_Quantum=
VOW_WATF_Enable=
VOW_WATF_MAC_LV0=
VOW_WATF_MAC_LV1=
VOW_WATF_MAC_LV2=
VOW_WATF_MAC_LV3=
VOW_WATF_Q_LV0=
VOW_WATF_Q_LV1=
VOW_WATF_Q_LV2=
VOW_WATF_Q_LV3=
VOW_WMM_Search_Rule_Band0=
VOW_WMM_Search_Rule_Band1=
WapiAsCertPath=
WapiAsIpAddr=
WapiAsPort=
Wapiifname=
WapiPsk1=
WapiPsk10=
WapiPsk11=
WapiPsk12=
WapiPsk13=
WapiPsk14=
WapiPsk15=
WapiPsk16=
WapiPsk2=
WapiPsk3=
WapiPsk4=
WapiPsk5=
WapiPsk6=
WapiPsk7=
WapiPsk8=
WapiPsk9=
WapiPskType=
WapiUserCertPath=
WCNTest=0
Wds0Key=
Wds1Key=
Wds2Key=
Wds3Key=
WdsEnable=0
WdsEncrypType=NONE
WdsList=
WdsPhyMode=0
WHNAT=0
WiFiTest=0
WirelessMode=9
WmmCapable=1
WPAPSK=
WPAPSK1=12345678
WPAPSK10=
WPAPSK11=
WPAPSK12=
WPAPSK13=
WPAPSK14=
WPAPSK15=
WPAPSK16=
WPAPSK2=
WPAPSK3=
WPAPSK4=
WPAPSK5=
WPAPSK6=
WPAPSK7=
WPAPSK8=
WPAPSK9=
WscConfMode=0
WscConfStatus=2
WEP1Type1=0
WEP2Type1=0
WEP3Type1=0
WEP4Type1=0
WPSRadio=0

View File

@ -1,98 +0,0 @@
--This file is created for check some deamons like miniupnpd,8021xd...
local mtkwifi = require("mtkwifi")
local devs = mtkwifi.get_all_devs()
local nixio = require("nixio")
function miniupnpd_chk(devname,vif,enable)
local WAN_IF=mtkwifi.__trim(mtkwifi.read_pipe("uci -q get network.wan.ifname"))
os.execute("rm -rf /etc/miniupnpd.conf")
os.execute("iptables -t nat -F MINIUPNPD 1>/dev/null 2>&1")
--rmeoving the rule to MINIUPNPD
os.execute("iptables-t nat -D PREROUTING -i "..WAN_IF.." -j MINIUPNPD 1>/dev/null 2>&1")
os.execute("iptables-t nat -X MINIUPNPD 1>/dev/null 2>&1")
--removing the MINIUPNPD chain for filter
os.execute("iptables -t filter -F MINIUPNPD 1>/dev/null 2>&1")
--adding the rule to MINIUPNPD
os.execute("iptables -t filter -D FORWARD -i "..WAN_IF.." ! -o "..WAN_IF.." -j MINIUPNPD 1>/dev/null 2>&1")
os.execute("iptables -t filter -X MINIUPNPD 1>/dev/null 2>&1")
os.execute("iptables -t nat -N MINIUPNPD")
os.execute("iptables -t nat -A PREROUTING -i "..WAN_IF.." -j MINIUPNPD")
os.execute("iptables -t filter -N MINIUPNPD")
os.execute("iptables -t filter -A FORWARD -i "..WAN_IF.." ! -o "..WAN_IF.." -j MINIUPNPD")
if mtkwifi.exists("/tmp/run/miniupnpd."..vif) then
os.execute("cat /tmp/run/miniupnpd."..vif.." | xargs kill -9")
end
if enable then
local profile = mtkwifi.search_dev_and_profile()[devname]
local cfgs = mtkwifi.load_profile(profile)
local ssid_index = devs[devname]["vifs"][vif].vifidx
local wsc_conf_mode = ""
local PORT_NUM = 7777+(string.byte(vif, -1)+string.byte(vif, -2))
local LAN_IPADDR = mtkwifi.__trim(mtkwifi.read_pipe("uci -q get network.lan.ipaddr"))
local LAN_MASK = mtkwifi.__trim(mtkwifi.read_pipe("uci -q get network.lan.netmask"))
local port = 6352 + (string.byte(vif, -1)+string.byte(vif, -2))
LAN_IPADDR = LAN_IPADDR.."/"..LAN_MASK
wsc_conf_mode = mtkwifi.token_get(cfgs["WscConfMode"], ssid_index, "")
local file = io.open("/etc/miniupnpd.conf", "w")
if nil == file then
nixio.syslog("debug","open file /etc/miniupnpd.conf fail")
end
file:write("ext_ifname=",WAN_IF,'\n','\n',
"listening_ip=",LAN_IPADDR,'\n','\n',
"port=",port,'\n','\n',
"bitrate_up=800000000",'\n',
"bitrate_down=800000000",'\n','\n',
"secure_mode=no",'\n','\n',
"system_uptime=yes",'\n','\n',
"notify_interval=30",'\n','\n',
"uuid=68555350-3352-3883-2883-335030522880",'\n','\n',
"serial=12345678",'\n','\n',
"model_number=1",'\n','\n',
"enable_upnp=no",'\n','\n')
file:close()
if wsc_conf_mode ~= "" and wsc_conf_mode ~= "0" then
os.execute("miniupnpd -m 1 -I "..vif.." -P /var/run/miniupnpd."..vif.." -G -i "..WAN_IF.." -a "..LAN_IPADDR.." -n "..PORT_NUM)
end
end
end
function d8021xd_chk(devname,prefix,main_ifname,enable)
local profile = mtkwifi.search_dev_and_profile()[devname]
local cfgs = mtkwifi.load_profile(profile)
local auth_mode = cfgs.AuthMode
local ieee8021x = cfgs.IEEE8021X
local pat_auth_mode = {"WPA$", "WPA;", "WPA2$", "WPA2;", "WPA1WPA2$", "WPA1WPA2;"}
local pat_ieee8021x = {"1$", "1;"}
local apd_en = false
if mtkwifi.exists("/tmp/run/8021xd_"..main_ifname..".pid") then
os.execute("cat /tmp/run/8021xd_"..main_ifname..".pid | xargs kill -9")
os.execute("rm /tmp/run/8021xd_"..main_ifname..".pid")
end
if enable then
for _, pat in ipairs(pat_auth_mode) do
if string.find(auth_mode, pat) then
apd_en = true
end
end
for _, pat in ipairs(pat_ieee8021x) do
if string.find(ieee8021x, pat) then
apd_en = true
end
end
if apd_en then
os.execute("8021xd -p "..prefix.. " -i "..main_ifname)
end
end
end

View File

@ -1,19 +0,0 @@
diff -urN a/mt_wifi/mt_wifi/embedded/common/cmm_info.c b/mt_wifi/mt_wifi/embedded/common/cmm_info.c
--- a/mt_wifi/embedded/common/cmm_info.c 2018-11-01 10:03:25.663408611 +0000
+++ b/mt_wifi/embedded/common/cmm_info.c 2018-11-01 10:09:14.991395503 +0000
@@ -3200,6 +3200,15 @@
else
need_send = FALSE;
}
+#if 1
+ /* [2018.11.01 hepark] To fill 5G information */
+ else if (!strcmp(wrq->ifr_ifrn.ifrn_name, "rai0")) {
+ if (!memcmp(pEntry->wdev->if_dev->name, "rax", 3))
+ need_send = FALSE;
+ else
+ need_send = TRUE;
+ }
+#endif
}
if (IS_ENTRY_CLIENT(pEntry) && (pEntry->Sst == SST_ASSOC) && (need_send == TRUE)) {
pDst = &pMacTab->Entry[pMacTab->Num];

View File

@ -1,167 +0,0 @@
diff -urN a/mt_wifi/embedded/common/ee_flash.c b/mt_wifi/embedded/common/ee_flash.c
--- a/mt_wifi/embedded/common/ee_flash.c 2018-04-30 15:57:54.000000000 +0800
+++ b/mt_wifi/embedded/common/ee_flash.c 2019-01-14 21:28:38.163721571 +0800
@@ -111,8 +111,8 @@
int mt_mtd_write_nm_wifi(char *name, loff_t to, size_t len, const u_char *buf);
int mt_mtd_read_nm_wifi(char *name, loff_t from, size_t len, u_char *buf);
-#define flash_read(_ctrl, _ptr, _offset, _len) mt_mtd_read_nm_wifi("Factory", _offset, (size_t)_len, _ptr)
-#define flash_write(_ctrl, _ptr, _offset, _len) mt_mtd_write_nm_wifi("Factory", _offset, (size_t)_len, _ptr)
+#define flash_read(_ctrl, _ptr, _offset, _len) mt_mtd_read_nm_wifi("factory", _offset&0xFFFF, (size_t)_len, _ptr)
+#define flash_write(_ctrl, _ptr, _offset, _len) mt_mtd_write_nm_wifi("factory", _offset&0xFFFF, (size_t)_len, _ptr)
#else
/*
@@ -122,8 +122,8 @@
extern int ra_mtd_write_nm(char *name, loff_t to, size_t len, const u_char *buf);
extern int ra_mtd_read_nm(char *name, loff_t from, size_t len, u_char *buf);
-#define flash_read(_ctrl, _ptr, _offset, _len) ra_mtd_read_nm("Factory", _offset, (size_t)_len, _ptr)
-#define flash_write(_ctrl, _ptr, _offset, _len) ra_mtd_write_nm("Factory", _offset, (size_t)_len, _ptr)
+#define flash_read(_ctrl, _ptr, _offset, _len) ra_mtd_read_nm("factory", _offset&0xFFFF, (size_t)_len, _ptr)
+#define flash_write(_ctrl, _ptr, _offset, _len) ra_mtd_write_nm("factory", _offset&0xFFFF, (size_t)_len, _ptr)
#endif /*CONFIG_WIFI_MTD*/
#endif /*RA_MTD_RW_BY_NUM*/
diff -urN a/mt_wifi/embedded/common/eeprom.c b/mt_wifi/embedded/common/eeprom.c
--- a/mt_wifi/embedded/common/eeprom.c 2018-04-30 15:57:54.000000000 +0800
+++ b/mt_wifi/embedded/common/eeprom.c 2019-04-19 17:05:48.336239756 +0800
@@ -646,7 +646,7 @@
efuse_probe(pAd);
#endif /* RTMP_EFUSE_SUPPORT */
- /* rtmp_eeprom_of_platform(pAd); //for MT7615, only use E2pAccessMode parameter to get eeprom type */
+ rtmp_eeprom_of_platform(pAd); //for MT7615, only use E2pAccessMode parameter to get eeprom type */
if (forceMode != E2P_NONE && forceMode < NUM_OF_E2P_MODE) {
e2p_type = forceMode;
diff -urN a/mt_wifi/os/linux/mt_wifi_mtd.c b/mt_wifi/os/linux/mt_wifi_mtd.c
--- a/mt_wifi/os/linux/mt_wifi_mtd.c 1970-01-01 08:00:00.000000000 +0800
+++ b/mt_wifi/os/linux/mt_wifi_mtd.c 2019-01-06 17:17:32.771446000 +0800
@@ -0,0 +1,113 @@
+/*
+ ***************************************************************************
+ * MediaTek Inc.
+ *
+ * All rights reserved. source code is an unpublished work and the
+ * use of a copyright notice does not imply otherwise. This source code
+ * contains confidential trade secret material of MediaTek. Any attemp
+ * or participation in deciphering, decoding, reverse engineering or in any
+ * way altering the source code is stricitly prohibited, unless the prior
+ * written consent of MediaTek, Inc. is obtained.
+ ***************************************************************************
+ Module Name:
+ mt_wifi_mtd.c
+
+*/
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+#include <asm/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/concat.h>
+#include <linux/mtd/partitions.h>
+#if defined (CONFIG_MIPS)
+#include <asm/addrspace.h>
+#endif
+
+int mt_mtd_write_nm_wifi(char *name, loff_t to, size_t len, const u_char *buf)
+{
+ int ret = -1;
+ size_t rdlen, wrlen;
+ struct mtd_info *mtd;
+ struct erase_info ei;
+ u_char *bak = NULL;
+
+ mtd = get_mtd_device_nm(name);
+ if (IS_ERR(mtd))
+ return -1;
+
+ if (len > mtd->erasesize) {
+ put_mtd_device(mtd);
+ return -E2BIG;
+ }
+
+ bak = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (bak == NULL) {
+ put_mtd_device(mtd);
+ return -ENOMEM;
+ }
+
+ ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak);
+
+ if (ret != 0) {
+ put_mtd_device(mtd);
+ kfree(bak);
+ return ret;
+ }
+
+ if (rdlen != mtd->erasesize)
+ printk("warning: ra_mtd_write: rdlen is not equal to erasesize\n");
+
+ memcpy(bak + to, buf, len);
+
+ ei.mtd = mtd;
+ ei.callback = NULL;
+ ei.addr = 0;
+ ei.len = mtd->erasesize;
+ ei.priv = 0;
+
+ ret = mtd_erase(mtd, &ei);
+
+ if (ret != 0) {
+ put_mtd_device(mtd);
+ kfree(bak);
+ return ret;
+ }
+
+ ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak);
+
+
+
+ put_mtd_device(mtd);
+ kfree(bak);
+ return ret;
+}
+EXPORT_SYMBOL(mt_mtd_write_nm_wifi);
+
+
+int mt_mtd_read_nm_wifi(char *name, loff_t from, size_t len, u_char *buf)
+{
+ int ret;
+ size_t rdlen;
+ struct mtd_info *mtd;
+
+ mtd = get_mtd_device_nm(name);
+ if (IS_ERR(mtd))
+ return -1;
+
+ ret = mtd_read(mtd, from, len, &rdlen, buf);
+
+ if (rdlen != len)
+ printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n");
+
+ put_mtd_device(mtd);
+
+ return ret;
+}
+EXPORT_SYMBOL(mt_mtd_read_nm_wifi);
diff -urN a/mt_wifi_ap/Makefile b/mt_wifi_ap/Makefile
--- a/mt_wifi_ap/Makefile 2018-04-30 15:57:57.000000000 +0800
+++ b/mt_wifi_ap/Makefile 2019-04-20 21:16:22.510780934 +0800
@@ -678,7 +678,8 @@
os_objs := $(SRC_DIR)/os/linux/rt_proc.o\
$(SRC_DIR)/os/linux/rt_linux.o\
$(SRC_DIR)/os/linux/rt_profile.o\
- $(SRC_DIR)/os/linux/rt_main_dev.o
+ $(SRC_DIR)/os/linux/rt_main_dev.o\
+ $(SRC_DIR)/os/linux/mt_wifi_mtd.o
ifeq ($(CONFIG_WLAN_HOOK),y)
EXTRA_CFLAGS +=-DRTMP_WLAN_HOOK_SUPPORT

View File

@ -1,53 +0,0 @@
#
# Copyright (C) 2016 MediaTek
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/version.mk
PKG_NAME:=wifi-l1profile
PKG_RELEASE:=1
PKG_BUILD_DEPENDS:=
PKG_FILE_DEPENDS:=
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/wifi-l1profile
SECTION:=MTK Properties
CATEGORY:=MTK Properties
SUBMENU:=Drivers
DEPENDS:=
TITLE:=Build WiFi l1profile.data on demand.
VERSION:=$(PKG_RELEASE)-$(REVISION)
MENU:=1
endef
define Package/wifi-l1profile/description
This package helps to build l1profile on demand.
endef
define Package/wifi-l1profile/config
if PACKAGE_wifi-l1profile
source "$(SOURCE)/l1profile.config.in"
endif
endef
define Build/Prepare
endef
define Build/Compile
rm -rf $(PKG_BUILD_DIR)
mkdir -p $(PKG_BUILD_DIR)
python ./make-l1profile.py $(TOPDIR)/.config /dev/null
endef
define Package/wifi-l1profile/install
$(INSTALL_DIR) $(1)/etc/wireless/
python ./make-l1profile.py $(TOPDIR)/.config $(1)/etc/wireless/l1profile.dat > /dev/null
endef
$(eval $(call BuildPackage,wifi-l1profile))

View File

@ -1,208 +0,0 @@
# l1profile configurations
menuconfig first_card
bool "1st card"
default y
if first_card
config first_card_name
string "1st card name"
default "MT7622"
config first_card_profile_path
string "profile path"
default "/etc/wireless/mediatek/mt7622.1.dat"
config first_card_init_script
string "init scripts"
default "/lib/wifi/mt7615e.lua"
config first_card_init_compatible
string "this chip uses a compatible driver"
default "mt7615e"
config first_card_EEPROM_offset
string "eeprom data offset (in flash mode)"
default "0x0"
config first_card_EEPROM_size
string "eeprom data size (in flash mode)"
default "0x5000"
config first_card_EEPROM_name
string "eeprom file name (request_firmware)"
default "e2p"
config first_card_main_ifname
string "primary interface name"
default "ra0"
config first_card_ext_ifname
string "interface prefix for multi-bssid"
default "ra"
config first_card_wds_ifname
string "WDS interface prefix"
default "wds"
config first_card_apcli_ifname
string "APCLI interface prefix"
default "apcli"
config first_card_mesh_ifname
string "MESH interface prefix"
default "mesh"
config first_card_nvram_zone
string "nvram zone"
default "dev1"
config first_card_single_sku_path
string "single SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku.dat"
config first_card_bf_sku_path
string "Beam forming SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku-bf.dat"
endif
menuconfig second_card
bool "2nd card"
default y
if second_card
config second_card_name
string "2nd card name"
default "MT7615"
config second_card_profile_path
string "profile path"
default "/etc/wireless/mediatek/mt7615e.1.dat"
config second_card_init_script
string "init scripts"
default "/lib/wifi/mt7615e.lua"
config second_card_init_compatible
string "this chip uses a compatible driver"
default "mt7615e"
config second_card_EEPROM_offset
string "eeprom data offset (in flash mode)"
default "0x5000"
config second_card_EEPROM_size
string "eeprom data size (in flash mode)"
default "0xB000"
config second_card_EEPROM_name
string "eeprom file name (request_firmware)"
default "e2p"
config second_card_main_ifname
string "primary interface name"
default "rai0"
config second_card_ext_ifname
string "interface prefix for multi-bssid"
default "rai"
config second_card_wds_ifname
string "WDS interface prefix"
default "wdsi"
config second_card_apcli_ifname
string "APCLI interface prefix"
default "apclii"
config second_card_mesh_ifname
string "MESH interface prefix"
default "meshi"
config second_card_nvram_zone
string "nvram zone"
default "dev2"
config second_card_single_sku_path
string "single SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku.dat"
config second_card_bf_sku_path
string "Beam forming SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku-bf.dat"
endif
menuconfig third_card
bool "3rd card"
default y
if third_card
config third_card_name
string "3rd card name"
default "MT7615"
config third_card_profile_path
string "profile path"
default "/etc/wireless/mediatek/mt7615e.2.dat"
config third_card_init_script
string "init scripts"
default "/lib/wifi/mt7615e.lua"
config third_card_init_compatible
string "this chip uses a compatible driver"
default "mt7615e"
config third_card_EEPROM_offset
string "eeprom data offset (in flash mode)"
default "0x10000"
config third_card_EEPROM_size
string "eeprom data size (in flash mode)"
default "0xB000"
config third_card_EEPROM_name
string "eeprom file name (request_firmware)"
default "e2p"
config third_card_main_ifname
string "primary interface name"
default "wlan0"
config third_card_ext_ifname
string "interface prefix for multi-bssid"
default "wlan"
config third_card_wds_ifname
string "WDS interface prefix"
default "wlan-wds"
config third_card_apcli_ifname
string "APCLI interface prefix"
default "wlan-apcli"
config third_card_mesh_ifname
string "MESH interface prefix"
default "wlan-mesh"
config third_card_nvram_zone
string "nvram zone"
default "dev3"
config third_card_single_sku_path
string "single SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku.dat"
config third_card_bf_sku_path
string "Beam forming SKU data path"
default "/etc/wireless/mediatek/mt7615e-sku-bf.dat"
endif

View File

@ -1,111 +0,0 @@
#!/usr/bin/env python
# Hua Shao <hua.shao@mediatek.com>
import sys
import re
import random
l1conf = []
def parseconfig(conf):
global l1conf
l1conf.extend([[],[],[]])
with open(conf, "r") as fp:
for line in fp:
if line.startswith("CONFIG_first_card_"):
kv = line.split("=")
l1conf[0].append((kv[0][len("CONFIG_first_card_"):], kv[1].strip("\"\'\r\n\t")))
elif line.startswith("CONFIG_second_card_"):
kv = line.split("=")
l1conf[1].append((kv[0][len("CONFIG_second_card_"):], kv[1].strip("\"\'\r\n\t")))
elif line.startswith("CONFIG_third_card_"):
kv = line.split("=")
l1conf[2].append((kv[0][len("CONFIG_third_card_"):], kv[1].strip("\"\'\r\n\t")))
else:
continue
def validate():
global l1conf
d1 = dict(l1conf[0]) if len(l1conf) > 0 else {}
d2 = dict(l1conf[1]) if len(l1conf) > 1 else {}
d3 = dict(l1conf[2]) if len(l1conf) > 2 else {}
# make sure no empty value
for dx in [d1,d2,d3]:
for k,v in dx.items():
assert v
# make sure these configs are unique
for name in ["main_ifname", "ext_ifname", "wds_ifname",
"apcli_name", "mesh_ifname", "nvram_zone",
"profile_path"]:
if1 = d1.get(name, random.random())
if2 = d2.get(name, random.random())
if3 = d3.get(name, random.random())
assert len(set([if1, if2, if3])) == 3, "duplication found in "+name
# main_ifname should end with "0"
if1 = [ x.strip() for x in d1.get("main_ifname","").split(";") if x]
if2 = [ x.strip() for x in d2.get("main_ifname","").split(";") if x]
if3 = [ x.strip() for x in d3.get("main_ifname","").split(";") if x]
for each in if1:
assert not each or each.endswith("0"), "1st main_ifname {0} does not ends with 0".format(each)
for each in if2:
assert not each or each.endswith("0"), "2nd main_ifname {0} does not ends with 0".format(each)
for each in if3:
assert not each or each.endswith("0"), "3rd main_ifname {0} does not ends with 0".format(each)
# main_ifname should start with ext_ifname
if1ext = [ x.strip() for x in d1.get("ext_ifname","").split(";") if x]
if2ext = [ x.strip() for x in d2.get("ext_ifname","").split(";") if x]
if3ext = [ x.strip() for x in d3.get("ext_ifname","").split(";") if x]
assert len(if1) == len(if1ext), "number of 1st main_ifname does not equal to 1st ext_ifname"
assert len(if2) == len(if2ext), "number of 2nd main_ifname does not equal to 2nd ext_ifname"
assert len(if3) == len(if3ext), "number of 3rd main_ifname does not equal to 3rd ext_ifname"
for i,each in enumerate(if1ext):
assert if1[i].startswith(each), "1st main_ifname {0} does not start with its ext_ifname {1}".format(if1[i], each)
for i,each in enumerate(if2ext):
assert if2[i].startswith(each), "2nd main_ifname {0} does not start with its ext_ifname {1}".format(if2[i], each)
for i,each in enumerate(if3ext):
assert if3[i].startswith(each), "3rd main_ifname {0} does not start with its ext_ifname {1}".format(if3[i], each)
# assertion failure or returning any python non-true value will terminate the build procedure.
# if you need more validations, feel free to add you code below.
return True
def genfile(dest):
global l1conf
with open(dest, "w") as fp:
print("Default")
fp.write("Default\n")
for i,lst in enumerate(l1conf):
for (k,v) in lst:
if k == "name":
line = "INDEX{0}={1}".format(i, v)
else:
line = "INDEX{0}_{1}={2}".format(i, k, v)
print(line)
fp.write(line+"\n")
fp.write("\n") # extra line-end to make drivers happy
if __name__ == "__main__":
if len(sys.argv) < 3:
print("arguments missing!")
print("usage: make-l1profile.py <.config> <l1profile.dat>!")
sys.exit(-1)
conf = sys.argv[1]
dest = sys.argv[2]
parseconfig(conf)
if validate():
genfile(dest)
else:
print("something is wrong with your l1profile configurations!")
sys.exit(-1)

View File

@ -1,84 +0,0 @@
# All rights reserved.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wifi_forward
PKG_REVISION:=01fc537c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_REVISION).tar.bz2
P4REV:=
PKG_VERSION:=
PKG_SOURCE_URL:=
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
PKG_KCONFIG:= \
MT_WIFI_PKT_FWD \
MT_WIFI_PKT_FWD_V1
PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)))
include $(INCLUDE_DIR)/package.mk
TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)
define KernelPackage/wifi_forward
CATEGORY:=MTK Properties
TITLE:=MTK wifi forward driver
ifeq ($(CONFIG_MT_WIFI_PKT_FWD_V1),y)
FILES:=$(PKG_BUILD_DIR)/wifi_fwd_v1/wifi_forward.ko
else
FILES:=$(PKG_BUILD_DIR)/wifi_fwd/wifi_forward.ko
endif
AUTOLOAD:=$(call AutoProbe,wifi_forward)
SUBMENU:=Drivers
MENU:=1
endef
define KernelPackage/wifi_forward/config
source "$(SOURCE)/config.in"
endef
ifeq ($(CONFIG_MT_WIFI_PKT_FWD_V1),y)
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=1 \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)/wifi_fwd_v1" \
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=$(CONFIG_$(c)))) \
modules
endef
else
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=1 \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)/wifi_fwd" \
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=$(CONFIG_$(c)))) \
modules
endef
endif
TARGET_CFLAGS += \
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),-DCONFIG_$(c)=$(CONFIG_$c)))
MAKE_FLAGS += \
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=$(CONFIG_$c)))
TARGET_CFLAGS += -DCONFIG_SUPPORT_OPENWRT
MAKE_FLAGS += CONFIG_SUPPORT_OPENWRT=y
define KernelPackage/wifi_forward/install
# $(INSTALL_DIR) $(1)/lib/modules/ralink/
# if [ "$$(CONFIG_MT_WIFI_PKT_FWD_V1)" = "y" ]; then \
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/wifi_fwd_v1/wifi_forward.ko $(1)/lib/modules/ralink/; \
# else \
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/wifi_fwd/wifi_forward.ko $(1)/lib/modules/ralink/; \
# fi
endef
$(eval $(call KernelPackage,wifi_forward))

View File

@ -1,16 +0,0 @@
if PACKAGE_kmod-wifi_forward
menu "WiFi Operation Modes"
config MT_WIFI_PKT_FWD
bool "WiFi package forward"
default y
config MT_WIFI_PKT_FWD_V1
depends on MT_WIFI_PKT_FWD
bool "WiFi package forward V1"
default n
endmenu
endif