devices: add device id for MediaTek MT7996e
[project/iwinfo.git] / iwinfo_lua.c
index a2fe9d18ffbfe630fe3b3a5e2c3409e39d10c72c..fbe8c7c9870588043d2f1b04a6f4bb6fcd615e09 100644 (file)
@@ -155,10 +155,12 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
 
                                for (i = 0; i < 3; i++)
                                        if (c->wpa_version & (1 << i))
+                                       {
                                                if (i)
                                                        pos += sprintf(pos, "WPA%d/", i + 1);
                                                else
                                                        pos += sprintf(pos, "WPA/");
+                                       }
 
                                pos--;
 
@@ -277,7 +279,10 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
        lua_pushboolean(L, r->is_he);
        lua_setfield(L, -2, rx ? "rx_he" : "tx_he");
 
-       lua_pushnumber(L, r->mhz);
+       lua_pushboolean(L, r->is_eht);
+       lua_setfield(L, -2, rx ? "rx_eht" : "tx_eht");
+
+       lua_pushnumber(L, r->mhz_hi * 256 + r->mhz);
        lua_setfield(L, -2, rx ? "rx_mhz" : "tx_mhz");
 
        if (r->is_ht)
@@ -291,7 +296,7 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
                lua_pushboolean(L, r->is_short_gi);
                lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
        }
-       else if (r->is_vht || r->is_he)
+       else if (r->is_vht || r->is_he | r->is_eht)
        {
                lua_pushnumber(L, r->mcs);
                lua_setfield(L, -2, rx ? "rx_mcs" : "tx_mcs");
@@ -307,6 +312,11 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
                        lua_setfield(L, -2, rx ? "rx_he_dcm" : "tx_he_dcm");
                }
 
+               if (r->is_eht) {
+                       lua_pushnumber(L, r->eht_gi);
+                       lua_setfield(L, -2, rx ? "rx_eht_gi" : "tx_eht_gi");
+               }
+
                if (r->is_vht) {
                        lua_pushboolean(L, r->is_short_gi);
                        lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
@@ -552,6 +562,9 @@ static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *))
                lua_pushboolean(L, hwmodes & IWINFO_80211_AX);
                lua_setfield(L, -2, "ax");
 
+               lua_pushboolean(L, hwmodes & IWINFO_80211_BE);
+               lua_setfield(L, -2, "be");
+
                return 1;
        }
 
@@ -776,6 +789,7 @@ LUA_WRAP_STRUCT_OP(nl80211,hardware_id)
 #endif
 
 /* Wext */
+#ifdef USE_WEXT
 LUA_WRAP_INT_OP(wext,channel)
 LUA_WRAP_INT_OP(wext,frequency)
 LUA_WRAP_INT_OP(wext,frequency_offset)
@@ -802,6 +816,7 @@ LUA_WRAP_STRUCT_OP(wext,htmodelist)
 LUA_WRAP_STRUCT_OP(wext,encryption)
 LUA_WRAP_STRUCT_OP(wext,mbssid_support)
 LUA_WRAP_STRUCT_OP(wext,hardware_id)
+#endif
 
 #ifdef USE_WL
 /* Broadcom table */
@@ -903,6 +918,7 @@ static const luaL_reg R_nl80211[] = {
 #endif
 
 /* Wext table */
+#ifdef USE_WEXT
 static const luaL_reg R_wext[] = {
        LUA_REG(wext,channel),
        LUA_REG(wext,frequency),
@@ -932,6 +948,7 @@ static const luaL_reg R_wext[] = {
        LUA_REG(wext,phyname),
        { NULL, NULL }
 };
+#endif
 
 /* Common */
 static const luaL_reg R_common[] = {
@@ -971,12 +988,14 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
        lua_setfield(L, -2, "nl80211");
 #endif
 
+#ifdef USE_WEXT
        luaL_newmetatable(L, IWINFO_WEXT_META);
        luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_wext);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");
        lua_setfield(L, -2, "wext");
+#endif
 
        return 1;
 }