Re: [MM] [PATCH] broadband-modem: update signal quality normalization



On Tue, 2013-04-30 at 13:32 -0700, Ben Chan wrote:
This patch updates normalize_ciev_cind_signal_quality() in
MMBroadbandModem to remove an unnecessary check on 'quality >= 0' and
also makes sure the normalized signal quality is capped at 100 when no
maximum is specified.

This is revised from a patch originally authored by
Yunlian Jiang <yunlian chromium org>.

Bug reported on https://code.google.com/p/chromium/issues/detail?id=235989

Looks good; pushed, thanks.

Dan

---
 src/mm-broadband-modem.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 764b4ed..45d9027 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -1651,11 +1651,10 @@ normalize_ciev_cind_signal_quality (guint quality,
                                     guint min,
                                     guint max)
 {
-    if (!max &&
-        quality >= 0) {
+    if (!max) {
         /* If we didn't get a max, assume it was 5. Note that we do allow
          * 0, meaning no signal at all. */
-        return (quality * 20);
+        return (quality <= 5) ? (quality * 20) : 100;
     }
 
     if (quality >= min &&




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]