Hi, I found that my rt2870 sometimes report -128db signal when very near to AP or using a hi-gain antenna such a waveguide (checked from iw and nm-applet). I found that the rssi from the hardware is a signed from -13db (strongest signal) to positive number (bigger is weaker) while the 0 is treated as error condition but there is an error in casting the value when retrieved from the hardware. I changed the type of the variables so the cast is correct and when i get -13 rssi from hw i return 0 db from the function. attached the patch against linux-3.2.2 (my very first Linux patch :P). Luigi --- a/drivers/net/wireless/rt2x00/rt2800lib.c 2012-01-30 12:48:15.779238642 +0100 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c 2012-01-30 15:09:30.694287624 +0100 @@ -514,9 +514,9 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2) { - int rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); - int rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); - int rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); + s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); + s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); + s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); u16 eeprom; u8 offset0; u8 offset1; @@ -539,11 +539,12 @@ /* * Convert the value from the descriptor into the RSSI value * If the value in the descriptor is 0, it is considered invalid - * and the default (extremely low) rssi value is assumed + * and the default (extremely low) rssi value is assumed. + * HW rssiX values go from -13 (strongest) to positive number (weakest). */ - rssi0 = (rssi0) ? (-12 - offset0 - rt2x00dev->lna_gain - rssi0) : -128; - rssi1 = (rssi1) ? (-12 - offset1 - rt2x00dev->lna_gain - rssi1) : -128; - rssi2 = (rssi2) ? (-12 - offset2 - rt2x00dev->lna_gain - rssi2) : -128; + rssi0 = (rssi0) ? (-13 - offset0 - rt2x00dev->lna_gain - rssi0) : -128; + rssi1 = (rssi1) ? (-13 - offset1 - rt2x00dev->lna_gain - rssi1) : -128; + rssi2 = (rssi2) ? (-13 - offset2 - rt2x00dev->lna_gain - rssi2) : -128; /* * mac80211 only accepts a single RSSI value. Calculating the @@ -552,7 +553,7 @@ * which gives less energy... */ rssi0 = max(rssi0, rssi1); - return max(rssi0, rssi2); + return (int)max(rssi0, rssi2); } void rt2800_process_rxwi(struct queue_entry *entry, -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html