diff -r -u Prism2-2002-04-05.orig/driver/modules/prism2.c Prism2-2002-04-05/driver/modules/prism2.c --- Prism2-2002-04-05.orig/driver/modules/prism2.c Sun Apr 7 13:04:00 2002 +++ Prism2-2002-04-05/driver/modules/prism2.c Sun Apr 7 13:11:39 2002 @@ -1032,6 +1032,29 @@ static struct iw_statistics *prism2_get_wireless_stats(struct net_device *dev) { local_info_t *local = (local_info_t *) dev->priv; + struct hfa384x_comms_quality comms_quality; + + /* Retrieve and parse wireless signal stats */ + + if (local->iw_mode != IW_MODE_MASTER && + hfa384x_get_rid(local->dev, HFA384X_RID_COMMSQUALITY, + &comms_quality, sizeof(comms_quality), 0)) { + + /* Formulas as from post by Jodi Morgo */ + + /* local->wstats.qual.qual = __le16_to_cpu(comms_quality.coms_qual); + * local->wstats.qual.level = 0x100 + ( __le16_to_cpu(comms_quality.signal_lvl) * 100 / 255 ) - 100; + * local->wstats.qual.noise = 0x100 + ( __le16_to_cpu(comms_quality.noise_lvl) * 100 / 255 ) - 100; + */ + + /* Formulas from wvlan_cs */ + + local->wstats.qual.qual = max(min(__le16_to_cpu(comms_quality.coms_qual), 0x8b-0x2f), 0); + local->wstats.qual.level = max(min(__le16_to_cpu(comms_quality.signal_lvl), 0x8a), 0x2f) - 0x95; + local->wstats.qual.noise = max(min(__le16_to_cpu(comms_quality.noise_lvl), 0x8a), 0x2f) - 0x95; + local->wstats.qual.updated = 7; + } + local->wstats.status = 0; local->wstats.discard.code = local->comm_tallies.rx_discards_wep_undecryptable; @@ -2729,7 +2752,7 @@ } range.num_frequency = val; - range.max_qual.qual = 0x9a; + range.max_qual.qual = 0x5c; /* quality doesn't seem to go above */ range.max_qual.level = 0x9a; range.max_qual.noise = 0x9a; range.sensitivity = 3; diff -r -u Prism2-2002-04-05.orig/driver/modules/prism2_wlan.h Prism2-2002-04-05/driver/modules/prism2_wlan.h --- Prism2-2002-04-05.orig/driver/modules/prism2_wlan.h Fri Apr 5 12:44:31 2002 +++ Prism2-2002-04-05/driver/modules/prism2_wlan.h Sun Apr 7 12:32:03 2002 @@ -11,6 +11,16 @@ #define ARPHRD_IEEE80211 801 #endif +/* CFG_COMMS_QUALITY (0xFD43) Quality of the Basic Service Set connection [STA] */ +struct hfa384x_comms_quality { + /* Communication Quality of the BSS the station is connected to */ + u16 coms_qual __attribute__ ((packed)); + /* Average Signal Level of the BSS the station is connected to */ + u16 signal_lvl __attribute__ ((packed)); + /* Average Noise Level of the currently used Frequency Channel */ + u16 noise_lvl __attribute__ ((packed)); +}; + struct hfa384x_rx_frame { /* HFA384X RX frame descriptor */ u16 status __attribute__ ((packed));