X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/60e9be7f196f7fe48295fd50cbd322dbbaade63c..ca25ff4717cabbe4716838f2a79b82f84ff4bdd2:/package/iwinfo/src/iwinfo_madwifi.c?ds=sidebyside diff --git a/package/iwinfo/src/iwinfo_madwifi.c b/package/iwinfo/src/iwinfo_madwifi.c index 54082c737..50efcbfd4 100644 --- a/package/iwinfo/src/iwinfo_madwifi.c +++ b/package/iwinfo/src/iwinfo_madwifi.c @@ -333,7 +333,7 @@ void madwifi_close(void) /* Nop */ } -int madwifi_get_mode(const char *ifname, char *buf) +int madwifi_get_mode(const char *ifname, int *buf) { return wext_get_mode(ifname, buf); } @@ -726,9 +726,29 @@ int madwifi_get_assoclist(const char *ifname, char *buf, int *len) do { si = (struct ieee80211req_sta_info *) cp; + memset(&entry, 0, sizeof(entry)); + entry.signal = (si->isi_rssi - 95); entry.noise = noise; memcpy(entry.mac, &si->isi_macaddr, 6); + + entry.inactive = si->isi_inact * 1000; + + entry.tx_packets = (si->isi_txseqs[0] & IEEE80211_SEQ_SEQ_MASK) + >> IEEE80211_SEQ_SEQ_SHIFT; + + entry.rx_packets = (si->isi_rxseqs[0] & IEEE80211_SEQ_SEQ_MASK) + >> IEEE80211_SEQ_SEQ_SHIFT; + + entry.tx_rate.rate = + (si->isi_rates[si->isi_txrate] & IEEE80211_RATE_VAL) * 500; + + /* XXX: this is just a guess */ + entry.rx_rate.rate = entry.tx_rate.rate; + + entry.rx_rate.mcs = -1; + entry.tx_rate.mcs = -1; + memcpy(&buf[bl], &entry, sizeof(struct iwinfo_assoclist_entry)); bl += sizeof(struct iwinfo_assoclist_entry); @@ -987,3 +1007,61 @@ int madwifi_get_mbssid_support(const char *ifname, int *buf) return -1; } + +int madwifi_get_hardware_id(const char *ifname, char *buf) +{ + char vendor[64]; + char device[64]; + struct iwinfo_hardware_id *ids; + struct iwinfo_hardware_entry *e; + + if (wext_get_hardware_id(ifname, buf)) + return iwinfo_hardware_id_from_mtd((struct iwinfo_hardware_id *)buf); + + return 0; +} + +static const struct iwinfo_hardware_entry * +madwifi_get_hardware_entry(const char *ifname) +{ + struct iwinfo_hardware_id id; + + if (madwifi_get_hardware_id(ifname, (char *)&id)) + return NULL; + + return iwinfo_hardware(&id); +} + +int madwifi_get_hardware_name(const char *ifname, char *buf) +{ + const struct iwinfo_hardware_entry *hw; + + if (!(hw = madwifi_get_hardware_entry(ifname))) + sprintf(buf, "Generic Atheros"); + else + sprintf(buf, "%s %s", hw->vendor_name, hw->device_name); + + return 0; +} + +int madwifi_get_txpower_offset(const char *ifname, int *buf) +{ + const struct iwinfo_hardware_entry *hw; + + if (!(hw = madwifi_get_hardware_entry(ifname))) + return -1; + + *buf = hw->txpower_offset; + return 0; +} + +int madwifi_get_frequency_offset(const char *ifname, int *buf) +{ + const struct iwinfo_hardware_entry *hw; + + if (!(hw = madwifi_get_hardware_entry(ifname))) + return -1; + + *buf = hw->frequency_offset; + return 0; +}