diff --git a/package/mtk/applications/luci-app-mtk/luasrc/view/admin_mtk/mtk_wifi_overview.htm b/package/mtk/applications/luci-app-mtk/luasrc/view/admin_mtk/mtk_wifi_overview.htm
index 36edb7aa7d..c974019b4e 100644
--- a/package/mtk/applications/luci-app-mtk/luasrc/view/admin_mtk/mtk_wifi_overview.htm
+++ b/package/mtk/applications/luci-app-mtk/luasrc/view/admin_mtk/mtk_wifi_overview.htm
@@ -85,7 +85,11 @@ local chipname
<%:Work mode%>: <% if dev.ApCliEnable == "1" then %> APCli <% else %> AP <% end %>
<%local temp = mtkwifi.get_temp(dev.devname)%>
<%if temp then%>
- <%:Tempature%>: <%=temp%>°C
+ <%:Tempature%>: <%=temp%>°C
+ <%end%>
+ <%local txpwr = mtkwifi.get_txpwr(dev.devname)%>
+ <%if txpwr then%>
+ <%:Tx Power%>: <%=txpwr%> dbm
<%end%>
<%end%>
diff --git a/package/mtk/applications/luci-app-mtk/po/zh_Hans/mtk.po b/package/mtk/applications/luci-app-mtk/po/zh_Hans/mtk.po
index 62c7e3ac95..fb99439320 100644
--- a/package/mtk/applications/luci-app-mtk/po/zh_Hans/mtk.po
+++ b/package/mtk/applications/luci-app-mtk/po/zh_Hans/mtk.po
@@ -46,6 +46,9 @@ msgstr "始终关闭"
msgid "Tempature"
msgstr "温度"
+msgid "Tx Power"
+msgstr "发射功率"
+
msgid "Driver version"
msgstr "驱动版本"
diff --git a/package/mtk/applications/luci-app-mtk/root/usr/lib/lua/mtkwifi.lua b/package/mtk/applications/luci-app-mtk/root/usr/lib/lua/mtkwifi.lua
index 227b333c5b..b560cfb5dc 100644
--- a/package/mtk/applications/luci-app-mtk/root/usr/lib/lua/mtkwifi.lua
+++ b/package/mtk/applications/luci-app-mtk/root/usr/lib/lua/mtkwifi.lua
@@ -344,6 +344,21 @@ function mtkwifi.__profile_applied_settings_path(profile)
return bak
end
+function mtkwifi.get_txpwr(devname)
+ local l1dat, l1 = mtkwifi.__get_l1dat()
+ local dridx = l1.DEV_RINDEX
+ local devs = mtkwifi.get_all_devs()
+
+ if devs and devs[devname] then
+ local ifname = l1dat and l1dat[dridx][devname].main_ifname
+ if ifname then
+ return c_getTxPower(ifname)['txpower']
+ end
+ end
+
+ return nil
+end
+
function mtkwifi.get_temp(devname)
local vif_name = nil
local devs = mtkwifi.get_all_devs()
diff --git a/package/mtk/applications/luci-app-mtk/src/ioctl_helper.c b/package/mtk/applications/luci-app-mtk/src/ioctl_helper.c
index 87a26ed8b7..979d57953c 100644
--- a/package/mtk/applications/luci-app-mtk/src/ioctl_helper.c
+++ b/package/mtk/applications/luci-app-mtk/src/ioctl_helper.c
@@ -20,6 +20,7 @@ int luaopen_ioctl_helper(lua_State *L)
lua_register(L,"c_getWMode",getWMOde);
lua_register(L,"c_getTempature",getTempature);
lua_register(L,"c_scanResult",scanResult);
+ lua_register(L,"c_getTxPower",getTxPower);
return 0;
}
@@ -100,6 +101,44 @@ int getTempature(lua_State *L)
return 1;
}
+static unsigned int get_txpower(const char *interface)
+{
+ int socket_id;
+ struct iwreq wrq;
+ int txpower = 0;
+ socket_id = socket(AF_INET, SOCK_DGRAM, 0);
+ if (socket_id < 0) {
+ perror("socket() failed");
+ return socket_id;
+ }
+
+ snprintf(wrq.ifr_name, sizeof(wrq.ifr_name), "%s", interface);
+ wrq.u.txpower.flags = 0;
+
+ if(ioctl(socket_id, SIOCGIWTXPOW, &wrq) >= 0) {
+ txpower = wrq.u.txpower.value;
+ } else {
+ fprintf(stderr, "%s: ioctl fail\n", __func__);
+ }
+
+ close(socket_id);
+
+ return txpower;
+}
+
+int getTxPower(lua_State *L)
+{
+ char tempstr[5] = {0};
+ const char *interface = luaL_checkstring(L, 1);
+ snprintf(tempstr, sizeof(tempstr), "%d", get_txpower(interface));
+ lua_newtable(L);
+ lua_pushstring(L, "txpower"); /* push key */
+ lua_pushstring(L, tempstr); /* push value */
+ lua_settable(L, -3);
+ /* Returning one table which is already on top of Lua stack. */
+ return 1;
+}
+
static unsigned int get_w_mode(const char *interface)
{
int socket_id;
diff --git a/package/mtk/applications/luci-app-mtk/src/mtwifi.h b/package/mtk/applications/luci-app-mtk/src/mtwifi.h
index dafc5f351a..bc8181018e 100644
--- a/package/mtk/applications/luci-app-mtk/src/mtwifi.h
+++ b/package/mtk/applications/luci-app-mtk/src/mtwifi.h
@@ -208,6 +208,7 @@ int get_macaddr(lua_State *L);
int convert_string_display(lua_State *L);
int StaInfo(lua_State *L);
int getWMOde(lua_State *L);
+int getTxPower(lua_State *L);
int getTempature(lua_State *L);
int scanResult(lua_State *L);
void getRate(HTTRANSMIT_SETTING_FIX HTSetting, ULONG *fLastTxRxRate);