From 8faa032a27a7641d193ce6e587d97343c029186a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 6 Oct 2011 09:34:10 -0500 Subject: [PATCH] nl80211: use floats for signal quality calculations Since we're working with numbers less than one but greater than zero, we need floats. Otherwise stuff just gets clipped. --- src/wifi-utils-nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wifi-utils-nl80211.c b/src/wifi-utils-nl80211.c index ce9de6aa24..ee2068001d 100644 --- a/src/wifi-utils-nl80211.c +++ b/src/wifi-utils-nl80211.c @@ -215,8 +215,8 @@ static guint32 nl80211_mbm_to_percent (gint32 mbm) mbm = CLAMP(mbm, NOISE_FLOOR_MBM, SIGNAL_MAX_MBM); - return 100 - 70 * ((SIGNAL_MAX_MBM - mbm) / - (SIGNAL_MAX_MBM - NOISE_FLOOR_MBM)); + return 100 - 70 * (((float) SIGNAL_MAX_MBM - (float) mbm) / + ((float) SIGNAL_MAX_MBM - (float) NOISE_FLOOR_MBM)); } struct nl80211_bss_info {