cli: print the band on the frequency list
[project/iwinfo.git] / iwinfo_cli.c
index 9b3e8e367d6254d32be0c06d6e503d743b36b6de..02296acd1b1a6a4e0a51ca76bfcb1b28656aca50 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];
@@ -337,6 +348,10 @@ static char * print_hardware_id(const struct iwinfo_ops *iw, const char *ifname)
        {
                if (strlen(ids.compatible) > 0)
                        snprintf(buf, sizeof(buf), "embedded");
+               else if (ids.vendor_id == 0 && ids.device_id == 0 &&
+                        ids.subsystem_vendor_id != 0 && ids.subsystem_device_id != 0)
+                       snprintf(buf, sizeof(buf), "USB %04X:%04X",
+                               ids.subsystem_vendor_id, ids.subsystem_device_id);
                else
                        snprintf(buf, sizeof(buf), "%04X:%04X %04X:%04X",
                                ids.vendor_id, ids.device_id,
@@ -725,9 +740,10 @@ 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]" : "");
        }