diff options
Diffstat (limited to 'rild')
-rw-r--r-- | rild/rild.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/rild/rild.c b/rild/rild.c index bf9c421..4643aae 100644 --- a/rild/rild.c +++ b/rild/rild.c @@ -48,7 +48,9 @@ static void usage(const char *argv0) { exit(EXIT_FAILURE); } -extern char rild[MAX_SOCKET_NAME_LENGTH]; +#ifdef QCOM_HARDWARE +extern char rild[MAX_SOCKET_NAME_LENGTH] __attribute__((weak)); +#endif extern void RIL_register (const RIL_RadioFunctions *callbacks); @@ -71,6 +73,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, @@ -170,6 +173,7 @@ int main(int argc, char **argv) { } } +#ifdef QCOM_HARDWARE if (clientId == NULL) { clientId = "0"; } else if (atoi(clientId) >= MAX_RILDS) { @@ -177,8 +181,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(strncat(rild, clientId, MAX_SOCKET_NAME_LENGTH)); + } 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)) { @@ -339,9 +348,11 @@ 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]; @@ -349,6 +360,19 @@ OpenLib: funcs = rilInit(&s_rilEnv, argc, rilArgv); RLOGD("RIL_Init rilInit completed"); +#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); RLOGD("RIL_Init RIL_register completed"); |