Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2009 14:44:46 -0400
From:      David Horn <dhorn2000@gmail.com>
To:        freebsd-net@freebsd.org
Cc:        sam@frebsd.org
Subject:   wpa_supplicant signal quality vs level
Message-ID:  <25ff90d60909241144i321c39bdj71e1d1b7e0ba51e8@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--0050450295a6b9567104745739f8
Content-Type: text/plain; charset=ISO-8859-1

I have noticed that 'wpa_cli scan_results' always reported a signal
level of 0 for every bssid found during a scan.  I found this a bit
odd (especially since ifconfig wlan0 list scan reported good signal
level data)

FreeBSD 8.0-RC1 r197417 amd64

Looking at the /usr/src/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
source, I found:

in wpa_driver_bsd_get_scan_results()

wsr->qual = sr->isr_rssi;
wsr->level = 0;       /* XXX? */

This hardcodes the signal level to 0, and sets the signal quality to
the rssi value.

Looking around at the source, it seems that wpa_supplicant does not
ever use the quality variable, but instead looks at the level variable
in wpa_scan_result_compar ().

In an attempt to try to figure out what signal level vs signal quality
in wpa_supplicant context means, I found this:
http://lists.shmoo.com/pipermail/hostap/2006-December/014831.html, and
a feb-2009 change to scan_helpers.c (which drivers_freebsd.c seems to
be partially based upon)
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=e1b525c3560614cc56c85b7d060f540900c4da34

So, it seems that some wpa_supplicant drivers use quality, and some
use level.  Since quality(wsr->qual) does not seem to be used in
current wpa_supplicant in freebsd, should it instead look like ?:
(attached as an SVN diff with some debug as well)

                wsr->ssid_len = sr->isr_ssid_len;
                wsr->freq = sr->isr_freq;
                wsr->noise = sr->isr_noise;
-               wsr->qual = sr->isr_rssi;
-               wsr->level = 0;         /* XXX? */
+               wsr->qual = 0;  /* XXX? */
+               wsr->level = sr->isr_rssi;
                wsr->caps = sr->isr_capinfo;
                wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates);
                vp = ((u_int8_t *)sr) + sr->isr_ie_off;


Should we just set qual to 0,  or should we set qual to
rssi/rssi_max*100 (if we can determine rssi_max for a particular wlan
interface)

In any case, do you want me to file a PR on this ?

--Thanks!

---Dave H

--0050450295a6b9567104745739f8
Content-Type: text/plain; charset=US-ASCII; name="wpa_supplicant.patch.txt"
Content-Disposition: attachment; filename="wpa_supplicant.patch.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fzzuperh0

SW5kZXg6IGRyaXZlcl9mcmVlYnNkLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gZHJpdmVyX2ZyZWVic2QuYwko
cmV2aXNpb24gMTk3NDM5KQorKysgZHJpdmVyX2ZyZWVic2QuYwkod29ya2luZyBjb3B5KQpAQCAt
NjQxLDYgKzY0MSw4IEBACiAJLyogdXNlIGZyZXEgZm9yIGNoYW5uZWwgcHJlZmVyZW5jZSAqLwog
CiAJLyogYWxsIHRoaW5ncyBiZWluZyBlcXVhbCwgdXNlIHNpZ25hbCBsZXZlbCAqLworCXdwYV9w
cmludGYoTVNHX0RFQlVHLCAiJXM6IHNpZ25hbCBsZXZlbHM7ICVkOiMxKHdhKSAgJWQ6IzIod2Ip
IiwKKwkgICAgICAgICAgIF9fZnVuY19fLCB3YS0+bGV2ZWwsIHdiLT5sZXZlbCk7CiAJcmV0dXJu
IHdiLT5sZXZlbCAtIHdhLT5sZXZlbDsKIH0KIApAQCAtNjk3LDggKzY5OSw4IEBACiAJCXdzci0+
c3NpZF9sZW4gPSBzci0+aXNyX3NzaWRfbGVuOwogCQl3c3ItPmZyZXEgPSBzci0+aXNyX2ZyZXE7
CiAJCXdzci0+bm9pc2UgPSBzci0+aXNyX25vaXNlOwotCQl3c3ItPnF1YWwgPSBzci0+aXNyX3Jz
c2k7Ci0JCXdzci0+bGV2ZWwgPSAwOwkJLyogWFhYPyAqLworCQl3c3ItPnF1YWwgPSAwOyAgLyog
WFhYPyAqLworCQl3c3ItPmxldmVsID0gc3ItPmlzcl9yc3NpOwkKIAkJd3NyLT5jYXBzID0gc3It
Pmlzcl9jYXBpbmZvOwogCQl3c3ItPm1heHJhdGUgPSBnZXRtYXhyYXRlKHNyLT5pc3JfcmF0ZXMs
IHNyLT5pc3JfbnJhdGVzKTsKIAkJdnAgPSAoKHVfaW50OF90ICopc3IpICsgc3ItPmlzcl9pZV9v
ZmY7Cg==
--0050450295a6b9567104745739f8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?25ff90d60909241144i321c39bdj71e1d1b7e0ba51e8>