From 6f156e443df2641863ea909cb1cc3dfc46eb564f Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:39:25 +0800 Subject: [PATCH] luci-app-mtwifi: add wifi relay support (#5168) * luci-app-mtwifi: add wifi relay support Source code: Nossiac/mtk-openwrt-feeds Based on commit 'wireless: wext: remove ndo_do_ioctl fallback' * luci-app-mtwifi: fix ap-scan failed * luci-app-mtwifi: show overview when relay is enabled --- package/lean/mt/drivers/mt7603e/Makefile | 1 + package/lean/mt/drivers/mt7612e/Makefile | 1 + package/lean/mt/drivers/mt_wifi/Makefile | 2 +- package/lean/mt/luci-app-mtwifi/Makefile | 2 +- .../luasrc/view/admin_mtk/mtk_wifi_apcli.htm | 37 +++++++++--------- .../view/admin_mtk/mtk_wifi_overview.htm | 39 +++++++++++++++++++ .../root/usr/lib/lua/mtkwifi.lua | 4 +- 7 files changed, 65 insertions(+), 21 deletions(-) diff --git a/package/lean/mt/drivers/mt7603e/Makefile b/package/lean/mt/drivers/mt7603e/Makefile index f34f3a37954686..e3cdd582723c7d 100644 --- a/package/lean/mt/drivers/mt7603e/Makefile +++ b/package/lean/mt/drivers/mt7603e/Makefile @@ -36,6 +36,7 @@ TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS) define KernelPackage/mt7603e CATEGORY:=Kernel modules TITLE:=MTK wifi AP driver + DEPENDS:=@TARGET_ramips FILES:=$(PKG_BUILD_DIR)/mt7603_wifi_ap/mt7603e.ko SUBMENU:=Wireless Drivers MENU:=1 diff --git a/package/lean/mt/drivers/mt7612e/Makefile b/package/lean/mt/drivers/mt7612e/Makefile index 82664e462384f0..546ae28db1761a 100644 --- a/package/lean/mt/drivers/mt7612e/Makefile +++ b/package/lean/mt/drivers/mt7612e/Makefile @@ -24,6 +24,7 @@ TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS) define KernelPackage/mt76x2e CATEGORY:=Kernel modules TITLE:=MTK MT76x2e wifi AP driver + DEPENDS:=@TARGET_ramips FILES:=$(PKG_BUILD_DIR)/mt76x2_ap/mt76x2_ap.ko SUBMENU:=Wireless Drivers MENU:=1 diff --git a/package/lean/mt/drivers/mt_wifi/Makefile b/package/lean/mt/drivers/mt_wifi/Makefile index 827a7781a8bd30..6b60be388886d3 100644 --- a/package/lean/mt/drivers/mt_wifi/Makefile +++ b/package/lean/mt/drivers/mt_wifi/Makefile @@ -21,7 +21,7 @@ define Package/mt_wifi SECTION:=net CATEGORY:=Network TITLE:=MTK wifi AP config - DEPENDS:=@TARGET_ramips + DEPENDS:=@TARGET_ramips +wireless-tools SUBMENU:=Wireless endef diff --git a/package/lean/mt/luci-app-mtwifi/Makefile b/package/lean/mt/luci-app-mtwifi/Makefile index fe0a7cdf90c83b..984f02f0a6b158 100644 --- a/package/lean/mt/luci-app-mtwifi/Makefile +++ b/package/lean/mt/luci-app-mtwifi/Makefile @@ -7,7 +7,7 @@ LUCI_TITLE:=LuCI support for mt wifi driver LUCI_DEPENDS:=@TARGET_ramips +mt_wifi LUCI_PKGARCH:=all PKG_VERSION:=1 -PKG_RELEASE:=12 +PKG_RELEASE:=15 define Package/luci-app-mtwifi/conffiles /etc/wireless/mt7615/ diff --git a/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_apcli.htm b/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_apcli.htm index 39c356eab07374..eb5995b8602cc6 100644 --- a/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_apcli.htm +++ b/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_apcli.htm @@ -56,7 +56,7 @@ iwpriv <%=vifname%> set ApCliEnable=1 // enable sta mode

- +

- Connection Configurations + 中继参数 @@ -79,21 +79,21 @@ - + - + - + - + style="display: none;"<% end %>> - + - + @@ -138,7 +138,7 @@ style="display: none;"<% end %>> - + - + <% end %> + + <% if dev.apcli then %> + <% if dev.apcli.state == "up" then %> + + + + + + + <% end %> + <% end %> +
Root AP SSID上级无线名称
Root AP Channel上级无线信道 This will overwrite ap channel. 将会重置当前信道
Root AP Authentication Mode上级无线加密模式
Root AP Encryption上级无线加密算法
Root AP WPA Key上级无线密码
Root AP Encryption上级无线加密算法
Root AP WEP Key上级无线密码 @@ -162,9 +162,10 @@
- - - + + + +
@@ -230,17 +231,17 @@ var tr = table.insertRow(0); var td0 = tr.insertCell(0); - td0.innerHTML = 'SSID'; + td0.innerHTML = '无线名称'; var td1 = tr.insertCell(1); - td1.innerHTML = 'Channel'; + td1.innerHTML = '信道'; var td2 = tr.insertCell(2); td2.innerHTML = 'BSSID'; var td3 = tr.insertCell(3); - td3.innerHTML = 'Security'; + td3.innerHTML = '加密方式'; var td4 = tr.insertCell(4); - td4.innerHTML = 'RSSI'; + td4.innerHTML = '信号强度'; var td5 = tr.insertCell(5); - td5.innerHTML = 'Action'; + td5.innerHTML = '动作'; var div = document.getElementById('aplist'); div.innerHTML = ""; diff --git a/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_overview.htm b/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_overview.htm index 1d6216566738ca..f9b21125ad388b 100644 --- a/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_overview.htm +++ b/package/lean/mt/luci-app-mtwifi/luasrc/view/admin_mtk/mtk_wifi_overview.htm @@ -81,11 +81,50 @@

无线概况

'" /> <% end %> '" /> + <% if dev.apcli.state == "down" then %> + '" /> + <% end %> '" />
+ <% if dev.apcli.state == "up" then %> + + <% else %> + + <% end %> + 接口: <%=dev.apcli.devname%> | 类型: STA | 状态: <%=dev.apcli.status%> +
+ <% if dev.apcli.status == "Connected" then %> + BSSID::<%=dev.apcli.bssid%> | + SSID::<%=dev.apcli.ssid%> + <% else %> + Wireless is disabled or not associated + <% end %> +
+ '" /> + + <% if dev.apcli.status == "Connected" then %> + + <% else %> + + <% end %> + + '" /> +
diff --git a/package/lean/mt/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua b/package/lean/mt/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua index b5128f21529016..418debf90708e2 100644 --- a/package/lean/mt/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua +++ b/package/lean/mt/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua @@ -856,7 +856,9 @@ function mtkwifi.scan_ap(vifname) 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])) + if (xx.WPS[1] ~= nil and xx.WPS[2] ~= nil) then + tmp.wps = mtkwifi.__trim(string.sub(line, xx.WPS[1], xx.WPS[1]+xx.WPS[2])) + end tmp.nt = mtkwifi.__trim(string.sub(line, xx.NT[1], xx.NT[1]+xx.NT[2])) table.insert(aplist, tmp) end