diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-18 16:26:06 +0100 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-02-25 12:48:12 +0100 |
commit | c035b46b589c3388874ff94c35f2e57130b5f0ef (patch) | |
tree | b27e616753ce4e53ea81277d040bb2b3acc8c894 | |
parent | e27954b610b4b708fc490f1752d379f017b8a1c8 (diff) | |
download | android_hardware_ril-c035b46b589c3388874ff94c35f2e57130b5f0ef.tar.gz android_hardware_ril-c035b46b589c3388874ff94c35f2e57130b5f0ef.tar.bz2 android_hardware_ril-c035b46b589c3388874ff94c35f2e57130b5f0ef.zip |
rild: Don't use the clientId argument with non-qcom hardwareqcril
Other modems' implementations won't know how to deal with it, and
some are confirmed to simply reject the RIL_Init call.
If the hardware isn't qualcomm, just skip the whole multi-ril stuff
entirely
Change-Id: I132a4d7fc3d4532b2015f7e95863fac78889f833
rild: Weaken the RIL_setRilSocketName symbol
custom libril implementations won't have it, but its lack isn't
fatal outside of multi-SIM
Change-Id: If8312078921bb4ed756dcd86e17e85847638c155
-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: |