devices: add device id for Realtek RTL8188CU and RTL8188FTV
[project/iwinfo.git] / iwinfo_lua.c
index 9935a8daa5d7a840cbbaec199496fe3de662af8c..ecf257d67678331425bbc2a8a496d20ba038a060 100644 (file)
@@ -61,9 +61,15 @@ static char * iwinfo_crypto_print_ciphers(int ciphers)
        if (ciphers & IWINFO_CIPHER_CCMP)
                pos += sprintf(pos, "CCMP, ");
 
+       if (ciphers & IWINFO_CIPHER_CCMP256)
+               pos += sprintf(pos, "CCMP-256, ");
+
        if (ciphers & IWINFO_CIPHER_GCMP)
                pos += sprintf(pos, "GCMP, ");
 
+       if (ciphers & IWINFO_CIPHER_GCMP256)
+               pos += sprintf(pos, "GCMP-256, ");
+
        if (ciphers & IWINFO_CIPHER_WRAP)
                pos += sprintf(pos, "WRAP, ");
 
@@ -149,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--;
 
@@ -268,6 +276,9 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
        lua_pushboolean(L, r->is_vht);
        lua_setfield(L, -2, rx ? "rx_vht" : "tx_vht");
 
+       lua_pushboolean(L, r->is_he);
+       lua_setfield(L, -2, rx ? "rx_he" : "tx_he");
+
        lua_pushnumber(L, r->mhz);
        lua_setfield(L, -2, rx ? "rx_mhz" : "tx_mhz");
 
@@ -282,7 +293,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)
+       else if (r->is_vht || r->is_he)
        {
                lua_pushnumber(L, r->mcs);
                lua_setfield(L, -2, rx ? "rx_mcs" : "tx_mcs");
@@ -290,8 +301,18 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
                lua_pushnumber(L, r->nss);
                lua_setfield(L, -2, rx ? "rx_nss" : "tx_nss");
 
-               lua_pushboolean(L, r->is_short_gi);
-               lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+               if (r->is_he) {
+                       lua_pushnumber(L, r->he_gi);
+                       lua_setfield(L, -2, rx ? "rx_he_gi" : "tx_he_gi");
+
+                       lua_pushnumber(L, r->he_dcm);
+                       lua_setfield(L, -2, rx ? "rx_he_dcm" : "tx_he_dcm");
+               }
+
+               if (r->is_vht) {
+                       lua_pushboolean(L, r->is_short_gi);
+                       lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+               }
        }
 }
 
@@ -757,6 +778,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)
@@ -783,6 +805,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 */
@@ -884,6 +907,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),
@@ -913,6 +937,7 @@ static const luaL_reg R_wext[] = {
        LUA_REG(wext,phyname),
        { NULL, NULL }
 };
+#endif
 
 /* Common */
 static const luaL_reg R_common[] = {
@@ -952,12 +977,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;
 }