diff options
author | David 'Digit' Turner <digit@google.com> | 2016-06-22 12:10:01 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2016-06-22 12:11:26 +0200 |
commit | 834eca8da7a8fb8f0113367f0e239a2572e8b184 (patch) | |
tree | 4f2949644b6a750b4487c3790059b554fcd0682b /rild | |
parent | 47a81105daa5e406b5bad4a734a734ed37edb076 (diff) | |
download | android_hardware_ril-834eca8da7a8fb8f0113367f0e239a2572e8b184.tar.gz android_hardware_ril-834eca8da7a8fb8f0113367f0e239a2572e8b184.tar.bz2 android_hardware_ril-834eca8da7a8fb8f0113367f0e239a2572e8b184.zip |
Simplify emulator-specific logic.
Remove any qemu-specific code from rild.c, this now handled
by setting rild.libpath properly in the init.<board>.rc files
for emulator-specific build products.
Also, only the qemu pipe method is really supported since ICS
so remove obsolete schemes.
BUG=25875346
Change-Id: I82296c127b90c230ca1446ee2431f06e78def617
Diffstat (limited to 'rild')
-rw-r--r-- | rild/rild.c | 110 |
1 files changed, 1 insertions, 109 deletions
diff --git a/rild/rild.c b/rild/rild.c index 8d02715..3717deb 100644 --- a/rild/rild.c +++ b/rild/rild.c @@ -36,7 +36,6 @@ #include <libril/ril_ex.h> #include <private/android_filesystem_config.h> -#include <system/qemu_pipe.h> #define LIB_PATH_PROPERTY "rild.libpath" #define LIB_ARGS_PROPERTY "rild.libargs" @@ -142,7 +141,7 @@ int main(int argc, char **argv) { void *dlHandle; const RIL_RadioFunctions *(*rilInit)(const struct RIL_Env *, int, char **); const RIL_RadioFunctions *(*rilUimInit)(const struct RIL_Env *, int, char **); - char *err_str = NULL; + const char *err_str = NULL; const RIL_RadioFunctions *funcs; char libPath[PROPERTY_VALUE_MAX]; @@ -190,113 +189,6 @@ int main(int argc, char **argv) { } } - /* special override when in the emulator */ -#if 1 - { - static char* arg_overrides[5]; - static char arg_device[32]; - int done = 0; - -#define REFERENCE_RIL_PATH "libreference-ril.so" - - /* first, read /proc/cmdline into memory */ - char buffer[1024], *p, *q; - int len; - int fd = open("/proc/cmdline",O_RDONLY); - - if (fd < 0) { - RLOGD("could not open /proc/cmdline:%s", strerror(errno)); - goto OpenLib; - } - - do { - len = read(fd,buffer,sizeof(buffer)); } - while (len == -1 && errno == EINTR); - - if (len < 0) { - RLOGD("could not read /proc/cmdline:%s", strerror(errno)); - close(fd); - goto OpenLib; - } - close(fd); - - if (strstr(buffer, "android.qemud=") != NULL) - { - /* the qemud daemon is launched after rild, so - * give it some time to create its GSM socket - */ - int tries = 5; -#define QEMUD_SOCKET_NAME "qemud" - - while (1) { - int fd; - - sleep(1); - - fd = qemu_pipe_open("pipe:qemud:gsm"); - if (fd < 0) { - fd = socket_local_client( - QEMUD_SOCKET_NAME, - ANDROID_SOCKET_NAMESPACE_RESERVED, - SOCK_STREAM ); - } - if (fd >= 0) { - close(fd); - snprintf( arg_device, sizeof(arg_device), "%s/%s", - ANDROID_SOCKET_DIR, QEMUD_SOCKET_NAME ); - - arg_overrides[1] = "-s"; - arg_overrides[2] = arg_device; - done = 1; - break; - } - RLOGD("could not connect to %s socket: %s", - QEMUD_SOCKET_NAME, strerror(errno)); - if (--tries == 0) - break; - } - if (!done) { - RLOGE("could not connect to %s socket (giving up): %s", - QEMUD_SOCKET_NAME, strerror(errno)); - while(1) - sleep(0x00ffffff); - } - } - - /* otherwise, try to see if we passed a device name from the kernel */ - if (!done) do { -#define KERNEL_OPTION "android.ril=" -#define DEV_PREFIX "/dev/" - - p = strstr( buffer, KERNEL_OPTION ); - if (p == NULL) - break; - - p += sizeof(KERNEL_OPTION)-1; - q = strpbrk( p, " \t\n\r" ); - if (q != NULL) - *q = 0; - - snprintf( arg_device, sizeof(arg_device), DEV_PREFIX "%s", p ); - arg_device[sizeof(arg_device)-1] = 0; - arg_overrides[1] = "-d"; - arg_overrides[2] = arg_device; - done = 1; - - } while (0); - - if (done) { - argv = arg_overrides; - argc = 3; - i = 1; - hasLibArgs = 1; - rilLibPath = REFERENCE_RIL_PATH; - - RLOGD("overriding with %s %s", arg_overrides[1], arg_overrides[2]); - } - } -OpenLib: -#endif switchUser(); dlHandle = dlopen(rilLibPath, RTLD_NOW); |