aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2016-09-10 10:47:32 +0200
committerAndreas Blaesius <skate4life@gmx.de>2016-09-25 18:54:53 +0200
commit9d932a7b11324537aa12d09589cc952032a5d117 (patch)
treefb13260df0d0d5abc1a2e7e9faa50a8516911882
parent31330a5ba4767b53e4051c47ddf61eafde91a7f3 (diff)
downloaddevice_samsung_espresso3g-9d932a7b11324537aa12d09589cc952032a5d117.zip
device_samsung_espresso3g-9d932a7b11324537aa12d09589cc952032a5d117.tar.gz
device_samsung_espresso3g-9d932a7b11324537aa12d09589cc952032a5d117.tar.bz2
libsecril-shim: fix RIL_REQUEST_GET_SIM_STATUS
Change-Id: I6dc59545053c466efb70df92742150f009892711
-rw-r--r--rilsrc/libsecril-shim/secril-shim.c29
-rw-r--r--rilsrc/libsecril-shim/secril-shim.h29
2 files changed, 58 insertions, 0 deletions
diff --git a/rilsrc/libsecril-shim/secril-shim.c b/rilsrc/libsecril-shim/secril-shim.c
index 5e8111e..ff2e737 100644
--- a/rilsrc/libsecril-shim/secril-shim.c
+++ b/rilsrc/libsecril-shim/secril-shim.c
@@ -59,6 +59,28 @@ static void onRequestShim(int request, void *data, size_t datalen, RIL_Token t)
origRilFunctions->onRequest(request, data, datalen, t);
}
+static void onCompleteRequestGetSimStatus(RIL_Token t, RIL_Errno e, void *response, size_t responselen) {
+ /* While at it, upgrade the response to RIL_CardStatus_v6 */
+ RIL_CardStatus_v5_samsung *p_cur = ((RIL_CardStatus_v5_samsung *) response);
+ RIL_CardStatus_v6 *v6response = malloc(sizeof(RIL_CardStatus_v6));
+
+ v6response->card_state = p_cur->card_state;
+ v6response->universal_pin_state = p_cur->universal_pin_state;
+ v6response->gsm_umts_subscription_app_index = p_cur->gsm_umts_subscription_app_index;
+ v6response->cdma_subscription_app_index = p_cur->cdma_subscription_app_index;
+ v6response->ims_subscription_app_index = -1;
+ v6response->num_applications = p_cur->num_applications;
+
+ int i;
+ for (i = 0; i < RIL_CARD_MAX_APPS; ++i)
+ memcpy(&v6response->applications[i], &p_cur->applications[i], sizeof(RIL_AppStatus));
+
+ /* Send the fixed response to libril */
+ rilEnv->OnRequestComplete(t, e, v6response, sizeof(RIL_CardStatus_v6));
+
+ free(v6response);
+}
+
static void fixupDataCallList(void *response, size_t responselen) {
RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) response;
int num = responselen / sizeof(RIL_Data_Call_Response_v6);
@@ -128,6 +150,13 @@ static void onRequestCompleteShim(RIL_Token t, RIL_Errno e, void *response, size
request = pRI->pCI->requestNumber;
switch (request) {
+ case RIL_REQUEST_GET_SIM_STATUS:
+ /* Remove unused extra elements from RIL_AppStatus */
+ if (response != NULL && responselen == sizeof(RIL_CardStatus_v5_samsung)) {
+ onCompleteRequestGetSimStatus(t, e, response, responselen);
+ return;
+ }
+ break;
case RIL_REQUEST_LAST_CALL_FAIL_CAUSE:
/* Remove extra element (ignored on pre-M, now crashing the framework) */
if (responselen > sizeof(int)) {
diff --git a/rilsrc/libsecril-shim/secril-shim.h b/rilsrc/libsecril-shim/secril-shim.h
index a938f4b..19ef464 100644
--- a/rilsrc/libsecril-shim/secril-shim.h
+++ b/rilsrc/libsecril-shim/secril-shim.h
@@ -21,6 +21,35 @@
extern const char * requestToString(int request);
+typedef struct
+{
+ RIL_AppType app_type;
+ RIL_AppState app_state;
+ RIL_PersoSubstate perso_substate; /* applicable only if app_state ==
+ RIL_APPSTATE_SUBSCRIPTION_PERSO */
+ char *aid_ptr; /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
+ 0x30, 0x30, 0x30 */
+ char *app_label_ptr; /* null terminated string */
+ int pin1_replaced; /* applicable to USIM, CSIM & ISIM */
+ RIL_PinState pin1;
+ RIL_PinState pin2;
+ int foo1; /* Samsung */
+ int foo2; /* Samsung */
+ int foo3; /* Samsung */
+ int foo4; /* Samsung */
+ int foo5; /* Samsung */
+} RIL_AppStatus_samsung;
+
+typedef struct
+{
+ RIL_CardState card_state;
+ RIL_PinState universal_pin_state; /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
+ int gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
+ int cdma_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
+ int num_applications; /* value <= RIL_CARD_MAX_APPS */
+ RIL_AppStatus_samsung applications[RIL_CARD_MAX_APPS];
+} RIL_CardStatus_v5_samsung;
+
/* TODO: Do we really need to redefine these? They aren't in a header... */
typedef struct {
int requestNumber;