diff options
-rw-r--r-- | include/telephony/ril.h | 30 | ||||
-rwxr-xr-x | libril/ril.cpp | 53 | ||||
-rw-r--r-- | libril/ril_commands.h | 1 |
3 files changed, 83 insertions, 1 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index b84cf7b..7ad0fbc 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -1492,6 +1492,12 @@ typedef struct { uint32_t rx_mode_time_ms; } RIL_ActivityStatsInfo; +typedef struct { + uint8_t p2; /* P2 parameter */ + char * aidPtr; /* AID value, See ETSI 102.221 and 101.220*/ + +} RIL_CafOpenChannelParams; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -4538,8 +4544,30 @@ typedef struct { */ #define RIL_REQUEST_SIM_GET_ATR 136 -/***********************************************************************/ +/** + * RIL_REQUEST_CAF_SIM_OPEN_CHANNEL_WITH_P2 + * + * Open a new logical channel and select the given application. This command + * reflects TS 27.007 "open logical channel" operation (+CCHO). This request + * also specifies the P2 parameter. + * + * "data" is a const RIL_CafOpenChannelParam * + * + * "response" is int * + * ((int *)data)[0] contains the session id of the logical channel. + * ((int *)data)[1] onwards may optionally contain the select response for the + * open channel command with one byte per integer. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + * MISSING_RESOURCE + * NO_SUCH_ELEMENT + */ +#define RIL_REQUEST_CAF_SIM_OPEN_CHANNEL_WITH_P2 137 +/***********************************************************************/ #define RIL_UNSOL_RESPONSE_BASE 1000 diff --git a/libril/ril.cpp b/libril/ril.cpp index 87cf197..23c4b23 100755 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -271,6 +271,7 @@ static void dispatchUiccSubscripton(Parcel &p, RequestInfo *pRI); static void dispatchSimAuthentication(Parcel &p, RequestInfo *pRI); static void dispatchDataProfile(Parcel &p, RequestInfo *pRI); static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI); +static void dispatchOpenChannelWithP2(Parcel &p, RequestInfo *pRI); static int responseInts(Parcel &p, void *response, size_t responselen); static int responseFailCause(Parcel &p, void *response, size_t responselen); static int responseStrings(Parcel &p, void *response, size_t responselen); @@ -2050,6 +2051,57 @@ invalid: return; } +/** + * Callee expects const RIL_CafOpenChannelParams * + * Payload is: + * byte p2 + * char * aidPtr + */ +static void dispatchOpenChannelWithP2 (Parcel &p, RequestInfo *pRI) { + RIL_CafOpenChannelParams openChannel; + status_t status; + uint8_t p2; + +#if VDBG + RLOGD("dispatchOpenChannelWithP2"); +#endif + memset (&openChannel, 0, sizeof(RIL_CafOpenChannelParams)); + + status = p.read(&p2, sizeof(p2)); + openChannel.p2 = (uint8_t) p2; + + openChannel.aidPtr = strdupReadString(p); + if (status != NO_ERROR || openChannel.aidPtr == NULL) { + goto invalid; + } + + startRequest; + appendPrintBuf("%s[p2:%d, aid:%s]", printBuf, openChannel.p2, openChannel.aidPtr); + + closeRequest; + printRequest(pRI->token, pRI->pCI->requestNumber); + + CALL_ONREQUEST(pRI->pCI->requestNumber, + &openChannel, + sizeof(openChannel), + pRI, pRI->socket_id); + +#ifdef MEMSET_FREED + memsetString(openChannel.aidPtr); +#endif + + free(openChannel.aidPtr); + +#ifdef MEMSET_FREED + memset(&openChannel, 0, sizeof(openChannel)); +#endif + + return; +invalid: + invalidCommandBlock(pRI); + return; +} + static int blockingWrite(int fd, const void *buffer, size_t len) { size_t writeOffset = 0; @@ -5124,6 +5176,7 @@ requestToString(int request) { case RIL_REQUEST_IMS_SEND_SMS: return "IMS_SEND_SMS"; case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: return "SIM_TRANSMIT_APDU_BASIC"; case RIL_REQUEST_SIM_OPEN_CHANNEL: return "SIM_OPEN_CHANNEL"; + case RIL_REQUEST_CAF_SIM_OPEN_CHANNEL_WITH_P2: return "CAF_SIM_OPEN_CHANNEL_WITH_P2"; case RIL_REQUEST_SIM_CLOSE_CHANNEL: return "SIM_CLOSE_CHANNEL"; case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: return "SIM_TRANSMIT_APDU_CHANNEL"; case RIL_REQUEST_GET_RADIO_CAPABILITY: return "RIL_REQUEST_GET_RADIO_CAPABILITY"; diff --git a/libril/ril_commands.h b/libril/ril_commands.h index 50e649a..acbd6ba 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -151,3 +151,4 @@ {RIL_REQUEST_PULL_LCEDATA, dispatchVoid, responseLceData}, {RIL_REQUEST_GET_ACTIVITY_INFO, dispatchVoid, responseActivityData}, {RIL_REQUEST_SIM_GET_ATR, dispatchInts, responseString}, + {RIL_REQUEST_CAF_SIM_OPEN_CHANNEL_WITH_P2, dispatchOpenChannelWithP2, responseInts}, |