devices: add device id for Realtek RTL8188CU and RTL8188FTV
[project/iwinfo.git] / iwinfo_cli.c
index 3bce96e5536fc3d30aca5b0ced1b9c29673f5e30..5dcee9ad023f4311fe75a7283d7c0bb788b6f976 100644 (file)
@@ -44,6 +44,17 @@ static char * format_ssid(char *ssid)
        return buf;
 }
 
+static const char *format_band(int band)
+{
+       const char *name;
+
+       name = iwinfo_band_name(band);
+       if (name)
+               return name;
+
+       return "unknown";
+}
+
 static char * format_channel(int ch)
 {
        static char buf[16];
@@ -68,6 +79,25 @@ static char * format_frequency(int freq)
        return buf;
 }
 
+static char * format_freqflags(uint32_t flags)
+{
+       static char str[512] = "[";
+       char *pos = str + 1;
+       int i;
+
+       if (!flags)
+               return "";
+
+       for (i = 0; i < IWINFO_FREQ_FLAG_COUNT; i++)
+               if (flags & (1 << i))
+                       pos += sprintf(pos, "%s, ", IWINFO_FREQ_FLAG_NAMES[i]);
+
+       *(pos - 2) = ']';
+       *(pos - 1) = 0;
+
+       return str;
+}
+
 static char * format_txpower(int pwr)
 {
        static char buf[16];
@@ -648,8 +678,10 @@ static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
                        format_bssid(e->mac));
                printf("          ESSID: %s\n",
                        format_ssid(e->ssid));
-               printf("          Mode: %s  Channel: %s\n",
+               printf("          Mode: %s  Frequency: %s  Band: %s  Channel: %s\n",
                        IWINFO_OPMODE_NAMES[e->mode],
+                       format_frequency(e->mhz),
+                       format_band(e->band),
                        format_channel(e->channel));
                printf("          Signal: %s  Quality: %s/%s\n",
                        format_signal(e->signal - 0x100),
@@ -729,11 +761,12 @@ static void print_freqlist(const struct iwinfo_ops *iw, const char *ifname)
        {
                e = (struct iwinfo_freqlist_entry *) &buf[i];
 
-               printf("%s %s (Channel %s)%s\n",
+               printf("%s %s (Band: %s, Channel %s) %s\n",
                        (freq == e->mhz) ? "*" : " ",
                        format_frequency(e->mhz),
+                       format_band(e->band),
                        format_channel(e->channel),
-                       e->restricted ? " [restricted]" : "");
+                       format_freqflags(e->flags));
        }
 }