libs/iwinfo: fixes for wpa/wep detection in wifi scan
[project/luci.git] / libs / iwinfo / src / iwinfo_wl.c
index 3362475..8387b9f 100644 (file)
@@ -128,6 +128,11 @@ int wl_get_channel(const char *ifname, int *buf)
        return wl_ioctl(ifname, WLC_GET_CHANNEL, buf, sizeof(buf));
 }
 
+int wl_get_frequency(const char *ifname, int *buf)
+{
+       return wext_get_frequency(ifname, buf);
+}
+
 int wl_get_bitrate(const char *ifname, int *buf)
 {
        int ret = -1;
@@ -361,3 +366,43 @@ int wl_get_assoclist(const char *ifname, char *buf, int *len)
        return -1;
 }
 
+int wl_get_txpwrlist(const char *ifname, char *buf, int *len)
+{
+       struct iwinfo_txpwrlist_entry entry;
+       uint8_t dbm[8] = { 0, 6, 8, 10, 12, 14, 16, 18 };
+       uint8_t mw[8]  = { 1, 3, 6, 10, 15, 25, 39, 63 };
+       int i;
+
+       for( i = 0; i < 8; i++ )
+       {
+               entry.dbm = dbm[i];
+               entry.mw  = mw[i];
+               memcpy(&buf[i*sizeof(entry)], &entry, sizeof(entry));
+       }
+
+       *len = 8 * sizeof(entry);
+       return 0;
+}
+
+int wl_get_scanlist(const char *ifname, char *buf, int *len)
+{
+       return wext_get_scanlist(ifname, buf, len);
+}
+
+int wl_get_mbssid_support(const char *ifname, int *buf)
+{
+       wlc_rev_info_t revinfo;
+
+       /* Multi bssid support only works on corerev >= 9 */
+       if( !wl_ioctl(ifname, WLC_GET_REVINFO, &revinfo, sizeof(revinfo)) )
+       {
+               if( revinfo.corerev >= 9 )
+               {
+                       *buf = 1;
+                       return 0;
+               }
+       }
+
+       return -1;
+}
+