4

I'm using wpa_supplicant 2.0 on Linux x64 with a USB wifi adapter (rtl8192cu).

When I do a scan from wpa_cli, I get wildly different numbers (alternating between positive and negative) even for the same access point without moving anything. I'm trying to show this data to the user in a GUI, so I need it to be in a consistent format, preferably something I can ultimately convert to a percentage with.

For example, SSID "one" sometimes has a signal level of around -40, and sometimes it's just the number 10. Even if it was consistently outputting regular dBm (negative) numbers, I have no idea what the scale is in this case, as every OS/application seems to handle it a little differently. Some documents on the web suggest valid values as -50 to -100, some say something totally different, and some make up their own numbers. Here it doesn't even seem to follow any standard:

bssid / frequency / signal level / flags / ssid
XX:XX:XX:XX:XX:01       2437    -38     [WPA2-PSK-CCMP][WPS][ESS]       one
XX:XX:XX:XX:XX:02       2427    -38     [ESS]   \x00\x00\x00\x00\x00\x00\x00

bssid / frequency / signal level / flags / ssid
02:00:00:00:01:01       2437    10      [WPA2-PSK-CCMP][ESS]    two
02:00:00:00:00:01       2437    10      [WPA2-PSK-CCMP][ESS]    three
XX:XX:XX:XX:XX:01       2437    10      [WPA2-PSK-CCMP][WPS][ESS]       one
XX:XX:XX:XX:XX:02       2427    -39     [ESS]   \x00\x00\x00\x00\x00\x00\x00

bssid / frequency / signal level / flags / ssid
02:00:00:00:01:01       2437    10      [WPA2-PSK-CCMP][ESS]    two
02:00:00:00:00:01       2437    -40     [WPA2-PSK-CCMP][ESS]    three
XX:XX:XX:XX:XX:01       2437    10      [WPA2-PSK-CCMP][WPS][ESS]       one
XX:XX:XX:XX:XX:02       2427    -39     [ESS]   \x00\x00\x00\x00\x00\x00\x00

bssid / frequency / signal level / flags / ssid
02:00:00:00:01:01       2437    10      [WPA2-PSK-CCMP][ESS]    two
02:00:00:00:00:01       2437    10      [WPA2-PSK-CCMP][ESS]    three
XX:XX:XX:XX:XX:01       2437    -42     [WPA2-PSK-CCMP][WPS][ESS]       one
XX:XX:XX:XX:XX:02       2427    -41     [ESS]   \x00\x00\x00\x00\x00\x00\x00

bssid / frequency / signal level / flags / ssid
02:00:00:00:01:01       2437    10      [WPA2-PSK-CCMP][ESS]    two
02:00:00:00:00:01       2437    10      [WPA2-PSK-CCMP][ESS]    three
XX:XX:XX:XX:XX:01       2437    10      [WPA2-PSK-CCMP][WPS][ESS]       one
XX:XX:XX:XX:XX:02       2427    -41     [ESS]   \x00\x00\x00\x00\x00\x00\x00

Is there a way to convert these signal levels into a consistent scale I can present to the user?

Also, if the user uses a different wifi adapter/driver, will the signal level be in an even different format that I need to worry about?

2

I believe the signal level is in decibel (dBm).

excerpt

dBm (sometimes dBmW) is an abbreviation for the power ratio in decibels (dB) of the measured power referenced to one milliwatt (mW). It is used in radio, microwave and fiber optic networks as a convenient measure of absolute power because of its capability to express both very large and very small values in a short form. Compare dBW, which is referenced to one watt (1000 mW).

Since it is referenced to the watt, it is an absolute unit, used when measuring absolute power. By comparison, the decibel (dB) is a dimensionless unit, used for quantifying the ratio between two values, such as signal-to-noise ratio.

The absolute power of a signal is measured in watts. Decibels (dB) are relative, they can only tell you the difference between now and the last reading. Also notice that it is a logarithmic scale. The m in dBm tells us that our scale is relative to 1 milliWatt of power. 0 dBm = 1 mW.

