diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 12:16:21 +0000 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 12:16:21 +0000 |
commit | a9b48eaf6b0912b7b657a46d86540dbf7e58278a (patch) | |
tree | 1037f8ac91562a5509d6dfdd6e2cfb1251342aaf | |
parent | a28b67c7ec595e55a4ff083b8b270dfd5f74a889 (diff) | |
parent | 2210a0276fa000ef7224f26b24f00cb34a372e8d (diff) | |
download | android_hardware_ril-a9b48eaf6b0912b7b657a46d86540dbf7e58278a.tar.gz android_hardware_ril-a9b48eaf6b0912b7b657a46d86540dbf7e58278a.tar.bz2 android_hardware_ril-a9b48eaf6b0912b7b657a46d86540dbf7e58278a.zip |
Merge tag 'android-5.1.0_r1' into HEADstaging/cm-12.1
Android 5.1.0 release 1
-rw-r--r-- | include/telephony/ril.h | 313 | ||||
-rw-r--r-- | libril/ril.cpp | 283 | ||||
-rw-r--r-- | libril/ril_commands.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | libril/ril_unsol_commands.h | 3 | ||||
-rw-r--r-- | reference-ril/reference-ril.c | 15 |
5 files changed, 584 insertions, 32 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 6f3338b..62521f4 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -46,7 +46,7 @@ extern "C" { #define SIM_COUNT 1 #endif -#define RIL_VERSION 10 /* Current version */ +#define RIL_VERSION 11 /* Current version */ #define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */ #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64 @@ -57,6 +57,8 @@ extern "C" { #define MAX_CLIENT_ID_LENGTH 2 #define MAX_DEBUG_SOCKET_NAME_LENGTH 12 #define MAX_QEMU_PIPE_NAME_LENGTH 11 +#define MAX_UUID_LENGTH 64 + typedef void * RIL_Token; @@ -99,7 +101,21 @@ typedef enum { RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to illegal SIM or ME */ RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */ - RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ + RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ + RIL_E_DIAL_MODIFIED_TO_USSD = 18, /* DIAL request modified to USSD */ + RIL_E_DIAL_MODIFIED_TO_SS = 19, /* DIAL request modified to SS */ + RIL_E_DIAL_MODIFIED_TO_DIAL = 20, /* DIAL request modified to DIAL with different + data */ + RIL_E_USSD_MODIFIED_TO_DIAL = 21, /* USSD request modified to DIAL */ + RIL_E_USSD_MODIFIED_TO_SS = 22, /* USSD request modified to SS */ + RIL_E_USSD_MODIFIED_TO_USSD = 23, /* USSD request modified to different USSD + request */ + RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */ + RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */ + RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */ + RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */ + + } RIL_Errno; typedef enum { @@ -149,6 +165,62 @@ typedef enum { RADIO_TECH_TD_SCDMA = 17 } RIL_RadioTechnology; +typedef enum { + RAF_UNKNOWN = (1 << RADIO_TECH_UNKNOWN), + RAF_GPRS = (1 << RADIO_TECH_GPRS), + RAF_EDGE = (1 << RADIO_TECH_EDGE), + RAF_UMTS = (1 << RADIO_TECH_UMTS), + RAF_IS95A = (1 << RADIO_TECH_IS95A), + RAF_IS95B = (1 << RADIO_TECH_IS95B), + RAF_1xRTT = (1 << RADIO_TECH_1xRTT), + RAF_EVDO_0 = (1 << RADIO_TECH_EVDO_0), + RAF_EVDO_A = (1 << RADIO_TECH_EVDO_A), + RAF_HSDPA = (1 << RADIO_TECH_HSDPA), + RAF_HSUPA = (1 << RADIO_TECH_HSUPA), + RAF_HSPA = (1 << RADIO_TECH_HSPA), + RAF_EVDO_B = (1 << RADIO_TECH_EVDO_B), + RAF_EHRPD = (1 << RADIO_TECH_EHRPD), + RAF_LTE = (1 << RADIO_TECH_LTE), + RAF_HSPAP = (1 << RADIO_TECH_HSPAP), + RAF_GSM = (1 << RADIO_TECH_GSM), + RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA), +} RIL_RadioAccessFamily; + +typedef enum { + RC_PHASE_CONFIGURED = 0, // LM is configured is initial value and value after FINISH completes + RC_PHASE_START = 1, // START is sent before Apply and indicates that an APPLY will be + // forthcoming with these same parameters + RC_PHASE_APPLY = 2, // APPLY is sent after all LM's receive START and returned + // RIL_RadioCapability.status = 0, if any START's fail no + // APPLY will be sent + RC_PHASE_UNSOL_RSP = 3, // UNSOL_RSP is sent with RIL_UNSOL_RADIO_CAPABILITY + RC_PHASE_FINISH = 4 // FINISH is sent after all commands have completed. If an error + // occurs in any previous command the RIL_RadioAccessesFamily and + // logicalModemUuid fields will be the prior configuration thus + // restoring the configuration to the previous value. An error + // returned by this command will generally be ignored or may + // cause that logical modem to be removed from service. +} RadioCapabilityPhase; + +typedef enum { + RC_STATUS_NONE = 0, // This parameter has no meaning with RC_PHASE_START, + // RC_PHASE_APPLY + RC_STATUS_SUCCESS = 1, // Tell modem the action transaction of set radio + // capability was success with RC_PHASE_FINISH + RC_STATUS_FAIL = 2, // Tell modem the action transaction of set radio + // capability is fail with RC_PHASE_FINISH. +} RadioCapabilityStatus; + +#define RIL_RADIO_CAPABILITY_VERSION 1 +typedef struct { + int version; // Version of structure, RIL_RADIO_CAPABILITY_VERSION + int session; // Unique session value defined by framework returned in all "responses/unsol" + int phase; // CONFIGURED, START, APPLY, FINISH + int rat; // RIL_RadioAccessFamily for the radio + char logicalModemUuid[MAX_UUID_LENGTH]; // A UUID typically "com.xxxx.lmX where X is the logical modem. + int status; // Return status and an input parameter for RC_PHASE_FINISH +} RIL_RadioCapability; + // Do we want to split Data from Voice and the use // RIL_RadioTechnology for get/setPreferredVoice/Data ? typedef enum { @@ -307,7 +379,43 @@ typedef struct { to point connections. */ char * pcscf; /* the Proxy Call State Control Function address via PCO(Protocol Configuration Option) for IMS client. */ -} RIL_Data_Call_Response_v9; // FIXME: Change to v10 +} RIL_Data_Call_Response_v9; + +typedef struct { + int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */ + int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry + back-off timer value RIL wants to override the one + pre-configured in FW. + The unit is miliseconds. + The value < 0 means no value is suggested. + The value 0 means retry should be done ASAP. + The value of INT_MAX(0x7fffffff) means no retry. */ + int cid; /* Context ID, uniquely identifies this call */ + int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ + char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. + For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is + PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported + such as "IP" or "IPV6" */ + char * ifname; /* The network interface name */ + char * addresses; /* A space-delimited list of addresses with optional "/" prefix length, + e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". + May not be empty, typically 1 IPv4 or 1 IPv6 or + one of each. If the prefix length is absent the addresses + are assumed to be point to point with IPv4 having a prefix + length of 32 and IPv6 128. */ + char * dnses; /* A space-delimited list of DNS server addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty. */ + char * gateways; /* A space-delimited list of default gateway addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty in which case the addresses represent point + to point connections. */ + char * pcscf; /* the Proxy Call State Control Function address + via PCO(Protocol Configuration Option) for IMS client. */ + int mtu; /* MTU received from network + Value <= 0 means network has either not sent a value or + sent an invalid value */ +} RIL_Data_Call_Response_v11; typedef enum { RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ @@ -468,6 +576,9 @@ typedef enum { CALL_FAIL_FDN_BLOCKED = 241, CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242, CALL_FAIL_IMEI_NOT_ACCEPTED = 243, + CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK Call Control */ + CALL_FAIL_DIAL_MODIFIED_TO_SS = 245, + CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246, CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000, CALL_FAIL_CDMA_DROP = 1001, CALL_FAIL_CDMA_INTERCEPT = 1002, @@ -531,7 +642,11 @@ typedef enum { typedef enum { RIL_DATA_PROFILE_DEFAULT = 0, RIL_DATA_PROFILE_TETHERED = 1, - RIL_DATA_PROFILE_OEM_BASE = 1000 /* Start of OEM-specific profiles */ + RIL_DATA_PROFILE_IMS = 2, + RIL_DATA_PROFILE_FOTA = 3, + RIL_DATA_PROFILE_CBS = 4, + RIL_DATA_PROFILE_OEM_BASE = 1000, /* Start of OEM-specific profiles */ + RIL_DATA_PROFILE_INVALID = 0xFFFFFFFF } RIL_DataProfile; /* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */ @@ -1089,8 +1204,6 @@ typedef struct { #define RIL_CDMA_MAX_NUMBER_OF_INFO_RECS 10 -#define RIL_HARDWARE_CONFIG_UUID_LENGTH 64 - typedef struct { char numberOfInfoRecs; RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS]; @@ -1135,12 +1248,12 @@ typedef struct { } RIL_HardwareConfig_Modem; typedef struct { - char modemUuid[RIL_HARDWARE_CONFIG_UUID_LENGTH]; + char modemUuid[MAX_UUID_LENGTH]; } RIL_HardwareConfig_Sim; typedef struct { RIL_HardwareConfig_Type type; - char uuid[RIL_HARDWARE_CONFIG_UUID_LENGTH]; + char uuid[MAX_UUID_LENGTH]; RIL_HardwareConfig_State state; union { RIL_HardwareConfig_Modem modem; @@ -1148,6 +1261,80 @@ typedef struct { } cfg; } RIL_HardwareConfig; +typedef enum { + SS_CFU, + SS_CF_BUSY, + SS_CF_NO_REPLY, + SS_CF_NOT_REACHABLE, + SS_CF_ALL, + SS_CF_ALL_CONDITIONAL, + SS_CLIP, + SS_CLIR, + SS_COLP, + SS_COLR, + SS_WAIT, + SS_BAOC, + SS_BAOIC, + SS_BAOIC_EXC_HOME, + SS_BAIC, + SS_BAIC_ROAMING, + SS_ALL_BARRING, + SS_OUTGOING_BARRING, + SS_INCOMING_BARRING +} RIL_SsServiceType; + +typedef enum { + SS_ACTIVATION, + SS_DEACTIVATION, + SS_INTERROGATION, + SS_REGISTRATION, + SS_ERASURE +} RIL_SsRequestType; + +typedef enum { + SS_ALL_TELE_AND_BEARER_SERVICES, + SS_ALL_TELESEVICES, + SS_TELEPHONY, + SS_ALL_DATA_TELESERVICES, + SS_SMS_SERVICES, + SS_ALL_TELESERVICES_EXCEPT_SMS +} RIL_SsTeleserviceType; + +#define SS_INFO_MAX 4 +#define NUM_SERVICE_CLASSES 7 + +typedef struct { + int numValidIndexes; /* This gives the number of valid values in cfInfo. + For example if voice is forwarded to one number and data + is forwarded to a different one then numValidIndexes will be + 2 indicating total number of valid values in cfInfo. + Similarly if all the services are forwarded to the same + number then the value of numValidIndexes will be 1. */ + + RIL_CallForwardInfo cfInfo[NUM_SERVICE_CLASSES]; /* This is the response data + for SS request to query call + forward status. see + RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */ +} RIL_CfData; + +typedef struct { + RIL_SsServiceType serviceType; + RIL_SsRequestType requestType; + RIL_SsTeleserviceType teleserviceType; + int serviceClass; + RIL_Errno result; + + union { + int ssInfo[SS_INFO_MAX]; /* This is the response data for most of the SS GET/SET + RIL requests. E.g. RIL_REQUSET_GET_CLIR returns + two ints, so first two values of ssInfo[] will be + used for response if serviceType is SS_CLIR and + requestType is SS_INTERROGATION */ + + RIL_CfData cfData; + }; +} RIL_StkCcUnsolSsResponse; + /** * Data connection power state */ @@ -1237,7 +1424,6 @@ typedef struct { #define RIL_REQUEST_ENTER_SIM_PIN 2 - /** * RIL_REQUEST_ENTER_SIM_PUK * @@ -1415,6 +1601,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * DIAL_MODIFIED_TO_USSD + * DIAL_MODIFIED_TO_SS + * DIAL_MODIFIED_TO_DIAL * GENERIC_FAILURE */ #define RIL_REQUEST_DIAL 10 @@ -1950,7 +2139,7 @@ typedef struct { * For example, "IP", "IPV6", "IPV4V6", or "PPP". * ((const char **)data)[7] Optional connection property parameters, format to be defined. * - * "response" is a RIL_Data_Call_Response_v6 + * "response" is a RIL_Data_Call_Response_v11 * * FIXME may need way to configure QoS settings * @@ -2018,6 +2207,9 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * FDN_CHECK_FAILURE + * USSD_MODIFIED_TO_DIAL + * USSD_MODIFIED_TO_SS + * USSD_MODIFIED_TO_USSD * GENERIC_FAILURE * * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD @@ -2053,6 +2245,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_GET_CLIR 31 @@ -2068,6 +2263,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CLIR 32 @@ -2091,6 +2289,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33 @@ -2107,6 +2308,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_FORWARD 34 @@ -2133,6 +2337,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_WAITING 35 @@ -2152,6 +2359,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_WAITING 36 @@ -2294,6 +2504,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2323,6 +2536,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2345,6 +2561,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2565,6 +2784,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ @@ -4061,6 +4283,7 @@ typedef struct { * RIL_REQUEST_SET_DATA_PROFILE * * Set data profile in modem + * Modem should erase existed profiles from framework, and apply new profiles * "data" is an const RIL_DataProfileInfo ** * "datalen" is count * sizeof(const RIL_DataProfileInfo *) * "response" is NULL @@ -4089,6 +4312,41 @@ typedef struct { */ #define RIL_REQUEST_SHUTDOWN 129 +/** + * RIL_REQUEST_GET_RADIO_CAPABILITY + * + * Used to get phone radio capablility. + * + * "data" is int * + * ((int *)data)[0] is the phone radio access family defined in + * RadioAccessFamily. It's a bit mask value to represent the support type. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_GET_RADIO_CAPABILITY 130 + +/** + * RIL_REQUEST_SET_RADIO_CAPABILITY + * + * Used to set the phones radio capability. Be VERY careful + * using this request as it may cause some vendor modems to reset. Because + * of the possible modem reset any RIL commands after this one may not be + * processed. + * + * "data" is the RIL_RadioCapability structure + * + * "response" is the RIL_RadioCapability structure, used to feedback return status + * + * Valid errors: + * SUCCESS means a RIL_UNSOL_RADIO_CAPABILITY will be sent within 30 seconds. + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SET_RADIO_CAPABILITY 131 + /***********************************************************************/ @@ -4226,7 +4484,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4646,8 +4903,42 @@ typedef struct { */ #define RIL_UNSOL_DC_RT_INFO_CHANGED 1041 +/** + * RIL_UNSOL_RADIO_CAPABILITY + * + * Sent when RIL_REQUEST_SET_RADIO_CAPABILITY completes. + * Returns the phone radio capability exactly as + * RIL_REQUEST_GET_RADIO_CAPABILITY and should be the + * same set as sent by RIL_REQUEST_SET_RADIO_CAPABILITY. + * + * "data" is the RIL_RadioCapability structure + */ +#define RIL_UNSOL_RADIO_CAPABILITY 1042 + +/* + * RIL_UNSOL_ON_SS + * + * Called when SS response is received when DIAL/USSD/SS is changed to SS by + * call control. + * + * "data" is const RIL_StkCcUnsolSsResponse * + * + */ +#define RIL_UNSOL_ON_SS 1043 + +/** + * RIL_UNSOL_STK_CC_ALPHA_NOTIFY + * + * Called when there is an ALPHA from UICC during Call Control. + * + * "data" is const char * containing ALPHA string from UICC in UTF-8 format. + * + */ +#define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044 + /***********************************************************************/ + #if defined(ANDROID_MULTI_SIM) /** * RIL_Request Function pointer diff --git a/libril/ril.cpp b/libril/ril.cpp index feaf60f..a1105b4 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -277,6 +277,7 @@ static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI); 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 int responseInts(Parcel &p, void *response, size_t responselen); static int responseStrings(Parcel &p, void *response, size_t responselen); static int responseString(Parcel &p, void *response, size_t responselen); @@ -303,11 +304,15 @@ static int responseSimRefresh(Parcel &p, void *response, size_t responselen); static int responseCellInfoList(Parcel &p, void *response, size_t responselen); static int responseHardwareConfig(Parcel &p, void *response, size_t responselen); static int responseDcRtInfo(Parcel &p, void *response, size_t responselen); +static int responseRadioCapability(Parcel &p, void *response, size_t responselen); +static int responseSSData(Parcel &p, void *response, size_t responselen); static int decodeVoiceRadioTechnology (RIL_RadioState radioState); static int decodeCdmaSubscriptionSource (RIL_RadioState radioState); static RIL_RadioState processRadioState(RIL_RadioState newRadioState); +static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType); + #ifdef RIL_SHLIB #if defined(ANDROID_MULTI_SIM) extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, void *data, @@ -380,6 +385,26 @@ strdupReadString(Parcel &p) { return strndup16to8(s16, stringlen); } +static status_t +readStringFromParcelInplace(Parcel &p, char *str, size_t maxLen) { + size_t s16Len; + const char16_t *s16; + + s16 = p.readString16Inplace(&s16Len); + if (s16 == NULL) { + return NO_MEMORY; + } + size_t strLen = strnlen16to8(s16, s16Len); + if ((strLen + 1) > maxLen) { + return NO_MEMORY; + } + if (strncpy16to8(str, s16, strLen) == NULL) { + return NO_MEMORY; + } else { + return NO_ERROR; + } +} + static void writeStringToParcel(Parcel &p, const char *s) { char16_t *s16; size_t s16_len; @@ -467,8 +492,6 @@ processCommandBuffer(void *buffer, size_t buflen, RIL_SOCKET_ID socket_id) { status = p.readInt32(&request); status = p.readInt32 (&token); - RLOGD("SOCKET %s REQUEST: %s length:%d", rilSocketIdToString(socket_id), requestToString(request), buflen); - #if (SIM_COUNT >= 2) if (socket_id == RIL_SOCKET_2) { pendingRequestsMutexHook = &s_pendingRequestsMutex_socket2; @@ -1952,6 +1975,67 @@ invalid: return; } +static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI){ + RIL_RadioCapability rc; + int32_t t; + status_t status; + + memset (&rc, 0, sizeof(RIL_RadioCapability)); + + status = p.readInt32(&t); + rc.version = (int)t; + if (status != NO_ERROR) { + goto invalid; + } + + status = p.readInt32(&t); + rc.session= (int)t; + if (status != NO_ERROR) { + goto invalid; + } + + status = p.readInt32(&t); + rc.phase= (int)t; + if (status != NO_ERROR) { + goto invalid; + } + + status = p.readInt32(&t); + rc.rat = (int)t; + if (status != NO_ERROR) { + goto invalid; + } + + status = readStringFromParcelInplace(p, rc.logicalModemUuid, sizeof(rc.logicalModemUuid)); + if (status != NO_ERROR) { + goto invalid; + } + + status = p.readInt32(&t); + rc.status = (int)t; + + if (status != NO_ERROR) { + goto invalid; + } + + startRequest; + appendPrintBuf("%s [version:%d, session:%d, phase:%d, rat:%d, \ + logicalModemUuid:%s, status:%d", printBuf, rc.version, rc.session + rc.phase, rc.rat, rc.logicalModemUuid, rc.session); + + closeRequest; + printRequest(pRI->token, pRI->pCI->requestNumber); + + CALL_ONREQUEST(pRI->pCI->requestNumber, + &rc, + sizeof(RIL_RadioCapability), + pRI, pRI->socket_id); + return; +invalid: + invalidCommandBlock(pRI); + return; +} + static int blockingWrite(int fd, const void *buffer, size_t len) { size_t writeOffset = 0; @@ -2326,36 +2410,86 @@ static int responseDataCallListV6(Parcel &p, void *response, size_t responselen) return 0; } +static int responseDataCallListV9(Parcel &p, void *response, size_t responselen) +{ + if (response == NULL && responselen != 0) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { + RLOGE("responseDataCallListV9: invalid response length %d expected multiple of %d", + (int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + // Write version + p.writeInt32(10); + + int num = responselen / sizeof(RIL_Data_Call_Response_v9); + p.writeInt32(num); + + RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; + startResponse; + int i; + for (i = 0; i < num; i++) { + p.writeInt32((int)p_cur[i].status); + p.writeInt32(p_cur[i].suggestedRetryTime); + p.writeInt32(p_cur[i].cid); + p.writeInt32(p_cur[i].active); + writeStringToParcel(p, p_cur[i].type); + writeStringToParcel(p, p_cur[i].ifname); + writeStringToParcel(p, p_cur[i].addresses); + writeStringToParcel(p, p_cur[i].dnses); + writeStringToParcel(p, p_cur[i].gateways); + writeStringToParcel(p, p_cur[i].pcscf); + appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, + p_cur[i].status, + p_cur[i].suggestedRetryTime, + p_cur[i].cid, + (p_cur[i].active==0)?"down":"up", + (char*)p_cur[i].type, + (char*)p_cur[i].ifname, + (char*)p_cur[i].addresses, + (char*)p_cur[i].dnses, + (char*)p_cur[i].gateways, + (char*)p_cur[i].pcscf); + } + removeLastChar; + closeResponse; + + return 0; +} + + static int responseDataCallList(Parcel &p, void *response, size_t responselen) { if (s_callbacks.version < 5) { RLOGD("responseDataCallList: v4"); return responseDataCallListV4(p, response, responselen); + } else if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { + return responseDataCallListV6(p, response, responselen); + } else if (responselen % sizeof(RIL_Data_Call_Response_v9) == 0) { + return responseDataCallListV9(p, response, responselen); } else { if (response == NULL && responselen != 0) { RLOGE("invalid response: NULL"); return RIL_ERRNO_INVALID_RESPONSE; } - // Support v6 or v9 with new rils - if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { - RLOGD("responseDataCallList: v6"); - return responseDataCallListV6(p, response, responselen); - } - - if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { - RLOGE("responseDataCallList: invalid response length %d expected multiple of %d", - (int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); + if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) { + RLOGE("invalid response length %d expected multiple of %d", + (int)responselen, (int)sizeof(RIL_Data_Call_Response_v11)); return RIL_ERRNO_INVALID_RESPONSE; } // Write version - p.writeInt32(10); + p.writeInt32(11); - int num = responselen / sizeof(RIL_Data_Call_Response_v9); + int num = responselen / sizeof(RIL_Data_Call_Response_v11); p.writeInt32(num); - RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; + RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response; startResponse; int i; for (i = 0; i < num; i++) { @@ -2369,7 +2503,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) writeStringToParcel(p, p_cur[i].dnses); writeStringToParcel(p, p_cur[i].gateways); writeStringToParcel(p, p_cur[i].pcscf); - appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, + p.writeInt32(p_cur[i].mtu); + appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],", printBuf, p_cur[i].status, p_cur[i].suggestedRetryTime, p_cur[i].cid, @@ -2379,7 +2514,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) (char*)p_cur[i].addresses, (char*)p_cur[i].dnses, (char*)p_cur[i].gateways, - (char*)p_cur[i].pcscf); + (char*)p_cur[i].pcscf, + p_cur[i].mtu); } removeLastChar; closeResponse; @@ -3122,6 +3258,118 @@ static int responseHardwareConfig(Parcel &p, void *response, size_t responselen) return 0; } +static int responseRadioCapability(Parcel &p, void *response, size_t responselen) { + if (response == NULL) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen != sizeof (RIL_RadioCapability) ) { + RLOGE("invalid response length was %d expected %d", + (int)responselen, (int)sizeof (RIL_SIM_IO_Response)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + RIL_RadioCapability *p_cur = (RIL_RadioCapability *) response; + p.writeInt32(p_cur->version); + p.writeInt32(p_cur->session); + p.writeInt32(p_cur->phase); + p.writeInt32(p_cur->rat); + writeStringToParcel(p, p_cur->logicalModemUuid); + p.writeInt32(p_cur->status); + + startResponse; + appendPrintBuf("%s[version=%d,session=%d,phase=%d,\ + rat=%s,logicalModemUuid=%s,status=%d]", + printBuf, + p_cur->version, + p_cur->session, + p_cur->phase, + p_cur->rat, + p_cur->logicalModemUuid, + p_cur->status); + closeResponse; + return 0; +} + +static int responseSSData(Parcel &p, void *response, size_t responselen) { + RLOGD("In responseSSData"); + int num; + + if (response == NULL && responselen != 0) { + RLOGE("invalid response length was %d expected %d", + (int)responselen, (int)sizeof (RIL_SIM_IO_Response)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen != sizeof(RIL_StkCcUnsolSsResponse)) { + RLOGE("invalid response length %d, expected %d", + (int)responselen, (int)sizeof(RIL_StkCcUnsolSsResponse)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + startResponse; + RIL_StkCcUnsolSsResponse *p_cur = (RIL_StkCcUnsolSsResponse *) response; + p.writeInt32(p_cur->serviceType); + p.writeInt32(p_cur->requestType); + p.writeInt32(p_cur->teleserviceType); + p.writeInt32(p_cur->serviceClass); + p.writeInt32(p_cur->result); + + if (isServiceTypeCfQuery(p_cur->serviceType, p_cur->requestType)) { + RLOGD("responseSSData CF type, num of Cf elements %d", p_cur->cfData.numValidIndexes); + if (p_cur->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { + RLOGE("numValidIndexes is greater than max value %d, " + "truncating it to max value", NUM_SERVICE_CLASSES); + p_cur->cfData.numValidIndexes = NUM_SERVICE_CLASSES; + } + /* number of call info's */ + p.writeInt32(p_cur->cfData.numValidIndexes); + + for (int i = 0; i < p_cur->cfData.numValidIndexes; i++) { + RIL_CallForwardInfo cf = p_cur->cfData.cfInfo[i]; + + p.writeInt32(cf.status); + p.writeInt32(cf.reason); + p.writeInt32(cf.serviceClass); + p.writeInt32(cf.toa); + writeStringToParcel(p, cf.number); + p.writeInt32(cf.timeSeconds); + appendPrintBuf("%s[%s,reason=%d,cls=%d,toa=%d,%s,tout=%d],", printBuf, + (cf.status==1)?"enable":"disable", cf.reason, cf.serviceClass, cf.toa, + (char*)cf.number, cf.timeSeconds); + RLOGD("Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, + cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); + } + } else { + p.writeInt32 (SS_INFO_MAX); + + /* each int*/ + for (int i = 0; i < SS_INFO_MAX; i++) { + appendPrintBuf("%s%d,", printBuf, p_cur->ssInfo[i]); + RLOGD("Data: %d",p_cur->ssInfo[i]); + p.writeInt32(p_cur->ssInfo[i]); + } + } + removeLastChar; + closeResponse; + + return 0; +} + +static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { + if ((reqType == SS_INTERROGATION) && + (serType == SS_CFU || + serType == SS_CF_BUSY || + serType == SS_CF_NO_REPLY || + serType == SS_CF_NOT_REACHABLE || + serType == SS_CF_ALL || + serType == SS_CF_ALL_CONDITIONAL)) { + return true; + } + return false; +} + static void triggerEvLoop() { int ret; if (!pthread_equal(pthread_self(), s_tid_dispatch)) { @@ -4662,6 +4910,8 @@ requestToString(int request) { case RIL_REQUEST_SIM_OPEN_CHANNEL: return "SIM_OPEN_CHANNEL"; 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"; + case RIL_REQUEST_SET_RADIO_CAPABILITY: return "RIL_REQUEST_SET_RADIO_CAPABILITY"; case RIL_REQUEST_SET_UICC_SUBSCRIPTION: return "SET_UICC_SUBSCRIPTION"; case RIL_REQUEST_ALLOW_DATA: return "ALLOW_DATA"; case RIL_REQUEST_GET_HARDWARE_CONFIG: return "GET_HARDWARE_CONFIG"; @@ -4711,6 +4961,7 @@ requestToString(int request) { case RIL_UNSOL_HARDWARE_CONFIG_CHANGED: return "HARDWARE_CONFIG_CHANGED"; case RIL_UNSOL_DC_RT_INFO_CHANGED: return "UNSOL_DC_RT_INFO_CHANGED"; case RIL_REQUEST_SHUTDOWN: return "SHUTDOWN"; + case RIL_UNSOL_RADIO_CAPABILITY: return "RIL_UNSOL_RADIO_CAPABILITY"; default: return "<unknown request>"; } } diff --git a/libril/ril_commands.h b/libril/ril_commands.h index 7c3af55..074e822 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -144,3 +144,5 @@ {RIL_REQUEST_SET_DC_RT_INFO_RATE, dispatchInts, responseVoid}, {RIL_REQUEST_SET_DATA_PROFILE, dispatchDataProfile, responseVoid}, {RIL_REQUEST_SHUTDOWN, dispatchVoid, responseVoid}, + {RIL_REQUEST_GET_RADIO_CAPABILITY, dispatchVoid, responseRadioCapability}, + {RIL_REQUEST_SET_RADIO_CAPABILITY, dispatchRadioCapability, responseRadioCapability}, diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h index 2232015..6ea7157 100644..100755 --- a/libril/ril_unsol_commands.h +++ b/libril/ril_unsol_commands.h @@ -56,3 +56,6 @@ {RIL_UNSOL_SRVCC_STATE_NOTIFY, responseInts, WAKE_PARTIAL}, {RIL_UNSOL_HARDWARE_CONFIG_CHANGED, responseHardwareConfig, WAKE_PARTIAL}, {RIL_UNSOL_DC_RT_INFO_CHANGED, responseDcRtInfo, WAKE_PARTIAL}, + {RIL_UNSOL_RADIO_CAPABILITY, responseRadioCapability, WAKE_PARTIAL}, + {RIL_UNSOL_ON_SS, responseSSData, WAKE_PARTIAL}, + {RIL_UNSOL_STK_CC_ALPHA_NOTIFY, responseString, WAKE_PARTIAL}, diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index a3f24c7..45340e3 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -51,6 +51,9 @@ static void *noopRemoveWarning( void *a ) { return a; } /* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */ #define PPP_TTY_PATH "eth0" +// Default MTU value +#define DEFAULT_MTU 1500 + #ifdef USE_TI_COMMANDS // Enable a workaround @@ -449,8 +452,8 @@ static void requestOrSendDataCallList(RIL_Token *t) p_cur = p_cur->p_next) n++; - RIL_Data_Call_Response_v9 *responses = - alloca(n * sizeof(RIL_Data_Call_Response_v9)); + RIL_Data_Call_Response_v11 *responses = + alloca(n * sizeof(RIL_Data_Call_Response_v11)); int i; for (i = 0; i < n; i++) { @@ -464,9 +467,10 @@ static void requestOrSendDataCallList(RIL_Token *t) responses[i].dnses = ""; responses[i].gateways = ""; responses[i].pcscf = ""; + responses[i].mtu = 0; } - RIL_Data_Call_Response_v9 *response = responses; + RIL_Data_Call_Response_v11 *response = responses; for (p_cur = p_response->p_intermediates; p_cur != NULL; p_cur = p_cur->p_next) { char *line = p_cur->line; @@ -583,6 +587,7 @@ static void requestOrSendDataCallList(RIL_Token *t) /* There is only on gateway in the emulator */ responses[i].gateways = "10.0.2.2"; + responses[i].mtu = DEFAULT_MTU; } else { /* I don't know where we are, so use the public Google DNS @@ -598,11 +603,11 @@ static void requestOrSendDataCallList(RIL_Token *t) if (t != NULL) RIL_onRequestComplete(*t, RIL_E_SUCCESS, responses, - n * sizeof(RIL_Data_Call_Response_v9)); + n * sizeof(RIL_Data_Call_Response_v11)); else RIL_onUnsolicitedResponse(RIL_UNSOL_DATA_CALL_LIST_CHANGED, responses, - n * sizeof(RIL_Data_Call_Response_v9)); + n * sizeof(RIL_Data_Call_Response_v11)); return; |