Commit d365219a authored by Etan Cohen's avatar Etan Cohen
Browse files

Merge kwd to master

Change-Id: Id33008507cbafc88288b6483c7691d6db34cc5c3
parent 18fc0f46
......@@ -21,6 +21,7 @@
#include <stdint.h>
#include <telephony/ril_cdma_sms.h>
#include <telephony/ril_nv_items.h>
#include <telephony/ril_msim.h>
#ifndef FEATURE_UNIT_TEST
#include <sys/time.h>
......@@ -30,14 +31,50 @@
extern "C" {
#endif
#if defined(ANDROID_SIM_COUNT_2)
#define SIM_COUNT 2
#elif defined(ANDROID_SIM_COUNT_3)
#define SIM_COUNT 3
#elif defined(ANDROID_SIM_COUNT_4)
#define SIM_COUNT 4
#else
#define SIM_COUNT 1
#endif
#ifndef ANDROID_MULTI_SIM
#define SIM_COUNT 1
#endif
#define RIL_VERSION 10 /* Current version */
#define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */
#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 {
RIL_SOCKET_1,
#if (SIM_COUNT >= 2)
RIL_SOCKET_2,
#if (SIM_COUNT >= 3)
RIL_SOCKET_3,
#endif
#if (SIM_COUNT >= 4)
RIL_SOCKET_4,
#endif
#endif
RIL_SOCKET_NUM
} RIL_SOCKET_ID;
typedef enum {
RIL_E_SUCCESS = 0,
RIL_E_RADIO_NOT_AVAILABLE = 1, /* If radio did not start or is resetting */
......@@ -108,7 +145,8 @@ typedef enum {
RADIO_TECH_EHRPD = 13,
RADIO_TECH_LTE = 14,
RADIO_TECH_HSPAP = 15, // HSPA+
RADIO_TECH_GSM = 16 // Only supports voice
RADIO_TECH_GSM = 16, // Only supports voice
RADIO_TECH_TD_SCDMA = 17
} RIL_RadioTechnology;
// Do we want to split Data from Voice and the use
......@@ -238,6 +276,39 @@ typedef struct {
to point connections. */
} RIL_Data_Call_Response_v6;
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. */
} RIL_Data_Call_Response_v9; // FIXME: Change to v10
typedef enum {
RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
......@@ -757,6 +828,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;
/* Deprecated, use RIL_SignalStrength_v6 */
typedef struct {
RIL_GW_SignalStrength GW_SignalStrength;
......@@ -778,6 +856,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 TD_SCDMA_SignalStrength;
} RIL_SignalStrength_v10;
/** RIL_CellIdentityGsm */
typedef struct {
int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
......@@ -820,6 +906,15 @@ typedef struct {
int tac; /* 16-bit tracking area code, INT_MAX if unknown */
} RIL_CellIdentityLte;
/** RIL_CellIdentityTdscdma */
typedef struct {
int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */
int cid; /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */
int cpid; /* 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown */
} RIL_CellIdentityTdscdma;
/** RIL_CellInfoGsm */
typedef struct {
RIL_CellIdentityGsm cellIdentityGsm;
......@@ -845,12 +940,19 @@ typedef struct {
RIL_LTE_SignalStrength_v8 signalStrengthLte;
} RIL_CellInfoLte;
/** RIL_CellInfoTdscdma */
typedef struct {
RIL_CellIdentityTdscdma cellIdentityTdscdma;
RIL_TD_SCDMA_SignalStrength signalStrengthTdscdma;
} RIL_CellInfoTdscdma;
// Must be the same as CellInfo.TYPE_XXX
typedef enum {
RIL_CELL_INFO_TYPE_GSM = 1,
RIL_CELL_INFO_TYPE_CDMA = 2,
RIL_CELL_INFO_TYPE_LTE = 3,
RIL_CELL_INFO_TYPE_WCDMA = 4,
RIL_CELL_INFO_TYPE_TD_SCDMA = 5
} RIL_CellInfoType;
// Must be the same as CellInfo.TIMESTAMP_TYPE_XXX
......@@ -872,6 +974,7 @@ typedef struct {
RIL_CellInfoCdma cdma;
RIL_CellInfoLte lte;
RIL_CellInfoWcdma wcdma;
RIL_CellInfoTdscdma tdscdma;
} CellInfo;
} RIL_CellInfo;
......@@ -984,6 +1087,8 @@ 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];
......@@ -1000,6 +1105,47 @@ typedef struct {
char * value;
} RIL_NV_WriteItem;
typedef enum {
HANDOVER_STARTED = 0,
HANDOVER_COMPLETED = 1,
HANDOVER_FAILED = 2,
HANDOVER_CANCELED = 3
} RIL_SrvccState;
/* hardware configuration reported to RILJ. */
typedef enum {
RIL_HARDWARE_CONFIG_MODEM = 0,
RIL_HARDWARE_CONFIG_SIM = 1,
} RIL_HardwareConfig_Type;
typedef enum {
RIL_HARDWARE_CONFIG_STATE_ENABLED = 0,
RIL_HARDWARE_CONFIG_STATE_STANDBY = 1,
RIL_HARDWARE_CONFIG_STATE_DISABLED = 2,
} RIL_HardwareConfig_State;
typedef struct {
int rilModel;
uint32_t rat; /* bitset - ref. RIL_RadioTechnology. */
int maxVoice;
int maxData;
int maxStandby;
} RIL_HardwareConfig_Modem;
typedef struct {
char modemUuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
} RIL_HardwareConfig_Sim;
typedef struct {
RIL_HardwareConfig_Type type;
char uuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
RIL_HardwareConfig_State state;
union {
RIL_HardwareConfig_Modem modem;
RIL_HardwareConfig_Sim sim;
} cfg;
} RIL_HardwareConfig;
/**
* RIL_REQUEST_GET_SIM_STATUS
*
......@@ -3747,6 +3893,77 @@ typedef struct {
*/
#define RIL_REQUEST_NV_RESET_CONFIG 121
/** RIL_REQUEST_SET_UICC_SUBSCRIPTION
* FIXME This API needs to have more documentation.
*
* 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 122
/**
* RIL_REQUEST_ALLOW_DATA
*
* Tells the modem whether data calls are allowed or not
*
* "data" is int *
* FIXME slotId and aid will be added.
* ((int *)data)[0] is == 0 to allow data calls
* ((int *)data)[0] is == 1 to disallow data calls
*
* "response" is NULL
*
* Valid errors:
*
* SUCCESS
* RADIO_NOT_AVAILABLE (radio resetting)
* GENERIC_FAILURE
*
*/
#define RIL_REQUEST_ALLOW_DATA 123
/**
* RIL_REQUEST_GET_HARDWARE_CONFIG
*
* Request all of the current hardware (modem and sim) associated
* with the RIL.
*
* "data" is NULL
*
* "response" is an array of RIL_HardwareConfig.
*/
#define RIL_REQUEST_GET_HARDWARE_CONFIG 124
/**
* RIL_REQUEST_ICC_SIM_AUTHENTICATION
*
* Returns the response of SIM Authentication through RIL to a
* challenge request.
*
* "data" Base64 encoded string containing challenge:
* int authContext; P2 value of authentication command, see P2 parameter in
* 3GPP TS 31.102 7.1.2
* char *authData; the challenge string in Base64 format, see 3GPP
* TS 31.102 7.1.2
* char *aid; AID value, See ETSI 102.221 8.1 and 101.220 4,
* NULL if no value
*
* "response" Base64 encoded strings containing response:
* int sw1; Status bytes per 3GPP TS 31.102 section 7.3
* int sw2;
* char *simResponse; Response in Base64 format, see 3GPP TS 31.102 7.1.2
*/
#define RIL_REQUEST_ICC_SIM_AUTHENTICATION 125
/***********************************************************************/
......@@ -4253,8 +4470,68 @@ typedef struct {
*/
#define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037
/**
* 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 1038
/**
* RIL_UNSOL_SRVCC_STATE_NOTIFY
*
* Called when Single Radio Voice Call Continuity(SRVCC)
* progress state has changed
*
* "data" is int *
* ((int *)data)[0] is of type const RIL_SrvccState
*
*/
#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039
/**
* RIL_UNSOL_HARDWARE_CONFIG_CHANGED
*
* Called when the hardware configuration associated with the RILd changes
*
* "data" is an array of RIL_HardwareConfig
*
*/
#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040
/***********************************************************************/
#if defined(ANDROID_MULTI_SIM)
/**
* RIL_Request Function pointer
*
* @param request is one of RIL_REQUEST_*
* @param data is pointer to data defined for that RIL_REQUEST_*
* data is owned by caller, and should not be modified or freed by callee
* @param t should be used in subsequent call to RIL_onResponse
* @param datalen the length of data
*
*/
typedef void (*RIL_RequestFunc) (int request, void *data,
size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id);
/**
* This function should return the current radio state synchronously
*/
typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id);
#else
/* Backward compatible */
/**
* RIL_Request Function pointer
......@@ -4274,6 +4551,9 @@ typedef void (*RIL_RequestFunc) (int request, void *data,
*/
typedef RIL_RadioState (*RIL_RadioStateRequest)();
#endif
/**
* This function returns "1" if the specified RIL_REQUEST code is
* supported and 0 if it is not
......@@ -4345,16 +4625,23 @@ struct RIL_Env {
void (*OnRequestComplete)(RIL_Token t, RIL_Errno e,
void *response, size_t responselen);
#if defined(ANDROID_MULTI_SIM)
/**
* "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
* "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
*
* "data" is owned by caller, and should not be modified or freed by callee
*/
void (*OnUnsolicitedResponse)(int unsolResponse, const void *data,
size_t datalen);
void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id);
#else
/**
* "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
* "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
*
* "data" is owned by caller, and should not be modified or freed by callee
*/
void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen);
#endif
/**
* Call user-specifed "callback" function on on the same thread that
* RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
......@@ -4405,6 +4692,7 @@ void RIL_register (const RIL_RadioFunctions *callbacks);
void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
void *response, size_t responselen);
#if defined(ANDROID_MULTI_SIM)
/**
* @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
* @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
......@@ -4413,8 +4701,18 @@ void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
*/
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen);
size_t datalen, RIL_SOCKET_ID socket_id);
#else
/**
* @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
* @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
* "data" is owned by caller, and should not be modified or freed by callee
* @param datalen the length of data in byte
*/
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen);
#endif
/**
* Call user-specifed "callback" function on on the same thread that
......
/*
* Copyright (C) 2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#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*/
......@@ -15,7 +15,11 @@ LOCAL_SHARED_LIBRARIES := \
libhardware_legacy \
librilutils
LOCAL_CFLAGS :=
#LOCAL_CFLAGS := -DANDROID_MULTI_SIM -DDSDA_RILD1
ifeq ($(SIM_COUNT), 2)
LOCAL_CFLAGS += -DANDROID_SIM_COUNT_2
endif
LOCAL_MODULE:= libril
......
This diff is collapsed.
......@@ -136,3 +136,6 @@
{RIL_REQUEST_NV_WRITE_ITEM, dispatchNVWriteItem, responseVoid},
{RIL_REQUEST_NV_WRITE_CDMA_PRL, dispatchRaw, responseVoid},
{RIL_REQUEST_NV_RESET_CONFIG, dispatchInts, responseVoid},
{RIL_REQUEST_SET_UICC_SUBSCRIPTION, dispatchUiccSubscripton, responseVoid},
{RIL_REQUEST_ALLOW_DATA, dispatchInts, responseVoid},
{RIL_REQUEST_GET_HARDWARE_CONFIG, dispatchVoid, responseHardwareConfig},
......@@ -52,3 +52,6 @@
{RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL},
{RIL_UNSOL_CELL_INFO_LIST, responseCellInfoList, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, responseVoid, WAKE_PARTIAL},
{RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, responseInts, WAKE_PARTIAL},
{RIL_UNSOL_SRVCC_STATE_NOTIFY, responseInts, WAKE_PARTIAL},
{RIL_UNSOL_HARDWARE_CONFIG_CHANGED, responseHardwareConfig, WAKE_PARTIAL},
......@@ -43,6 +43,9 @@
#define LOG_TAG "RIL"
#include <utils/Log.h>
static void *noopRemoveWarning( void *a ) { return a; }
#define RIL_UNUSED_PARM(a) noopRemoveWarning((void *)&(a));
#define MAX_AT_RESPONSE 0x1000
/* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */
......@@ -429,8 +432,8 @@ static void requestOrSendDataCallList(RIL_Token *t)
p_cur = p_cur->p_next)
n++;
RIL_Data_Call_Response_v6 *responses =
alloca(n * sizeof(RIL_Data_Call_Response_v6));
RIL_Data_Call_Response_v9 *responses =
alloca(n * sizeof(RIL_Data_Call_Response_v9));
int i;
for (i = 0; i < n; i++) {
......@@ -443,9 +446,10 @@ static void requestOrSendDataCallList(RIL_Token *t)
responses[i].addresses = "";
responses[i].dnses = "";
responses[i].gateways = "";
responses[i].pcscf = "";
}
RIL_Data_Call_Response_v6 *response = responses;
RIL_Data_Call_Response_v9 *response = responses;
for (p_cur = p_response->p_intermediates; p_cur != NULL;
p_cur = p_cur->p_next) {
char *line = p_cur->line;
......@@ -577,11 +581,11 @@ static void requestOrSendDataCallList(RIL_Token *t)
if (t != NULL)
RIL_onRequestComplete(*t, RIL_E_SUCCESS, responses,
n * sizeof(RIL_Data_Call_Response_v6));
n * sizeof(RIL_Data_Call_Response_v9));
else
RIL_onUnsolicitedResponse(RIL_UNSOL_DATA_CALL_LIST_CHANGED,
responses,
n * sizeof(RIL_Data_Call_Response_v6));
n * sizeof(RIL_Data_Call_Response_v9));
return;
......@@ -1939,6 +1943,21 @@ static void requestSetCellInfoListRate(void *data, size_t datalen, RIL_Token t)
RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
}
static void requestGetHardwareConfig(void *data, size_t datalen, RIL_Token t)
{
// TODO - hook this up with real query/info from radio.
RIL_HardwareConfig hwCfg;
RIL_UNUSED_PARM(data);
RIL_UNUSED_PARM(datalen);
hwCfg.type = -1;
RIL_onRequestComplete(t, RIL_E_SUCCESS, &hwCfg, sizeof(hwCfg));
}
/*** Callback methods from the RIL library to us ***/
/**
......@@ -2285,6 +2304,10 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t)
requestSetCellInfoListRate(data, datalen, t);
break;
case RIL_REQUEST_GET_HARDWARE_CONFIG:
requestGetHardwareConfig(data, datalen, t);
break;
/* CDMA Specific Requests */
case RIL_REQUEST_BASEBAND_VERSION:
if (TECH_BIT(sMdmInfo) == MDM_CDMA) {
......@@ -3215,6 +3238,14 @@ static void onATTimeout()
setRadioState (RADIO_STATE_UNAVAILABLE);
}
/* Called to pass hardware configuration information to telephony
* framework.
*/
static void setHardwareConfiguration(int num, RIL_HardwareConfig *cfg)
{
RIL_onUnsolicitedResponse(RIL_UNSOL_HARDWARE_CONFIG_CHANGED, cfg, num*sizeof(*cfg));
}
static void usage(char *s)
{
#ifdef RIL_SHLIB
......
......@@ -18,6 +18,11 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
librilutils_static
LOCAL_CFLAGS := -DRIL_SHLIB
#LOCAL_CFLAGS += -DANDROID_MULTI_SIM
ifeq ($(SIM_COUNT), 2)
LOCAL_CFLAGS += -DANDROID_SIM_COUNT_2
endif
LOCAL_MODULE:= rild
LOCAL_MODULE_TAGS := optional
......
......@@ -21,6 +21,7 @@
#include <cutils/sockets.h>
#define SOCKET_NAME_RIL_DEBUG "rild-debug" /* from ril.cpp */
#define SOCKET_NAME_RIL2_DEBUG "rild2-debug"
enum options {
RADIO_RESET,
......@@ -49,7 +50,15 @@ static void print_usage() {
7 - DEACTIVE_PDP, \n\
8 number - DIAL_CALL number, \n\
9 - ANSWER_CALL, \n\
10 - END_CALL \n");
10 - END_CALL \n\
The argument before the last one must be SIM slot \n\
0 - SIM1, \n\
1 - SIM2, \n\
2 - SIM3, \n\
3 - SIM4, \n\
The last argument must be modem-socket style \n\
0 - one modem for one debug-socket, \n\
1 - one modem for multiple debug socket \n");
}
static int error_check(int argc, char * argv[]) {
......@@ -59,9 +68,9 @@ static int error_check(int argc, char * argv[]) {
const int option = atoi(argv[1]);
if (option < 0 || option > 10) {
return 0;
} else if ((option == DIAL_CALL || option == SETUP_PDP) && argc == 3) {
} else if ((option == DIAL_CALL || option == SETUP_PDP) && argc == 5) {
return 0;
} else if ((option != DIAL_CALL && option != SETUP_PDP) && argc == 2) {
} else if ((option != DIAL_CALL && option != SETUP_PDP) && argc == 4) {
return 0;
}
return -1;
......@@ -70,9 +79,9 @@ static int error_check(int argc, char * argv[]) {
static int get_number_args(char *argv[]) {
const int option = atoi(argv[1]);
if (option != DIAL_CALL && option != SETUP_PDP) {
return 1;
return 3;
} else {
return 2;
return 4;
}
}
......@@ -81,20 +90,36 @@ int main(int argc, char *argv[])
int fd;
int num_socket_args = 0;
int i = 0;
int modem_socket_type = 0;
int sim_id = 0;
char socket_name[20];
if(error_check(argc, argv)) {
print_usage();
exit(-1);
}
fd = socket_local_client(SOCKET_NAME_RIL_DEBUG,
ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM);
num_socket_args = get_number_args(argv);
modem_socket_type = atoi(argv[(num_socket_args-1)]);
sim_id = atoi(argv[(num_socket_args-2)]);
memset(socket_name, 0, sizeof(char)*20);
if (sim_id == 0 || modem_socket_type == 1) {
strncpy(socket_name, SOCKET_NAME_RIL_DEBUG, 19);
} else if (sim_id == 1) {
strncpy(socket_name, SOCKET_NAME_RIL2_DEBUG, 19);
}
fd = socket_local_client(socket_name,
ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM);
if (fd < 0) {
perror ("opening radio debug socket");
exit(-1);
}
num_socket_args = get_number_args(argv);
/* It is not necessacry to pass the argument "modem-socket style" to rild */
num_socket_args--;
int ret = send(fd, (const void *)&num_socket_args, sizeof(int), 0);
if(ret != sizeof(int)) {
perror ("Socket write error when sending num args");
......
/* //device/system/rild/rild.c
**
** Copyright 2006, The Android Open Source Project
** 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,13 +45,21 @@ 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,
void *response, size_t responselen);
#if defined(ANDROID_MULTI_SIM)
extern void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen, RIL_SOCKET_ID socket_id);
#else
extern void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen);
#endif
extern void RIL_requestTimedCallback (RIL_TimedCallback callback,
void *param, const struct timeval *relativeTime);
......@@ -119,6 +127,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 +140,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,7 +171,7 @@ 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;
......@@ -280,15 +304,23 @@ 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];
funcs = rilInit(&s_rilEnv, argc, rilArgv);
RLOGD("RIL_Init rilInit completed");
RIL_register(funcs);
RLOGD("RIL_Init RIL_register completed");
done:
RLOGD("RIL_Init starting sleep loop");
while (true) {
sleep(UINT32_MAX);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment