[PATCH] Setting quality in scan results

Pavel Roskin proski at gnu.org
Wed Apr 21 12:57:46 EDT 2004


Hello!

Scan results show random "quality" because it's never set.  The firmware
only provides quality as part of HFA384X_RID_COMMSQUALITY request.  For
scan results, only signal and noise are provided.  I think "quality" is
not really applicable for a single probe response.

However, iwlist requires "quality" is scan results, so we should calculate
it somehow.  I suggest to subtract noise from signal.  Since both are in
decibels, the result should have a monotone dependency on the signal to
noise ratio.

I haven't seen the difference exceed 70, so it should be within range.  If
noise exceeds signal, the quality is 0.

iwe.u.qual.updated is not used for scan results, but it's better not to
return a random number from the kernel to the userspace.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- driver/modules/hostap_ioctl.c
+++ driver/modules/hostap_ioctl.c
@@ -1765,6 +1765,11 @@ static char * __prism2_translate_scan(lo
 		iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(
 			le16_to_cpu(scan->anl));
 	}
+	if (iwe.u.qual.level > iwe.u.qual.noise)
+		iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
+	else
+		iwe.u.qual.qual = 0;
+	iwe.u.qual.updated = 0;
 	iwe.len = IW_EV_QUAL_LEN;
 	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
 					  IW_EV_QUAL_LEN);


More information about the HostAP mailing list