excerpt

The reason you see negative values is that you're representing small but positive numbers, on a logarithmic scale. In logarithms, the value indicated represents an exponent... for example, under a log 10 scale, a value of -2 represents 10 to the -2 power, which equals 0.01. Likewise, a negative dBm means that you're applying a negative exponent in your power calculations; 0 dBm equals 1 mW of power, so -10 dBm equates to 0.1 mW, -20 dBm equates to 0.01 mW, and so forth. It's a lot easier, and more useful in some calculations, to describe a weak signal as -100 dBm as opposed to 0.0000000001 mW.

source: http://www.tomshardware.com/forum/9782-43-read-signal-strength#8171161

In terms of how to display the signal level, it's just a number line of values, I'd be inclined to show that value normalized into some scale of 0-100. Remember that the values go like this since it's logarithmic:

-99 -98 -97 ... -2 -1 0 +1 +2 +3 ...

Just like anything else involving such a scale, -1 is greater (louder) than -99.

source: http://www.tomshardware.com/forum/9782-43-read-signal-strength#8241725

EDIT #1

Follow-up Q's from the OP.

1 - I don't know the scale for the negative numbers, but I'm pretty sure it's not -100 to 0, and every website I read says the scale is different (e.g. -50 to -100, -30 to -80, etc.) so I need to know the correct scale in this case, and whether or not it changes between drivers.

The negative numbers are a logarithmic scale. They are unit-less. The numbers aren't limited -100-0 they're negative to positive. The reason they use a logarithmic scale is to decimate the number so that it doesn't change as dramatically from one moment to the next. The numbers that it's representing can swing a lot, and they're order of magnitude differences in the values that they can have, so logs are used.

The use of dBm means the values are based on 1 milli-watt. That would be the 0 value on the scale

2 - I need to know why the numbers are sometimes positive (so far I've only seen +10)... since if it's being measured in dBm, positive numbers make no sense to me (it makes me think it's actually a bug).

It's most definitely not a bug. The values, since logarithmic can be negative to positive. It's just like representing a "1/10" number as "1*10^-1" type of situation. Notice the "-1" in the 2nd form?

See the follow resource which should help you understand how to perform the calculations, which will lead you to understand what's going on with these values.

| improve this answer | |
  • Maybe I didn't ask the question exactly right... basically I have 2 problems. #1 I don't know the scale for the negative numbers, but I'm pretty sure it's not -100 to 0, and every website I read says the scale is different (e.g. -50 to -100, -30 to -80, etc.) so I need to know the correct scale in this case, and whether or not it changes between drivers. #2 I need to know why the numbers are sometimes positive (so far I've only seen +10)... since if it's being measured in dBm, positive numbers make no sense to me (it makes me think it's actually a bug). – bparker Nov 1 '13 at 6:54
  • @bparker - addressed your Q's in the A (bottom). Let me know if you need more help. – slm Nov 1 '13 at 13:30
  • The reason I think it's a bug is because I have never seen a signal level in linux be reported as a positive number (the best I've ever seen was -40), and we've been using wifi since before it was even standardized... I just find it hard to believe that has changed suddenly. I don't disagree that decibels can be positive and that it's a logarithmic scale, I have no issues with that. I just think the positive numbers are wrong within this use case of wifi in linux, especially since the positive numbers I see are always "10" no matter what the SSID is, or where I move the radio to. – bparker Nov 2 '13 at 13:57
  • @bparker - a bug is always a possibility but to establish it you'll have to likely profile several different cards that use different chipsets and therefore different drivers to substantiate it. You'll need to do way more digging and collect model #'s of hardware and version numbers of drivers to begin profiling this further. – slm Nov 2 '13 at 15:35
  • @bparker - you might want to check out the tool wavemon. eden-feed.erg.abdn.ac.uk/wavemon – slm Nov 5 '13 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.