Disp: Report RSSI properly with newer version
authorPaul Kocialkowski <contact@paulk.fr>
Sun, 18 Nov 2012 13:57:21 +0000 (14:57 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Sun, 18 Nov 2012 13:57:21 +0000 (14:57 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
compat.h
disp.c

index fa92045..bf24165 100644 (file)
--- a/compat.h
+++ b/compat.h
@@ -41,7 +41,6 @@
 #if RIL_VERSION >= 6
        #define RIL_REQUEST_REGISTRATION_STATE RIL_REQUEST_VOICE_REGISTRATION_STATE
        #define RIL_REQUEST_GPRS_REGISTRATION_STATE RIL_REQUEST_DATA_REGISTRATION_STATE
-       #define RIL_SignalStrength RIL_SignalStrength_v6
        #define RIL_CardStatus RIL_CardStatus_v6
        #define RIL_SIM_IO RIL_SIM_IO_v6
        #define RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
diff --git a/disp.c b/disp.c
index c38b214..ede5efa 100644 (file)
--- a/disp.c
+++ b/disp.c
 /**
  * Converts IPC RSSI to Android RIL format
  */
+#if RIL_VERSION >= 6
+void ipc2ril_rssi(unsigned char rssi, RIL_SignalStrength_v6 *ss)
+#else
 void ipc2ril_rssi(unsigned char rssi, RIL_SignalStrength *ss)
+#endif
 {
-       int ril_rssi;
-
-       memset(ss, 0, sizeof(ss));
+       int ril_rssi = 0;
 
        if(rssi > 0x6f) {
                ril_rssi = 0;
@@ -44,15 +46,15 @@ void ipc2ril_rssi(unsigned char rssi, RIL_SignalStrength *ss)
 
        LOGD("Signal Strength is %d\n", ril_rssi);
 
+#if RIL_VERSION >= 6
+       memset(ss, 0, sizeof(RIL_SignalStrength_v6));
+       memset(&ss->LTE_SignalStrength, -1, sizeof(ss->LTE_SignalStrength));
+#else
+       memset(ss, 0, sizeof(RIL_SignalStrength));
+#endif
+
        ss->GW_SignalStrength.signalStrength = ril_rssi;
        ss->GW_SignalStrength.bitErrorRate = 99;
-
-       /* Send CDMA and EVDO levels even in GSM mode */
-       ss->CDMA_SignalStrength.dbm = ril_rssi;
-       ss->CDMA_SignalStrength.ecio = 200;
-
-       ss->EVDO_SignalStrength.dbm = ril_rssi;
-       ss->EVDO_SignalStrength.ecio = 200;
 }
 
 void ril_request_signal_strength(RIL_Token t)
@@ -65,7 +67,11 @@ void ril_request_signal_strength(RIL_Token t)
 void ipc_disp_icon_info(struct ipc_message_info *info)
 {
        struct ipc_disp_icon_info *icon_info = (struct ipc_disp_icon_info *) info->data;
+#if RIL_VERSION >= 6
+       RIL_SignalStrength_v6 ss;
+#else
        RIL_SignalStrength ss;
+#endif
 
        /* Don't consider this if modem isn't in normal power mode. */
        if(ril_data.state.power_state != IPC_PWR_PHONE_STATE_NORMAL)
@@ -88,7 +94,11 @@ void ipc_disp_icon_info(struct ipc_message_info *info)
 void ipc_disp_rssi_info(struct ipc_message_info *info)
 {
        struct ipc_disp_rssi_info *rssi_info = (struct ipc_disp_rssi_info *) info->data;
+#if RIL_VERSION >= 6
+       RIL_SignalStrength_v6 ss;
+#else
        RIL_SignalStrength ss;
+#endif
        int rssi;
 
        /* Don't consider this if modem isn't in normal power mode. */