diff options
Diffstat (limited to 'init/ueventd.c')
-rw-r--r-- | init/ueventd.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/init/ueventd.c b/init/ueventd.c index 0e97be7..ecf3b9b 100644 --- a/init/ueventd.c +++ b/init/ueventd.c @@ -20,6 +20,8 @@ #include <stdlib.h> #include <stdio.h> #include <ctype.h> +#include <signal.h> + #include <private/android_filesystem_config.h> #include "ueventd.h" @@ -31,17 +33,43 @@ static char hardware[32]; static unsigned revision = 0; +static void import_kernel_nv(char *name, int in_qemu) +{ + if (*name != '\0') { + char *value = strchr(name, '='); + if (value != NULL) { + *value++ = 0; + if (!strcmp(name,"androidboot.hardware")) + { + strlcpy(hardware, value, sizeof(hardware)); + } + } + } +} + int ueventd_main(int argc, char **argv) { struct pollfd ufd; int nr; char tmp[32]; + /* Prevent fire-and-forget children from becoming zombies. + * If we should need to wait() for some children in the future + * (as opposed to none right now), double-forking here instead + * of ignoring SIGCHLD may be the better solution. + */ + signal(SIGCHLD, SIG_IGN); + open_devnull_stdio(); - log_init(); + klog_init(); INFO("starting ueventd\n"); + /* Respect hardware passed in through the kernel cmd line. Here we will look + * for androidboot.hardware param in kernel cmdline, and save its value in + * hardware[]. */ + import_kernel_cmdline(0, import_kernel_nv); + get_hardware_name(hardware, &revision); ueventd_parse_config_file("/ueventd.rc"); |