diff options
-rw-r--r-- | rild/rild.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/rild/rild.c b/rild/rild.c index a78481c..20fd3c7 100644 --- a/rild/rild.c +++ b/rild/rild.c @@ -47,8 +47,6 @@ 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, @@ -60,6 +58,7 @@ extern void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, extern void RIL_requestTimedCallback (RIL_TimedCallback callback, void *param, const struct timeval *relativeTime); +extern void RIL_setRilSocketName(char * s) __attribute__((weak)); static struct RIL_Env s_rilEnv = { RIL_onRequestComplete, @@ -144,6 +143,7 @@ int main(int argc, char **argv) } } +#ifdef QCOM_HARDWARE if (clientId == NULL) { clientId = "0"; } else if (atoi(clientId) >= MAX_RILDS) { @@ -151,8 +151,13 @@ int main(int argc, char **argv) exit(0); } if (strncmp(clientId, "0", MAX_CLIENT_ID_LENGTH)) { - RIL_setRilSocketName(strncat(rild, clientId, MAX_SOCKET_NAME_LENGTH)); + if (RIL_setRilSocketName) { + RIL_setRilSocketName(clientId); + } else { + RLOGE("Trying to instantiate multiple rild sockets without a compatible libril!"); + } } +#endif if (rilLibPath == NULL) { if ( 0 == property_get(LIB_PATH_PROPERTY, libPath, NULL)) { @@ -300,15 +305,30 @@ OpenLib: argc = make_argv(args, rilArgv); } +#ifdef QCOM_HARDWARE rilArgv[argc++] = "-c"; rilArgv[argc++] = clientId; RLOGD("RIL_Init argc = %d clientId = %s", argc, rilArgv[argc-1]); +#endif // Make sure there's a reasonable argv[0] rilArgv[0] = argv[0]; funcs = rilInit(&s_rilEnv, argc, rilArgv); +#ifdef QCOM_HARDWARE + if (funcs == NULL) { + /* Pre-multi-client qualcomm vendor libraries won't support "-c" either, so + * try again without it. This should only happen on ancient qcoms, so raise + * a big fat warning + */ + argc -= 2; + RLOGE("============= Retrying RIL_Init without a client id. This is only required for very old versions,"); + RLOGE("============= and you're likely to have more radio breakage elsewhere!"); + funcs = rilInit(&s_rilEnv, argc, rilArgv); + } +#endif + RIL_register(funcs); done: |