diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-18 16:26:06 +0100 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2014-11-27 01:45:40 +0200 |
commit | a55174e830914aa6009e80e80e69a1a8005e0a5b (patch) | |
tree | d0727fc514adc7cc491ccd1d0922de57fe4c1639 | |
parent | e6ad316646e237e80a78cb8f3d5fa1130fb64847 (diff) | |
download | android_hardware_ril-a55174e830914aa6009e80e80e69a1a8005e0a5b.tar.gz android_hardware_ril-a55174e830914aa6009e80e80e69a1a8005e0a5b.tar.bz2 android_hardware_ril-a55174e830914aa6009e80e80e69a1a8005e0a5b.zip |
rild: Don't use the clientId argument with non-qcom hardware
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
rild: Unbreak multi-SIM socket name
Change-Id: Icae742c42c45726105d1a9e07a26bc4d10cc82bf
Weaken external rild symbol.
Not all libril will have this
Change-Id: I3da165f5cf779a02c7eb168d6e3c9b398d284835
Change-Id: If8312078921bb4ed756dcd86e17e85847638c155
-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 8e479dc..88469b3 100644 --- a/rild/rild.c +++ b/rild/rild.c @@ -45,7 +45,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); @@ -64,6 +66,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, @@ -148,6 +151,7 @@ int main(int argc, char **argv) } } +#ifdef QCOM_HARDWARE if (clientId == NULL) { clientId = "0"; } else if (atoi(clientId) >= MAX_RILDS) { @@ -155,8 +159,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)) { @@ -304,9 +313,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]; @@ -314,6 +325,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"); |