5a500e66e8d8bcad503705985a7046e4e908763f
[profile/ivi/ofono.git] / packaging / 0004-atmodem-Fix-handling-of-IFX-signal-strength-indicati.patch
1 From d8a084c7484e2794d175c395debee019e4dacf00 Mon Sep 17 00:00:00 2001
2 From: Marcel Holtmann <marcel@holtmann.org>
3 Date: Tue, 14 Feb 2012 15:23:59 +0100
4 Subject: [PATCH 4/7] atmodem: Fix handling of IFX signal strength indication
5 Content-Type: text/plain; charset="utf-8"
6 Content-Transfer-Encoding: 8bit
7
8 ---
9  drivers/atmodem/network-registration.c |   10 ++++++++--
10  1 files changed, 8 insertions(+), 2 deletions(-)
11
12 diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
13 index 936a674..9c639c0 100644
14 --- a/drivers/atmodem/network-registration.c
15 +++ b/drivers/atmodem/network-registration.c
16 @@ -692,12 +692,18 @@ static void ifx_xciev_notify(GAtResult *result, gpointer user_data)
17         if (!g_at_result_iter_next_number(&iter, &ind))
18                 return;
19  
20 -       if (ind == 0)
21 +       /*
22 +        * Radio signal strength indicators are defined for 0-7,
23 +        * but in some cases XCIEV just returns CSQ 0-31,99 values.
24 +        */
25 +       if (ind == 0 || ind == 99)
26                 strength = -1;
27         else if (ind == 7)
28                 strength = 100;
29 -       else
30 +       else if (ind < 7)
31                 strength = (ind * 15);
32 +       else if (ind > 7)
33 +               strength = (ind * 100) / 31;
34  
35         ofono_netreg_strength_notify(netreg, strength);
36  }
37 -- 
38 1.7.5.4
39