Merge kwd to master
Change-Id: Id33008507cbafc88288b6483c7691d6db34cc5c3
diff --git a/rild/rild.c b/rild/rild.c
index 0ef5c87..64508f4 100644
--- a/rild/rild.c
+++ b/rild/rild.c
@@ -1,6 +1,6 @@
/* //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 @@
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 @@
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 @@
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 @@
/* 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 @@
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);
}