OSDN Git Service

Workaround for LTE RSRP -ve values in Signal
authorUma Maheswari Ramalingam <umam@codeaurora.org>
Thu, 9 Aug 2012 18:59:17 +0000 (11:59 -0700)
committerUma Maheswari Ramalingam <umam@codeaurora.org>
Thu, 9 Aug 2012 19:16:09 +0000 (12:16 -0700)
Ril version 6 and below sends negative values
for lte rsrp in signalstrength.
Workaround to maintain backward compatibility
and convert this to positive
values in compliance with ril.h

Support for processing all fields in
SignalStrength in reference-ril

Change-Id: I4d480aa2f607cd617b18681f722de246a7894348

libril/ril.cpp
reference-ril/reference-ril.c

index b8aba01..e3f7e41 100644 (file)
@@ -1995,6 +1995,15 @@ static int responseRilSignalStrength(Parcel &p,
         p.writeInt32(p_cur->EVDO_SignalStrength.signalNoiseRatio);
         if (responselen >= sizeof (RIL_SignalStrength_v6)) {
             p.writeInt32(p_cur->LTE_SignalStrength.signalStrength);
+
+            /*
+             * ril version <=6 receives negative values for rsrp
+             * workaround for backward compatibility
+             */
+            p_cur->LTE_SignalStrength.rsrp =
+                    ((s_callbacks.version <= 6) && (p_cur->LTE_SignalStrength.rsrp < 0 )) ?
+                        -(p_cur->LTE_SignalStrength.rsrp) : p_cur->LTE_SignalStrength.rsrp;
+
             p.writeInt32(p_cur->LTE_SignalStrength.rsrp);
             p.writeInt32(p_cur->LTE_SignalStrength.rsrq);
             p.writeInt32(p_cur->LTE_SignalStrength.rssnr);
index 37c87b2..578ff63 100644 (file)
@@ -728,10 +728,12 @@ static void requestHangup(void *data, size_t datalen, RIL_Token t)
 
 static void requestSignalStrength(void *data, size_t datalen, RIL_Token t)
 {
-    RIL_SignalStrength_v6 response;
     ATResponse *p_response = NULL;
     int err;
     char *line;
+    int count =0;
+    int numofElements=sizeof(RIL_SignalStrength_v6)/sizeof(int);
+    int response[numofElements];
 
     err = at_send_command_singleline("AT+CSQ", "+CSQ:", &p_response);
 
@@ -745,15 +747,12 @@ static void requestSignalStrength(void *data, size_t datalen, RIL_Token t)
     err = at_tok_start(&line);
     if (err < 0) goto error;
 
-    memset(&response, 0, sizeof(RIL_SignalStrength_v6));
-
-    err = at_tok_nextint(&line, &response.GW_SignalStrength.signalStrength);
-    if (err < 0) goto error;
-
-    err = at_tok_nextint(&line, &response.GW_SignalStrength.bitErrorRate);
-    if (err < 0) goto error;
+    for (count =0; count < numofElements; count ++) {
+        err = at_tok_nextint(&line, &(response[count]));
+        if (err < 0) goto error;
+    }
 
-    RIL_onRequestComplete(t, RIL_E_SUCCESS, &response, sizeof(response));
+    RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(response));
 
     at_response_free(p_response);
     return;