return iwinfo_name(mask, IWINFO_HTMODE_COUNT, IWINFO_HTMODE_NAMES);
}
+uint32_t iwinfo_band2ghz(uint8_t band)
+{
+ switch (band)
+ {
+ case IWINFO_BAND_24:
+ return 2;
+ case IWINFO_BAND_5:
+ return 5;
+ case IWINFO_BAND_6:
+ return 6;
+ case IWINFO_BAND_60:
+ return 60;
+ }
+
+ return 0;
+}
+
+uint8_t iwinfo_ghz2band(uint32_t ghz)
+{
+ switch (ghz)
+ {
+ case 2:
+ return IWINFO_BAND_24;
+ case 5:
+ return IWINFO_BAND_5;
+ case 6:
+ return IWINFO_BAND_6;
+ case 60:
+ return IWINFO_BAND_60;
+ }
+
+ return 0;
+}
+
size_t iwinfo_format_hwmodes(int modes, char *buf, size_t len)
{
// bit numbers as per IWINFO_80211_*: ad ac ax a b g n
while (fgets(buf, sizeof(buf) - 1, db) != NULL)
{
+ if (buf[0] == '#')
+ continue;
+
memset(&e, 0, sizeof(e));
if (sscanf(buf, "%hx %hx %hx %hx %hd %hd \"%63[^\"]\" \"%63[^\"]\"",
&e.vendor_id, &e.device_id,
&e.subsystem_vendor_id, &e.subsystem_device_id,
&e.txpower_offset, &e.frequency_offset,
- e.vendor_name, e.device_name) < 8)
+ e.vendor_name, e.device_name) != 8 &&
+ sscanf(buf, "\"%127[^\"]\" %hd %hd \"%63[^\"]\" \"%63[^\"]\"",
+ e.compatible, &e.txpower_offset, &e.frequency_offset,
+ e.vendor_name, e.device_name) != 5)
continue;
if ((e.vendor_id != 0xffff) && (e.vendor_id != id->vendor_id))
(e.subsystem_device_id != id->subsystem_device_id))
continue;
+ if (strcmp(e.compatible, id->compatible))
+ continue;
+
rv = &e;
break;
}