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
- +
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