From 9c6602ccf353ca25d682d0fd60b5e737d6ad6695 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Thu, 5 Sep 2013 00:01:27 +0200 Subject: libril: handle samsungs unsol responses Change-Id: I8f13cfe68157417c36f541af7ea40680bd279c43 --- ril/xmm6260/libril/ril.cpp | 34 +++++++++++++++++++++++++-------- ril/xmm6260/libril/ril_unsol_commands.h | 4 +++- ril/xmm6262/libril/ril.cpp | 34 +++++++++++++++++++++++++-------- ril/xmm6262/libril/ril_unsol_commands.h | 4 +++- 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/ril/xmm6260/libril/ril.cpp b/ril/xmm6260/libril/ril.cpp index 92b896c..ddac68b 100755 --- a/ril/xmm6260/libril/ril.cpp +++ b/ril/xmm6260/libril/ril.cpp @@ -113,6 +113,9 @@ namespace android { #define appendPrintBuf(x...) #endif +#define MAX_RIL_SOL RIL_REQUEST_VOICE_RADIO_TECH +#define MAX_RIL_UNSOL RIL_UNSOL_VOICE_RADIO_TECH_CHANGED + enum WakeType {DONT_WAKE, WAKE_PARTIAL}; typedef struct { @@ -330,8 +333,8 @@ issueLocalRequest(int request, void *data, int len) { /* Hack to include Samsung requests */ if (request > 10000) { - index = request - 10000 + RIL_REQUEST_VOICE_RADIO_TECH; - ALOGE("SAMSUNG: request=%d, index=%d", request, index); + index = request - 10000 + MAX_RIL_SOL; + ALOGD("SAMSUNG: request=%d, index=%d", request, index); pRI->pCI = &(s_commands[index]); } else { pRI->pCI = &(s_commands[request]); @@ -373,8 +376,9 @@ processCommandBuffer(void *buffer, size_t buflen) { } /* Hack to include Samsung requests */ - //if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) { - if (request < 1 || ((request > RIL_REQUEST_VOICE_RADIO_TECH) && (request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) || request > RIL_REQUEST_HANGUP_VT) { + if (request < 1 || ((request > MAX_RIL_SOL) && + (request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) || + request > RIL_REQUEST_HANGUP_VT) { ALOGE("unsupported request code %d token %d", request, token); // FIXME this should perhaps return a response return 0; @@ -386,8 +390,9 @@ processCommandBuffer(void *buffer, size_t buflen) { /* Hack to include Samsung requests */ if (request > 10000) { - index = request - 10000 + RIL_REQUEST_VOICE_RADIO_TECH; - ALOGE("processCommandBuffer: samsung request=%d, index=%d", request, index); + index = request - 10000 + MAX_RIL_SOL; + ALOGD("processCommandBuffer: samsung request=%d, index=%d", + request, index); pRI->pCI = &(s_commands[index]); } else { pRI->pCI = &(s_commands[request]); @@ -2814,8 +2819,14 @@ RIL_register (const RIL_RadioFunctions *callbacks) { } for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) { - assert(i + RIL_UNSOL_RESPONSE_BASE + /* Hack to include Samsung responses */ + if (i > MAX_RIL_UNSOL - RIL_UNSOL_RESPONSE_BASE) { + assert(i + SAMSUNG_UNSOL_RESPONSE_BASE - MAX_RIL_UNSOL + == s_unsolResponses[i].requestNumber); + } else { + assert(i + RIL_UNSOL_RESPONSE_BASE == s_unsolResponses[i].requestNumber); + } } // New rild impl calls RIL_startEventLoop() first @@ -3130,7 +3141,13 @@ void RIL_onUnsolicitedResponse(int unsolResponse, void *data, return; } - unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; + /* Hack to include Samsung responses */ + if (unsolResponse > SAMSUNG_UNSOL_RESPONSE_BASE) { + unsolResponseIndex = unsolResponse - SAMSUNG_UNSOL_RESPONSE_BASE + MAX_RIL_UNSOL - RIL_UNSOL_RESPONSE_BASE; + ALOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, unsolResponseIndex); + } else { + unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; + } if ((unsolResponseIndex < 0) || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) { @@ -3484,6 +3501,7 @@ requestToString(int request) { case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED"; case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED: return "UNSOL_VOICE_RADIO_TECH_CHANGED"; + case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT"; default: return ""; } } diff --git a/ril/xmm6260/libril/ril_unsol_commands.h b/ril/xmm6260/libril/ril_unsol_commands.h index 87c367e..9254151 100644 --- a/ril/xmm6260/libril/ril_unsol_commands.h +++ b/ril/xmm6260/libril/ril_unsol_commands.h @@ -49,4 +49,6 @@ {RIL_UNSOL_CDMA_PRL_CHANGED, responseInts, WAKE_PARTIAL}, {RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, responseVoid, WAKE_PARTIAL}, {RIL_UNSOL_RIL_CONNECTED, responseInts, WAKE_PARTIAL}, - {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL} + {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL}, // 1035 + {RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, responseVoid, WAKE_PARTIAL}, // 11001 + {RIL_UNSOL_STK_SEND_SMS_RESULT, responseInts, WAKE_PARTIAL}, // 11002 \ No newline at end of file diff --git a/ril/xmm6262/libril/ril.cpp b/ril/xmm6262/libril/ril.cpp index 933f6ee..f30520f 100644 --- a/ril/xmm6262/libril/ril.cpp +++ b/ril/xmm6262/libril/ril.cpp @@ -113,6 +113,9 @@ namespace android { #define appendPrintBuf(x...) #endif +#define MAX_RIL_SOL RIL_REQUEST_VOICE_RADIO_TECH +#define MAX_RIL_UNSOL RIL_UNSOL_VOICE_RADIO_TECH_CHANGED + enum WakeType {DONT_WAKE, WAKE_PARTIAL}; typedef struct { @@ -334,8 +337,8 @@ issueLocalRequest(int request, void *data, int len) { /* Hack to include Samsung requests */ if (request > 10000) { - index = request - 10000 + RIL_REQUEST_VOICE_RADIO_TECH; - ALOGE("SAMSUNG: request=%d, index=%d", request, index); + index = request - 10000 + MAX_RIL_SOL; + ALOGD("SAMSUNG: request=%d, index=%d", request, index); pRI->pCI = &(s_commands[index]); } else { pRI->pCI = &(s_commands[request]); @@ -377,8 +380,9 @@ processCommandBuffer(void *buffer, size_t buflen) { } /* Hack to include Samsung requests */ - //if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) { - if (request < 1 || ((request > RIL_REQUEST_VOICE_RADIO_TECH) && (request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) || request > RIL_REQUEST_HANGUP_VT) { + if (request < 1 || ((request > MAX_RIL_SOL) && + (request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) || + request > RIL_REQUEST_HANGUP_VT) { ALOGE("unsupported request code %d token %d", request, token); // FIXME this should perhaps return a response return 0; @@ -390,8 +394,9 @@ processCommandBuffer(void *buffer, size_t buflen) { /* Hack to include Samsung requests */ if (request > 10000) { - index = request - 10000 + RIL_REQUEST_VOICE_RADIO_TECH; - ALOGE("processCommandBuffer: samsung request=%d, index=%d", request, index); + index = request - 10000 + MAX_RIL_SOL; + ALOGD("processCommandBuffer: samsung request=%d, index=%d", + request, index); pRI->pCI = &(s_commands[index]); } else { pRI->pCI = &(s_commands[request]); @@ -2962,8 +2967,14 @@ RIL_register (const RIL_RadioFunctions *callbacks) { } for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) { - assert(i + RIL_UNSOL_RESPONSE_BASE + /* Hack to include Samsung responses */ + if (i > MAX_RIL_UNSOL - RIL_UNSOL_RESPONSE_BASE) { + assert(i + SAMSUNG_UNSOL_RESPONSE_BASE - MAX_RIL_UNSOL + == s_unsolResponses[i].requestNumber); + } else { + assert(i + RIL_UNSOL_RESPONSE_BASE == s_unsolResponses[i].requestNumber); + } } // New rild impl calls RIL_startEventLoop() first @@ -3278,7 +3289,13 @@ void RIL_onUnsolicitedResponse(int unsolResponse, void *data, return; } - unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; + /* Hack to include Samsung responses */ + if (unsolResponse > SAMSUNG_UNSOL_RESPONSE_BASE) { + unsolResponseIndex = unsolResponse - SAMSUNG_UNSOL_RESPONSE_BASE + MAX_RIL_UNSOL - RIL_UNSOL_RESPONSE_BASE; + ALOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, unsolResponseIndex); + } else { + unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; + } if ((unsolResponseIndex < 0) || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) { @@ -3632,6 +3649,7 @@ requestToString(int request) { case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED"; case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED: return "UNSOL_VOICE_RADIO_TECH_CHANGED"; + case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT"; default: return ""; } } diff --git a/ril/xmm6262/libril/ril_unsol_commands.h b/ril/xmm6262/libril/ril_unsol_commands.h index 7e3f8f0..9254151 100644 --- a/ril/xmm6262/libril/ril_unsol_commands.h +++ b/ril/xmm6262/libril/ril_unsol_commands.h @@ -49,4 +49,6 @@ {RIL_UNSOL_CDMA_PRL_CHANGED, responseInts, WAKE_PARTIAL}, {RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, responseVoid, WAKE_PARTIAL}, {RIL_UNSOL_RIL_CONNECTED, responseInts, WAKE_PARTIAL}, - {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL}, + {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL}, // 1035 + {RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, responseVoid, WAKE_PARTIAL}, // 11001 + {RIL_UNSOL_STK_SEND_SMS_RESULT, responseInts, WAKE_PARTIAL}, // 11002 \ No newline at end of file -- cgit v1.2.3