diff options
author | Steve Kondik <shade@chemlab.org> | 2014-02-17 14:45:30 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-02-17 17:11:56 -0800 |
commit | e27954b610b4b708fc490f1752d379f017b8a1c8 (patch) | |
tree | 2b0689dca21282c68a7081a12eca5c3cd8a64796 | |
parent | fec1174237f0ba5bf3001499de997cba35d7795d (diff) | |
parent | e64bc77f8c328de9eb4ea3ed0f950b6f7abe5080 (diff) | |
download | android_hardware_ril-e27954b610b4b708fc490f1752d379f017b8a1c8.tar.gz android_hardware_ril-e27954b610b4b708fc490f1752d379f017b8a1c8.tar.bz2 android_hardware_ril-e27954b610b4b708fc490f1752d379f017b8a1c8.zip |
Merge branch 'kk_3.5_rb1.19' of git://codeaurora.org/platform/hardware/ril into cm-11.0-qcril
Change-Id: I0995b3b4c15cd597de89cad21941a950b9e94793
-rw-r--r-- | include/telephony/ril.h | 277 | ||||
-rw-r--r-- | include/telephony/ril_msim.h | 60 | ||||
-rwxr-xr-x[-rw-r--r--] | libril/ril.cpp | 240 | ||||
-rw-r--r-- | libril/ril_commands.h | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | libril/ril_unsol_commands.h | 5 | ||||
-rw-r--r-- | reference-ril/reference-ril.c | 112 | ||||
-rw-r--r-- | rild/rild.c | 30 |
7 files changed, 705 insertions, 26 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 72aa17f..e607e3c 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -1,4 +1,6 @@ /* + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * Not a Contribution * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +22,7 @@ #include <stdlib.h> #include <stdint.h> #include <telephony/ril_cdma_sms.h> +#include <telephony/ril_msim.h> #ifndef FEATURE_UNIT_TEST #include <sys/time.h> #endif /* !FEATURE_UNIT_TEST */ @@ -34,10 +37,17 @@ extern "C" { #else #define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */ #endif +#define RIL_QCOM_VERSION 3 /* Qualcomm internal RIL version */ #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64 #define CDMA_NUMBER_INFO_BUFFER_LENGTH 81 +#define MAX_RILDS 3 +#define MAX_SOCKET_NAME_LENGTH 6 +#define MAX_CLIENT_ID_LENGTH 2 +#define MAX_DEBUG_SOCKET_NAME_LENGTH 12 +#define MAX_QEMU_PIPE_NAME_LENGTH 11 + typedef void * RIL_Token; typedef enum { @@ -61,8 +71,19 @@ typedef enum { location */ RIL_E_MODE_NOT_SUPPORTED = 13, /* HW does not support preferred network type */ RIL_E_FDN_CHECK_FAILURE = 14, /* command failed because recipient is not on FDN list */ - RIL_E_ILLEGAL_SIM_OR_ME = 15 /* network selection failed due to + RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to illegal SIM or ME */ + RIL_E_UNUSED = 16, + RIL_E_DIAL_MODIFIED_TO_USSD = 17, /* DIAL request modified to USSD */ + RIL_E_DIAL_MODIFIED_TO_SS = 18, /* DIAL request modified to SS */ + RIL_E_DIAL_MODIFIED_TO_DIAL = 19, /* DIAL request modified to DIAL with different data */ + RIL_E_USSD_MODIFIED_TO_DIAL = 20, /* USSD request modified to DIAL */ + RIL_E_USSD_MODIFIED_TO_SS = 21, /* USSD request modified to SS */ + RIL_E_USSD_MODIFIED_TO_USSD = 22, /* USSD request modified to different USSD request */ + RIL_E_SS_MODIFIED_TO_DIAL = 23, /* SS request modified to DIAL */ + RIL_E_SS_MODIFIED_TO_USSD = 24, /* SS request modified to USSD */ + RIL_E_SS_MODIFIED_TO_SS = 25, /* SS request modified to different SS request */ + RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26 /* Subscription not supported by RIL */ } RIL_Errno; typedef enum { @@ -109,6 +130,7 @@ typedef enum { RADIO_TECH_LTE = 14, RADIO_TECH_HSPAP = 15, // HSPA+ RADIO_TECH_GSM = 16, // Only supports voice + RADIO_TECH_TD_SCDMA = 17, RADIO_TECH_DCHSPAP = 30 } RIL_RadioTechnology; @@ -127,7 +149,17 @@ typedef enum { PREF_NET_TYPE_LTE_GSM_WCDMA = 9, /* LTE, GSM/WCDMA */ PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */ PREF_NET_TYPE_LTE_ONLY = 11, /* LTE only */ - PREF_NET_TYPE_LTE_WCDMA = 12 /* LTE/WCDMA */ + PREF_NET_TYPE_LTE_WCDMA = 12, /* LTE/WCDMA */ + PREF_NET_TYPE_TD_SCDMA_ONLY = 13, /* TD-SCDMA only */ + PREF_NET_TYPE_TD_SCDMA_WCDMA = 14, /* TD-SCDMA and WCDMA */ + PREF_NET_TYPE_TD_SCDMA_LTE = 15, /* TD-SCDMA and LTE */ + PREF_NET_TYPE_TD_SCDMA_GSM = 16, /* TD-SCDMA and GSM */ + PREF_NET_TYPE_TD_SCDMA_GSM_LTE = 17, /* TD-SCDMA,GSM and LTE */ + PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA = 18, /* TD-SCDMA, GSM/WCDMA */ + PREF_NET_TYPE_TD_SCDMA_WCDMA_LTE = 19, /* TD-SCDMA, WCDMA and LTE */ + PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_LTE = 20, /* TD-SCDMA, GSM/WCDMA and LTE */ + PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO = 21, /* TD-SCDMA, GSM/WCDMA, CDMA and EvDo */ + PREF_NET_TYPE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA = 22 /* TD-SCDMA, LTE, CDMA, EvDo GSM/WCDMA */ } RIL_PreferredNetworkType; /* Source for cdma subscription */ @@ -383,6 +415,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, @@ -744,6 +779,13 @@ typedef struct { * also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */ } RIL_LTE_SignalStrength_v8; +typedef struct { + int rscp; /* The Received Signal Code Power in dBm multipled by -1. + * Range : 25 to 120 + * INT_MAX: 0x7FFFFFFF denotes invalid value. + * Reference: 3GPP TS 25.123, section 9.1.1.1 */ +} RIL_TD_SCDMA_SignalStrength_CAF; + /* Deprecated, use RIL_SignalStrength_v6 */ typedef struct { RIL_GW_SignalStrength GW_SignalStrength; @@ -765,6 +807,14 @@ typedef struct { RIL_LTE_SignalStrength_v8 LTE_SignalStrength; } RIL_SignalStrength_v8; +typedef struct { + RIL_GW_SignalStrength GW_SignalStrength; + RIL_CDMA_SignalStrength CDMA_SignalStrength; + RIL_EVDO_SignalStrength EVDO_SignalStrength; + RIL_LTE_SignalStrength_v8 LTE_SignalStrength; + RIL_TD_SCDMA_SignalStrength_CAF TD_SCDMA_SignalStrength; +} RIL_SignalStrength_v9_CAF; + /** RIL_CellIdentityGsm */ typedef struct { int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ @@ -976,6 +1026,86 @@ typedef struct { RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS]; } RIL_CDMA_InformationRecords; +/* Data Call Profile: Simple IP User Profile Parameters*/ +typedef struct { + int profileId; + int priority; /* priority. [0..255], 0 - highest */ +} RIL_DataCallProfileInfo; + +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; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -1012,7 +1142,6 @@ typedef struct { #define RIL_REQUEST_ENTER_SIM_PIN 2 - /** * RIL_REQUEST_ENTER_SIM_PUK * @@ -1136,12 +1265,13 @@ typedef struct { #define RIL_REQUEST_CHANGE_SIM_PIN2 7 /** - * RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION + * RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE * - * Requests that network personlization be deactivated + * Requests that personlization be deactivated * * "data" is const char ** - * ((const char **)(data))[0]] is network depersonlization code + * ((const char **)(data))[0]] is personlization type + * ((const char **)(data))[1]] is depersonlization code * * "response" is int * * ((int *)response)[0] is the number of retries remaining, or -1 if unknown @@ -1155,7 +1285,7 @@ typedef struct { * (code is invalid) */ -#define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8 +#define RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE 8 /** * RIL_REQUEST_GET_CURRENT_CALLS @@ -1190,6 +1320,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 @@ -1793,6 +1926,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 @@ -1828,6 +1964,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 @@ -1843,6 +1982,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 @@ -1866,6 +2008,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 @@ -1882,6 +2027,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 @@ -1908,6 +2056,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 @@ -1927,6 +2078,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 @@ -2069,6 +2223,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2098,6 +2255,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2120,6 +2280,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2340,6 +2503,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 */ @@ -3575,6 +3741,65 @@ typedef struct { */ #define RIL_REQUEST_IMS_SEND_SMS 113 +/** + * RIL_REQUEST_GET_DATA_CALL_PROFILE + * + * Get the Data Call Profile for a particular app type + * + * "data" is const int* + * (const int*)data[0] - App type. Value is specified the RUIM spec C.S0023-D + * + * + * "response" is a const char * containing the count and the array of profiles + * ((const int *)response)[0] Number RIL_DataCallProfileInfo structs(count) + * ((const char *)response)[1] is the buffer that contains 'count' number of + * RIL_DataCallProfileInfo structs. + * + * Valid errors: + * SUCCESS + * GENERIC_FAILURE + * RIL_E_DATA_CALL_PROFILE_ERROR + * RIL_E_DATA_CALL_PROFILE_NOT_AVAILABLE + * + */ +#define RIL_REQUEST_GET_DATA_CALL_PROFILE 114 + +/** + * RIL_REQUEST_SET_UICC_SUBSCRIPTION + * + * Selection/de-selection of a subscription from a SIM card + * "data" is const RIL_SelectUiccSub* + + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_SUPPORTED + * + */ +#define RIL_REQUEST_SET_UICC_SUBSCRIPTION 115 + +/** + * RIL_REQUEST_SET_DATA_SUBSCRIPTION + * + * Selects a subscription for data call setup + * "data" is NULL + * + * "response" is NULL + * + * Valid errors: + * + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_SUPPORTED + * + */ +#define RIL_REQUEST_SET_DATA_SUBSCRIPTION 116 + /***********************************************************************/ @@ -3711,7 +3936,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4080,6 +4304,43 @@ typedef struct { */ #define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037 +/** + * 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 1038 + + +/** + * 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 1039 + +/** + * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED + * + * Indicated when there is a change in subscription status. + * This event will be sent in the following scenarios + * - subscription readiness at modem, which was selected by telephony layer + * - when subscription is deactivated by modem due to UICC card removal + * - When network invalidates the subscription i.e. attach reject due to authentication reject + * + * "data" is const int * + * ((const int *)data)[0] == 0 for Subscription Deactivated + * ((const int *)data)[0] == 1 for Subscription Activated + * + */ +#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1040 /***********************************************************************/ diff --git a/include/telephony/ril_msim.h b/include/telephony/ril_msim.h new file mode 100644 index 0000000..28c0e77 --- /dev/null +++ b/include/telephony/ril_msim.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ANDROID_RIL_MSIM_H +#define ANDROID_RIL_MSIM_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + RIL_UICC_SUBSCRIPTION_DEACTIVATE = 0, + RIL_UICC_SUBSCRIPTION_ACTIVATE = 1 +} RIL_UiccSubActStatus; + +typedef enum { + RIL_SUBSCRIPTION_1 = 0, + RIL_SUBSCRIPTION_2 = 1, + RIL_SUBSCRIPTION_3 = 2 +} RIL_SubscriptionType; + +typedef struct { + int slot; /* 0, 1, ... etc. */ + int app_index; /* array subscriptor from applications[RIL_CARD_MAX_APPS] in + RIL_REQUEST_GET_SIM_STATUS */ + RIL_SubscriptionType sub_type; /* Indicates subscription 1 or subscription 2 */ + RIL_UiccSubActStatus act_status; +} RIL_SelectUiccSub; + +#ifdef __cplusplus +} +#endif + +#endif /*ANDROID_RIL_MSIM_H*/ diff --git a/libril/ril.cpp b/libril/ril.cpp index 171d37e..c2aa344 100644..100755 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -1,5 +1,7 @@ /* //device/libs/telephony/ril.cpp ** +** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +** Not a Contribution ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -143,7 +145,8 @@ typedef struct UserCallbackInfo { struct UserCallbackInfo *p_next; } UserCallbackInfo; - +extern "C" +char rild[MAX_SOCKET_NAME_LENGTH] = SOCKET_NAME_RIL; /*******************************************************************/ RIL_RadioFunctions s_callbacks = {0, NULL, NULL, NULL, NULL, NULL}; @@ -215,6 +218,7 @@ static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI); static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI); static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI); static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI); +static void dispatchUiccSubscripton(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 responseStringsNetworks(Parcel &p, void *response, size_t responselen); @@ -241,11 +245,14 @@ static int responseCdmaSignalInfoRecord(Parcel &p,void *response, size_t respons static int responseCdmaCallWaiting(Parcel &p,void *response, size_t responselen); static int responseSimRefresh(Parcel &p, void *response, size_t responselen); static int responseCellInfoList(Parcel &p, void *response, size_t responselen); +static int responseGetDataCallProfile(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); extern "C" const char * requestToString(int request); extern "C" const char * failCauseToString(RIL_Errno); extern "C" const char * callStateToString(RIL_CallState); @@ -289,6 +296,15 @@ int cdmaSubscriptionSource = -1; */ int simRuimStatus = -1; +static char * RIL_getRilSocketName() { + return rild; +} + +extern "C" +void RIL_setRilSocketName(char * s) { + strncpy(rild, s, MAX_SOCKET_NAME_LENGTH); +} + static char * strdupReadString(Parcel &p) { size_t stringlen; @@ -1515,6 +1531,56 @@ invalid: return; } +static void dispatchUiccSubscripton(Parcel &p, RequestInfo *pRI) { + RIL_SelectUiccSub uicc_sub; + status_t status; + int32_t t; + memset(&uicc_sub, 0, sizeof(uicc_sub)); + + status = p.readInt32(&t); + if (status != NO_ERROR) { + goto invalid; + } + uicc_sub.slot = (int) t; + + status = p.readInt32(&t); + if (status != NO_ERROR) { + goto invalid; + } + uicc_sub.app_index = (int) t; + + status = p.readInt32(&t); + if (status != NO_ERROR) { + goto invalid; + } + uicc_sub.sub_type = (RIL_SubscriptionType) t; + + status = p.readInt32(&t); + if (status != NO_ERROR) { + goto invalid; + } + uicc_sub.act_status = (RIL_UiccSubActStatus) t; + + startRequest; + appendPrintBuf("slot=%d, app_index=%d, act_status = %d", uicc_sub.slot, uicc_sub.app_index, + uicc_sub.act_status); + RLOGD("dispatchUiccSubscription, slot=%d, app_index=%d, act_status = %d", uicc_sub.slot, + uicc_sub.app_index, uicc_sub.act_status); + closeRequest; + printRequest(pRI->token, pRI->pCI->requestNumber); + + s_callbacks.onRequest(pRI->pCI->requestNumber, &uicc_sub, sizeof(uicc_sub), pRI); + +#ifdef MEMSET_FREED + memset(&uicc_sub, 0, sizeof(uicc_sub)); +#endif + return; + +invalid: + invalidCommandBlock(pRI); + return; +} + static int blockingWrite(int fd, const void *buffer, size_t len) { size_t writeOffset = 0; @@ -2095,7 +2161,6 @@ static int responseCdmaInformationRecords(Parcel &p, infoRec = &p_cur->infoRec[i]; p.writeInt32(infoRec->name); switch (infoRec->name) { - case RIL_CDMA_DISPLAY_INFO_REC: case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: if (infoRec->rec.display.alpha_len > CDMA_ALPHA_INFO_BUFFER_LENGTH) { @@ -2105,6 +2170,20 @@ static int responseCdmaInformationRecords(Parcel &p, CDMA_ALPHA_INFO_BUFFER_LENGTH); return RIL_ERRNO_INVALID_RESPONSE; } + // Write as a byteArray + p.writeInt32(infoRec->rec.display.alpha_len); + p.write(infoRec->rec.display.alpha_buf, + infoRec->rec.display.alpha_len); + break; + case RIL_CDMA_DISPLAY_INFO_REC: + if (infoRec->rec.display.alpha_len > + CDMA_ALPHA_INFO_BUFFER_LENGTH) { + RLOGE("invalid display info response length %d \ + expected not more than %d\n", + (int)infoRec->rec.display.alpha_len, + CDMA_ALPHA_INFO_BUFFER_LENGTH); + return RIL_ERRNO_INVALID_RESPONSE; + } string8 = (char*) malloc((infoRec->rec.display.alpha_len + 1) * sizeof(char) ); for (int i = 0 ; i < infoRec->rec.display.alpha_len ; i++) { @@ -2231,7 +2310,7 @@ static int responseRilSignalStrength(Parcel &p, } if (responselen >= sizeof (RIL_SignalStrength_v5)) { - RIL_SignalStrength_v6 *p_cur = ((RIL_SignalStrength_v6 *) response); + RIL_SignalStrength_v9_CAF *p_cur = ((RIL_SignalStrength_v9_CAF *) response); p.writeInt32(p_cur->GW_SignalStrength.signalStrength); p.writeInt32(p_cur->GW_SignalStrength.bitErrorRate); @@ -2272,12 +2351,26 @@ static int responseRilSignalStrength(Parcel &p, p.writeInt32(p_cur->LTE_SignalStrength.rsrq); p.writeInt32(p_cur->LTE_SignalStrength.rssnr); p.writeInt32(p_cur->LTE_SignalStrength.cqi); + if (responselen >= sizeof (RIL_SignalStrength_v8)) { + p.writeInt32(p_cur->LTE_SignalStrength.timingAdvance); + if (responselen >= sizeof (RIL_SignalStrength_v9_CAF)) { + p.writeInt32(p_cur->TD_SCDMA_SignalStrength.rscp); + } else { + p.writeInt32(INT_MAX); + } + } else { + p.writeInt32(INT_MAX); + p.writeInt32(INT_MAX); + } + } else { p.writeInt32(99); p.writeInt32(INT_MAX); p.writeInt32(INT_MAX); p.writeInt32(INT_MAX); p.writeInt32(INT_MAX); + p.writeInt32(INT_MAX); + p.writeInt32(INT_MAX); } startResponse; @@ -2399,7 +2492,7 @@ static int responseSimRefresh(Parcel &p, void *response, size_t responselen) { } startResponse; - if (s_callbacks.version == 7) { + if (s_callbacks.version >= 7) { RIL_SimRefreshResponse_v7 *p_cur = ((RIL_SimRefreshResponse_v7 *) response); p.writeInt32(p_cur->result); p.writeInt32(p_cur->ef_id); @@ -2557,6 +2650,83 @@ static int responseCellInfoList(Parcel &p, void *response, size_t responselen) 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: NULL"); + 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)) { @@ -2743,6 +2913,42 @@ static int responseCdmaSms(Parcel &p, void *response, size_t responselen) { return 0; } +/* response is the count and the list of RIL_DataCallProfileInfo */ +static int responseGetDataCallProfile(Parcel &p, void *response, size_t responselen) { + int num = 0; + + RLOGD("[OMH>]> %d", responselen); + + if (response == NULL && responselen != 0) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + RLOGD("[OMH>]> processing response"); + + /* number of profile info's */ + num = *((int *) response); + if (num > (responselen / sizeof(RIL_DataCallProfileInfo))) { + num = responselen / sizeof(RIL_DataCallProfileInfo); + } + p.writeInt32(num); + + RIL_DataCallProfileInfo *p_cur = ((RIL_DataCallProfileInfo *) ((int *)response + 1)); + + startResponse; + for (int i = 0 ; i < num ; i++) { + p.writeInt32(p_cur->profileId); + p.writeInt32(p_cur->priority); + appendPrintBuf("%s[profileId=%d,priority=%d],", printBuf, + p_cur->profileId, p_cur->priority); + p_cur++; + } + removeLastChar; + closeResponse; + + return 0; +} + /** * A write on the wakeup fd is done just to pop us out of select() * We empty the buffer here and then ril_event will reset the timers on the @@ -3228,9 +3434,9 @@ RIL_register (const RIL_RadioFunctions *callbacks) { s_fdListen = ret; #else - s_fdListen = android_get_control_socket(SOCKET_NAME_RIL); + s_fdListen = android_get_control_socket(RIL_getRilSocketName()); if (s_fdListen < 0) { - RLOGE("Failed to get socket '" SOCKET_NAME_RIL "'"); + RLOGE("Failed to get socket %s",RIL_getRilSocketName()); exit(-1); } @@ -3253,9 +3459,19 @@ RIL_register (const RIL_RadioFunctions *callbacks) { #if 1 // start debug interface socket - s_fdDebug = android_get_control_socket(SOCKET_NAME_RIL_DEBUG); + char *inst = NULL; + if (strlen(RIL_getRilSocketName()) >= strlen(SOCKET_NAME_RIL)) { + inst = RIL_getRilSocketName() + strlen(SOCKET_NAME_RIL); + } + + char rildebug[MAX_DEBUG_SOCKET_NAME_LENGTH] = SOCKET_NAME_RIL_DEBUG; + if (inst != NULL) { + strncat(rildebug, inst, MAX_DEBUG_SOCKET_NAME_LENGTH); + } + + s_fdDebug = android_get_control_socket(rildebug); if (s_fdDebug < 0) { - RLOGE("Failed to get socket '" SOCKET_NAME_RIL_DEBUG "' errno:%d", errno); + RLOGE("Failed to get socket : %s errno:%d", rildebug, errno); exit(-1); } @@ -3741,7 +3957,7 @@ requestToString(int request) { case RIL_REQUEST_ENTER_SIM_PUK2: return "ENTER_SIM_PUK2"; case RIL_REQUEST_CHANGE_SIM_PIN: return "CHANGE_SIM_PIN"; case RIL_REQUEST_CHANGE_SIM_PIN2: return "CHANGE_SIM_PIN2"; - case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: return "ENTER_NETWORK_DEPERSONALIZATION"; + case RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE: return "ENTER_DEPERSONALIZATION_CODE"; case RIL_REQUEST_GET_CURRENT_CALLS: return "GET_CURRENT_CALLS"; case RIL_REQUEST_DIAL: return "DIAL"; case RIL_REQUEST_GET_IMSI: return "GET_IMSI"; @@ -3838,6 +4054,7 @@ requestToString(int request) { case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU"; case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS"; case RIL_REQUEST_VOICE_RADIO_TECH: return "VOICE_RADIO_TECH"; + case RIL_REQUEST_WRITE_SMS_TO_SIM: return "WRITE_SMS_TO_SIM"; #ifndef RIL_NO_CELL_INFO_LIST case RIL_REQUEST_GET_CELL_INFO_LIST: return"GET_CELL_INFO_LIST"; case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: return"SET_UNSOL_CELL_INFO_LIST_RATE"; @@ -3845,6 +4062,9 @@ requestToString(int request) { case RIL_REQUEST_SET_INITIAL_ATTACH_APN: return "RIL_REQUEST_SET_INITIAL_ATTACH_APN"; case RIL_REQUEST_IMS_REGISTRATION_STATE: return "IMS_REGISTRATION_STATE"; case RIL_REQUEST_IMS_SEND_SMS: return "IMS_SEND_SMS"; + case RIL_REQUEST_GET_DATA_CALL_PROFILE: return "GET_DATA_CALL_PROFILE"; + case RIL_REQUEST_SET_UICC_SUBSCRIPTION: return "SET_UICC_SUBSCRIPTION"; + case RIL_REQUEST_SET_DATA_SUBSCRIPTION: return "SET_DATA_SUBSCRIPTION"; case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED"; @@ -3855,6 +4075,7 @@ requestToString(int request) { case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST(obsolete)"; case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED"; case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH"; + case RIL_UNSOL_SUPP_SVC_NOTIFICATION: return "UNSOL_SUPP_SVC_NOTIFICATION"; case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END"; case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND"; case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY"; @@ -3884,6 +4105,7 @@ requestToString(int request) { case RIL_UNSOL_CELL_INFO_LIST: return "UNSOL_CELL_INFO_LIST"; #endif case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: return "RESPONSE_IMS_NETWORK_STATE_CHANGED"; + case RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED: return "UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED"; default: return "<unknown request>"; } } diff --git a/libril/ril_commands.h b/libril/ril_commands.h index 4d026c3..bd68a06 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -1,5 +1,7 @@ /* //device/libs/telephony/ril_commands.h ** +** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +** Not a Contribution ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +24,7 @@ {RIL_REQUEST_ENTER_SIM_PUK2, dispatchStrings, responseInts}, {RIL_REQUEST_CHANGE_SIM_PIN, dispatchStrings, responseInts}, {RIL_REQUEST_CHANGE_SIM_PIN2, dispatchStrings, responseInts}, - {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, dispatchStrings, responseInts}, + {RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE, dispatchStrings, responseInts}, {RIL_REQUEST_GET_CURRENT_CALLS, dispatchVoid, responseCallList}, {RIL_REQUEST_DIAL, dispatchDial, responseVoid}, {RIL_REQUEST_GET_IMSI, dispatchStrings, responseString}, @@ -130,3 +132,6 @@ {RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, responseVoid}, {RIL_REQUEST_IMS_REGISTRATION_STATE, dispatchVoid, responseInts}, {RIL_REQUEST_IMS_SEND_SMS, dispatchImsSms, responseSMS}, + {RIL_REQUEST_GET_DATA_CALL_PROFILE, dispatchInts, responseGetDataCallProfile}, + {RIL_REQUEST_SET_UICC_SUBSCRIPTION, dispatchUiccSubscripton, responseVoid}, + {RIL_REQUEST_SET_DATA_SUBSCRIPTION, dispatchVoid, responseVoid}, diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h index ad6411e..99fa4f1 100644..100755 --- a/libril/ril_unsol_commands.h +++ b/libril/ril_unsol_commands.h @@ -1,5 +1,7 @@ /* //device/libs/telephony/ril_unsol_commands.h ** +** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +** Not a Contribution ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,3 +56,6 @@ {RIL_UNSOL_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL}, #endif {RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, responseVoid, WAKE_PARTIAL}, + {RIL_UNSOL_ON_SS, responseSSData, WAKE_PARTIAL}, + {RIL_UNSOL_STK_CC_ALPHA_NOTIFY, responseString, WAKE_PARTIAL}, + {RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, responseInts, WAKE_PARTIAL} diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index 097ca92..0a013e5 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -1,6 +1,8 @@ /* //device/system/reference-ril/reference-ril.c ** -** Copyright 2006, The Android Open Source Project +** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +** Not a Contribution +** Copyright 2006 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -199,6 +201,7 @@ static pthread_cond_t s_state_cond = PTHREAD_COND_INITIALIZER; static int s_port = -1; static const char * s_device_path = NULL; static int s_device_socket = 0; +const char * ril_inst_id = NULL; /* trigger change to this with s_state_cond */ static int s_closed = 0; @@ -763,6 +766,36 @@ error: at_response_free(p_response); } +static void setUiccSubscription(int request, void *data, size_t datalen, RIL_Token t) +{ + RIL_SelectUiccSub *uiccSubscrInfo; + uiccSubscrInfo = (RIL_SelectUiccSub *)data; + int response = 0; + + RLOGD("setUiccSubscription() RILD=%s instance.", ril_inst_id); + // TODO: DSDS: Need to implement this. + // workaround: send success for now. + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + + if (uiccSubscrInfo->act_status == RIL_UICC_SUBSCRIPTION_ACTIVATE) { + RLOGD("setUiccSubscription() : Activate Request: sending SUBSCRIPTION_STATUS_CHANGED"); + response = 1; // ACTIVATED + RIL_onUnsolicitedResponse ( + RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, + &response, sizeof(response)); + } else { + RLOGD("setUiccSubscriptionSource() : Deactivate Request"); + } +} + +static void setDataSubscription(int request, void *data, size_t datalen, RIL_Token t) +{ + RLOGD("setDataSubscriptionSource()") ; + // TODO: DSDS: Need to implement this. + // workaround: send success for now. + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); +} + static void requestDial(void *data, size_t datalen, RIL_Token t) { RIL_Dial *p_dial; @@ -1739,6 +1772,48 @@ error: } +static void requestGetDataCallProfile(void *data, size_t datalen, RIL_Token t) +{ + //ATResponse *p_response = NULL; + char *response = NULL; + char *respPtr = NULL; + int responseLen = 0; + int numProfiles = 1; // hard coded to return only one profile + int i = 0; + + // TBD: AT command support + + int mallocSize = 0; + mallocSize += (sizeof(RIL_DataCallProfileInfo)); + + response = (char*)alloca(mallocSize + sizeof(int)); + respPtr = response; + memcpy(respPtr, (char*)&numProfiles, sizeof(numProfiles)); + respPtr += sizeof(numProfiles); + responseLen += sizeof(numProfiles); + + // Fill up 'numProfiles' dummy 'RIL_DataCallProfileInfo; + for (i = 0; i < numProfiles; i++) + { + RIL_DataCallProfileInfo dummyProfile; + + // Adding arbitrary values for the dummy response + dummyProfile.profileId = i+1; + dummyProfile.priority = i+10; + RLOGI("profileId %d priority %d", dummyProfile.profileId, dummyProfile.priority); + + responseLen += sizeof(RIL_DataCallProfileInfo); + memcpy(respPtr, (char*)&dummyProfile, sizeof(RIL_DataCallProfileInfo)); + respPtr += sizeof(RIL_DataCallProfileInfo); + } + + RLOGI("requestGetDataCallProfile():reponseLen:%d, %d profiles", responseLen, i); + RIL_onRequestComplete(t, RIL_E_SUCCESS, response, responseLen); + + // at_response_free(p_response); + return; +} + static void requestSMSAcknowledge(void *data, size_t datalen, RIL_Token t) { int ackSuccess; @@ -1966,7 +2041,7 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) * when RADIO_STATE_UNAVAILABLE. */ if (sState == RADIO_STATE_UNAVAILABLE - && request != RIL_REQUEST_GET_SIM_STATUS + && !(request == RIL_REQUEST_GET_SIM_STATUS || request == RIL_REQUEST_GET_DATA_CALL_PROFILE) ) { RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); return; @@ -1977,7 +2052,8 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) */ if (sState == RADIO_STATE_OFF && !(request == RIL_REQUEST_RADIO_POWER - || request == RIL_REQUEST_GET_SIM_STATUS) + || request == RIL_REQUEST_GET_SIM_STATUS + || request == RIL_REQUEST_GET_DATA_CALL_PROFILE) ) { RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); return; @@ -2115,6 +2191,7 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) break; } case RIL_REQUEST_SEND_SMS: + case RIL_REQUEST_SEND_SMS_EXPECT_MORE: requestSendSMS(data, datalen, t); break; case RIL_REQUEST_CDMA_SEND_SMS: @@ -2126,6 +2203,9 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) case RIL_REQUEST_SETUP_DATA_CALL: requestSetupDataCall(data, datalen, t); break; + case RIL_REQUEST_GET_DATA_CALL_PROFILE: + requestGetDataCallProfile(data, datalen, t); + break; case RIL_REQUEST_SMS_ACKNOWLEDGE: requestSMSAcknowledge(data, datalen, t); break; @@ -2286,6 +2366,14 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) requestSetCellInfoListRate(data, datalen, t); break; + case RIL_REQUEST_SET_UICC_SUBSCRIPTION: + setUiccSubscription(request, data, datalen, t); + break; + + case RIL_REQUEST_SET_DATA_SUBSCRIPTION: + setDataSubscription(request, data, datalen, t); + break; + /* CDMA Specific Requests */ case RIL_REQUEST_BASEBAND_VERSION: if (TECH_BIT(sMdmInfo) == MDM_CDMA) { @@ -2429,6 +2517,9 @@ setRadioState(RIL_RadioState newState) if (sState != oldState) { RIL_onUnsolicitedResponse (RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, NULL, 0); + // Sim state can change as result of radio state change + RIL_onUnsolicitedResponse (RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, + NULL, 0); /* FIXME onSimReady() and onRadioPowerOn() cannot be called * from the AT reader thread @@ -3244,7 +3335,13 @@ mainLoop(void *param) * now another "legacy" way of communicating with the * emulator), we will try to connecto to gsm service via * qemu pipe. */ - fd = qemu_pipe_open("qemud:gsm"); + char qemuPipe[MAX_QEMU_PIPE_NAME_LENGTH] = "qemud:gsm"; + if (strncmp(ril_inst_id, "0", MAX_CLIENT_ID_LENGTH)) { + strncat(qemuPipe, ril_inst_id ,MAX_QEMU_PIPE_NAME_LENGTH); + } + RLOGD("qemu pipe name : %s\n", qemuPipe); + fd = qemu_pipe_open(qemuPipe); + if (fd < 0) { /* Qemu-specific control socket */ fd = socket_local_client( "qemud", @@ -3317,7 +3414,7 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **a s_rilenv = env; - while ( -1 != (opt = getopt(argc, argv, "p:d:s:"))) { + while ( -1 != (opt = getopt(argc, argv, "p:d:s:c:"))) { switch (opt) { case 'p': s_port = atoi(optarg); @@ -3339,6 +3436,11 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **a RLOGI("Opening socket %s\n", s_device_path); break; + case 'c': + ril_inst_id = optarg; + RLOGI("ReferRil is using instance %s ", ril_inst_id); + break; + default: usage(argv[0]); return NULL; diff --git a/rild/rild.c b/rild/rild.c index 0ef5c87..a78481c 100644 --- a/rild/rild.c +++ b/rild/rild.c @@ -1,6 +1,8 @@ /* //device/system/rild/rild.c ** -** Copyright 2006, The Android Open Source Project +** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +** Not a Contribution +** Copyright 2006 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -45,6 +47,8 @@ static void usage(const char *argv0) exit(EXIT_FAILURE); } +extern char rild[MAX_SOCKET_NAME_LENGTH]; + extern void RIL_register (const RIL_RadioFunctions *callbacks); extern void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, @@ -119,6 +123,9 @@ int main(int argc, char **argv) unsigned char hasLibArgs = 0; int i; + const char *clientId = NULL; + RLOGD("**RIL Daemon Started**"); + RLOGD("**RILd param count=%d**", argc); umask(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH); for (i = 1; i < argc ;) { @@ -129,11 +136,24 @@ int main(int argc, char **argv) i++; hasLibArgs = 1; break; + } else if (0 == strcmp(argv[i], "-c") && (argc - i > 1)) { + clientId = argv[i+1]; + i += 2; } else { usage(argv[0]); } } + if (clientId == NULL) { + clientId = "0"; + } else if (atoi(clientId) >= MAX_RILDS) { + RLOGE("Max Number of rild's supported is: %d", MAX_RILDS); + exit(0); + } + if (strncmp(clientId, "0", MAX_CLIENT_ID_LENGTH)) { + RIL_setRilSocketName(strncat(rild, clientId, MAX_SOCKET_NAME_LENGTH)); + } + if (rilLibPath == NULL) { if ( 0 == property_get(LIB_PATH_PROPERTY, libPath, NULL)) { // No lib sepcified on the command line, and nothing set in props. @@ -147,14 +167,14 @@ int main(int argc, char **argv) /* special override when in the emulator */ #if 1 { - static char* arg_overrides[3]; + static char* arg_overrides[5]; static char arg_device[32]; int done = 0; #define REFERENCE_RIL_PATH "/system/lib/libreference-ril.so" /* first, read /proc/cmdline into memory */ - char buffer[1024], *p, *q; + char buffer[1024] = {'\0'}, *p, *q; int len; int fd = open("/proc/cmdline",O_RDONLY); @@ -280,6 +300,10 @@ OpenLib: argc = make_argv(args, rilArgv); } + rilArgv[argc++] = "-c"; + rilArgv[argc++] = clientId; + RLOGD("RIL_Init argc = %d clientId = %s", argc, rilArgv[argc-1]); + // Make sure there's a reasonable argv[0] rilArgv[0] = argv[0]; |