libril: handle samsungs unsol responses

Change-Id: Ia42d9999ba0df93019a8864202f093163f8c3f41
tirimbino
Daniel Hillenbrand 11 years ago
parent 898047abc2
commit a22f51c83e
  1. 42
      ril/xmm6260/libril/ril.cpp
  2. 4
      ril/xmm6260/libril/ril_unsol_commands.h
  3. 28
      ril/xmm6262/libril/ril.cpp
  4. 2
      ril/xmm6262/libril/ril_commands.h
  5. 4
      ril/xmm6262/libril/ril_unsol_commands.h

@ -114,6 +114,9 @@ namespace android {
#define appendPrintBuf(x...)
#endif
#define MAX_RIL_SOL RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE
#define MAX_RIL_UNSOL RIL_UNSOL_CELL_INFO_LIST
enum WakeType {DONT_WAKE, WAKE_PARTIAL};
typedef struct {
@ -336,8 +339,8 @@ issueLocalRequest(int request, void *data, int len) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
RLOGE("SAMSUNG: request=%d, index=%d", request, index);
index = request - 10000 + MAX_RIL_SOL;
RLOGD("SAMSUNG: request=%d, index=%d", request, index);
pRI->pCI = &(s_commands[index]);
} else {
pRI->pCI = &(s_commands[request]);
@ -357,8 +360,6 @@ issueLocalRequest(int request, void *data, int len) {
s_callbacks.onRequest(request, data, len, pRI);
}
static int
processCommandBuffer(void *buffer, size_t buflen) {
Parcel p;
@ -381,8 +382,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_SET_UNSOL_CELL_INFO_LIST_RATE) && (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) {
RLOGE("unsupported request code %d token %d", request, token);
// FIXME this should perhaps return a response
return 0;
@ -394,8 +396,9 @@ processCommandBuffer(void *buffer, size_t buflen) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
RLOGE("processCommandBuffer: samsung request=%d, index=%d", request, index);
index = request - 10000 + MAX_RIL_SOL;
RLOGD("processCommandBuffer: samsung request=%d, index=%d",
request, index);
pRI->pCI = &(s_commands[index]);
} else {
pRI->pCI = &(s_commands[request]);
@ -1461,7 +1464,7 @@ responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responsele
startResponse;
for (int i = 0 ; i < numInts ; i++) {
if (i == 0 && p_int[0] == 7) {
RLOGE("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF");
RLOGD("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF");
p_int[0] = 0;
}
appendPrintBuf("%s%d,", printBuf, p_int[i]);
@ -1504,18 +1507,18 @@ static int responseStringsNetworks(Parcel &p, void *response, size_t responselen
p.writeInt32 (0);
} else {
char **p_cur = (char **) response;
int j = 0;
numStrings = responselen / sizeof(char *);
p.writeInt32 ((numStrings / inQANElements) * outQANElements);
/* each string*/
startResponse;
int j=0;
for (int i = 0 ; i < numStrings ; i++) {
/* Samsung is sending 5 elements, upper layer expects 4.
Drop every 5th element here */
if (j == outQANElements) {
j=0;
j = 0;
} else {
appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]);
writeStringToParcel (p, p_cur[i]);
@ -3097,8 +3100,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
@ -3413,7 +3422,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;
RLOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, unsolResponseIndex);
} else {
unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE;
}
if ((unsolResponseIndex < 0)
|| (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) {
@ -3770,6 +3785,7 @@ requestToString(int request) {
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_CELL_INFO_LIST: return "UNSOL_CELL_INFO_LIST";
case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT";
default: return "<unknown request>";
}
}

@ -50,4 +50,6 @@
{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_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL},
{RIL_UNSOL_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL}, // 1036
{RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, responseVoid, WAKE_PARTIAL}, // 11001
{RIL_UNSOL_STK_SEND_SMS_RESULT, responseInts, WAKE_PARTIAL}, // 11002

@ -114,6 +114,9 @@ namespace android {
#define appendPrintBuf(x...)
#endif
#define MAX_RIL_SOL RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE
#define MAX_RIL_UNSOL RIL_UNSOL_CELL_INFO_LIST
enum WakeType {DONT_WAKE, WAKE_PARTIAL};
typedef struct {
@ -336,7 +339,7 @@ issueLocalRequest(int request, void *data, int len) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
index = request - 10000 + MAX_RIL_SOL;
RLOGD("SAMSUNG: request=%d, index=%d", request, index);
pRI->pCI = &(s_commands[index]);
} else {
@ -379,7 +382,7 @@ processCommandBuffer(void *buffer, size_t buflen) {
}
/* Hack to include Samsung requests */
if (request < 1 || ((request > RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE) &&
if (request < 1 || ((request > MAX_RIL_SOL) &&
(request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) ||
request > RIL_REQUEST_HANGUP_VT) {
RLOGE("unsupported request code %d token %d", request, token);
@ -393,7 +396,7 @@ processCommandBuffer(void *buffer, size_t buflen) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
index = request - 10000 + MAX_RIL_SOL;
RLOGD("processCommandBuffer: samsung request=%d, index=%d",
request, index);
pRI->pCI = &(s_commands[index]);
@ -1442,7 +1445,7 @@ responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responsele
}
if (responselen % sizeof(int) != 0) {
RLOGE("invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(int));
(int)responselen, (int)sizeof(int));
return RIL_ERRNO_INVALID_RESPONSE;
}
@ -3109,8 +3112,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
@ -3425,7 +3434,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;
RLOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, unsolResponseIndex);
} else {
unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE;
}
if ((unsolResponseIndex < 0)
|| (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) {
@ -3782,6 +3797,7 @@ requestToString(int request) {
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_CELL_INFO_LIST: return "UNSOL_CELL_INFO_LIST";
case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT";
default: return "<unknown request>";
}
}

@ -124,7 +124,7 @@
{RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, dispatchString, responseSIM_IO},
{RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoiceRadioTech, responseInts},
{RIL_REQUEST_GET_CELL_INFO_LIST, dispatchVoid, responseCellInfoList},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, responseVoid},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, responseVoid}, // 110
{0, NULL, NULL}, // 10001
{RIL_REQUEST_GET_CELL_BROADCAST_CONFIG, dispatchVoid, responseVoid},
{0, NULL, NULL}, // 10003

@ -50,4 +50,6 @@
{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_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL},
{RIL_UNSOL_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL}, // 1036
{RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, responseVoid, WAKE_PARTIAL}, // 11001
{RIL_UNSOL_STK_SEND_SMS_RESULT, responseInts, WAKE_PARTIAL}, // 11002

Loading…
Cancel
Save