summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hillenbrand <codeworkx@cyanogenmod.org>2013-09-04 23:46:58 +0200
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2013-09-04 23:50:06 +0200
commita22f51c83ea19e98bcc637e008fc9b3a003f2c13 (patch)
tree4cab3a10e95060085f9e736d319f39064ee08948
parent898047abc2e04fe34e325cc097ccaecf1c0d405a (diff)
downloadandroid_hardware_samsung-a22f51c83ea19e98bcc637e008fc9b3a003f2c13.tar.gz
android_hardware_samsung-a22f51c83ea19e98bcc637e008fc9b3a003f2c13.tar.bz2
android_hardware_samsung-a22f51c83ea19e98bcc637e008fc9b3a003f2c13.zip
libril: handle samsungs unsol responses
Change-Id: Ia42d9999ba0df93019a8864202f093163f8c3f41
-rwxr-xr-xril/xmm6260/libril/ril.cpp44
-rw-r--r--ril/xmm6260/libril/ril_unsol_commands.h4
-rw-r--r--ril/xmm6262/libril/ril.cpp30
-rw-r--r--ril/xmm6262/libril/ril_commands.h2
-rw-r--r--ril/xmm6262/libril/ril_unsol_commands.h4
5 files changed, 60 insertions, 24 deletions
diff --git a/ril/xmm6260/libril/ril.cpp b/ril/xmm6260/libril/ril.cpp
index 871ae38..da4d519 100755
--- a/ril/xmm6260/libril/ril.cpp
+++ b/ril/xmm6260/libril/ril.cpp
@@ -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
@@ -3412,8 +3421,14 @@ void RIL_onUnsolicitedResponse(int unsolResponse, void *data,
RLOGW("RIL_onUnsolicitedResponse called before RIL_register");
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>";
}
}
diff --git a/ril/xmm6260/libril/ril_unsol_commands.h b/ril/xmm6260/libril/ril_unsol_commands.h
index 0711225..8eaa7cd 100644
--- a/ril/xmm6260/libril/ril_unsol_commands.h
+++ b/ril/xmm6260/libril/ril_unsol_commands.h
@@ -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
diff --git a/ril/xmm6262/libril/ril.cpp b/ril/xmm6262/libril/ril.cpp
index 98779cc..5832d90 100644
--- a/ril/xmm6262/libril/ril.cpp
+++ b/ril/xmm6262/libril/ril.cpp
@@ -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
@@ -3424,8 +3433,14 @@ void RIL_onUnsolicitedResponse(int unsolResponse, void *data,
RLOGW("RIL_onUnsolicitedResponse called before RIL_register");
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>";
}
}
diff --git a/ril/xmm6262/libril/ril_commands.h b/ril/xmm6262/libril/ril_commands.h
index 43ad29e..9eed3dd 100644
--- a/ril/xmm6262/libril/ril_commands.h
+++ b/ril/xmm6262/libril/ril_commands.h
@@ -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
diff --git a/ril/xmm6262/libril/ril_unsol_commands.h b/ril/xmm6262/libril/ril_unsol_commands.h
index 0711225..8eaa7cd 100644
--- a/ril/xmm6262/libril/ril_unsol_commands.h
+++ b/ril/xmm6262/libril/ril_unsol_commands.h
@@ -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