diff options
68 files changed, 878 insertions, 625 deletions
diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c index d213dd919..5d8a831c4 100644 --- a/adb/usb_vendors.c +++ b/adb/usb_vendors.c @@ -37,6 +37,8 @@ // Google's USB Vendor ID #define VENDOR_ID_GOOGLE 0x18d1 +// Intel's USB Vendor ID +#define VENDOR_ID_INTEL 0x8087 // HTC's USB Vendor ID #define VENDOR_ID_HTC 0x0bb4 // Samsung's USB Vendor ID @@ -127,6 +129,7 @@ /** built-in vendor list */ int builtInVendorIds[] = { VENDOR_ID_GOOGLE, + VENDOR_ID_INTEL, VENDOR_ID_HTC, VENDOR_ID_SAMSUNG, VENDOR_ID_MOTOROLA, diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c index a069d339d..fb7ac4d9b 100644 --- a/fastboot/fastboot.c +++ b/fastboot/fastboot.c @@ -150,6 +150,7 @@ int match_fastboot(usb_ifc_info *info) { if(!(vendor_id && (info->dev_vendor == vendor_id)) && (info->dev_vendor != 0x18d1) && // Google + (info->dev_vendor != 0x8087) && // Intel (info->dev_vendor != 0x0451) && (info->dev_vendor != 0x0502) && (info->dev_vendor != 0x0fce) && // Sony Ericsson diff --git a/fastboot/usb_linux.c b/fastboot/usb_linux.c index 1ba87e62a..cbc64e4e4 100644 --- a/fastboot/usb_linux.c +++ b/fastboot/usb_linux.c @@ -139,10 +139,11 @@ static int filter_usb_device(int fd, char *ptr, int len, int writable, ctrl.bRequestType = USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE; ctrl.bRequest = USB_REQ_GET_DESCRIPTOR; ctrl.wValue = (USB_DT_STRING << 8) | dev->iSerialNumber; - ctrl.wIndex = 0; + //language ID (en-us) for serial number string + ctrl.wIndex = 0x0409; ctrl.wLength = sizeof(buffer); ctrl.data = buffer; - ctrl.timeout = 50; + ctrl.timeout = 50; result = ioctl(fd, USBDEVFS_CONTROL, &ctrl); if (result > 0) { diff --git a/fastboot/usb_osx.c b/fastboot/usb_osx.c index 570a456ac..6df5d2c97 100644 --- a/fastboot/usb_osx.c +++ b/fastboot/usb_osx.c @@ -331,7 +331,8 @@ static int try_device(io_service_t device, usb_handle *handle) { req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice); req.bRequest = kUSBRqGetDescriptor; req.wValue = (kUSBStringDesc << 8) | serialIndex; - req.wIndex = 0; + //language ID (en-us) for serial number string + req.wIndex = 0x0409; req.pData = buffer; req.wLength = sizeof(buffer); kr = (*dev)->DeviceRequest(dev, &req); diff --git a/include/cutils/log.h b/include/cutils/log.h index 42d738296..2997a0cee 100644 --- a/include/cutils/log.h +++ b/include/cutils/log.h @@ -47,7 +47,7 @@ extern "C" { // --------------------------------------------------------------------- /* - * Normally we strip LOGV (VERBOSE messages) from release builds. + * Normally we strip ALOGV (VERBOSE messages) from release builds. * You can modify this (for example with "#define LOG_NDEBUG 0" * at the top of your source file) to change that behavior. */ @@ -73,81 +73,121 @@ extern "C" { /* * Simplified macro to send a verbose log message using the current LOG_TAG. */ -#ifndef LOGV +#ifndef ALOGV #if LOG_NDEBUG -#define LOGV(...) ((void)0) +#define ALOGV(...) ((void)0) #else -#define LOGV(...) ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) +#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) +#endif +// Temporary measure for code still using old LOG macros. +#ifndef LOGV +#define LOGV ALOGV #endif #endif #define CONDITION(cond) (__builtin_expect((cond)!=0, 0)) -#ifndef LOGV_IF +#ifndef ALOGV_IF #if LOG_NDEBUG -#define LOGV_IF(cond, ...) ((void)0) +#define ALOGV_IF(cond, ...) ((void)0) #else -#define LOGV_IF(cond, ...) \ +#define ALOGV_IF(cond, ...) \ ( (CONDITION(cond)) \ - ? ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \ + ? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif +// Temporary measure for code still using old LOG macros. +#ifndef LOGV_IF +#define LOGV_IF ALOGV_IF +#endif #endif /* * Simplified macro to send a debug log message using the current LOG_TAG. */ +#ifndef ALOGD +#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) +// Temporary measure for code still using old LOG macros. #ifndef LOGD -#define LOGD(...) ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) +#define LOGD ALOGD +#endif #endif -#ifndef LOGD_IF -#define LOGD_IF(cond, ...) \ +#ifndef ALOGD_IF +#define ALOGD_IF(cond, ...) \ ( (CONDITION(cond)) \ - ? ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \ + ? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) +// Temporary measure for code still using old LOG macros. +#ifndef LOGD_IF +#define LOGD_IF ALOGD_IF +#endif #endif /* * Simplified macro to send an info log message using the current LOG_TAG. */ +#ifndef ALOGI +#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) +// Temporary measure for code still using old LOG macros. #ifndef LOGI -#define LOGI(...) ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) +#define LOGI ALOGI +#endif #endif -#ifndef LOGI_IF -#define LOGI_IF(cond, ...) \ +#ifndef ALOGI_IF +#define ALOGI_IF(cond, ...) \ ( (CONDITION(cond)) \ - ? ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \ + ? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) +// Temporary measure for code still using old LOG macros. +#ifndef LOGI_IF +#define LOGI_IF ALOGI_IF +#endif #endif /* * Simplified macro to send a warning log message using the current LOG_TAG. */ +#ifndef ALOGW +#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) +// Temporary measure for code still using old LOG macros. #ifndef LOGW -#define LOGW(...) ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) +#define LOGW ALOGW +#endif #endif -#ifndef LOGW_IF -#define LOGW_IF(cond, ...) \ +#ifndef ALOGW_IF +#define ALOGW_IF(cond, ...) \ ( (CONDITION(cond)) \ - ? ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \ + ? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) +// Temporary measure for code still using old LOG macros. +#ifndef LOGW_IF +#define LOGW_IF ALOGW_IF +#endif #endif /* * Simplified macro to send an error log message using the current LOG_TAG. */ +#ifndef ALOGE +#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) +// Temporary measure for code still using old LOG macros. #ifndef LOGE -#define LOGE(...) ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) +#define LOGE ALOGE +#endif #endif -#ifndef LOGE_IF -#define LOGE_IF(cond, ...) \ +#ifndef ALOGE_IF +#define ALOGE_IF(cond, ...) \ ( (CONDITION(cond)) \ - ? ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \ + ? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) +// Temporary measure for code still using old LOG macros. +#ifndef LOGE_IF +#define LOGE_IF ALOGE_IF +#endif #endif // --------------------------------------------------------------------- @@ -156,11 +196,15 @@ extern "C" { * Conditional based on whether the current LOG_TAG is enabled at * verbose priority. */ -#ifndef IF_LOGV +#ifndef IF_ALOGV #if LOG_NDEBUG -#define IF_LOGV() if (false) +#define IF_ALOGV() if (false) #else -#define IF_LOGV() IF_LOG(LOG_VERBOSE, LOG_TAG) +#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG) +#endif +// Temporary measure for code still using old LOG macros. +#ifndef IF_LOGV +#define IF_LOGV IF_ALOGV #endif #endif @@ -168,32 +212,48 @@ extern "C" { * Conditional based on whether the current LOG_TAG is enabled at * debug priority. */ +#ifndef IF_ALOGD +#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG) +// Temporary measure for code still using old LOG macros. #ifndef IF_LOGD -#define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG) +#define IF_LOGD IF_ALOGD +#endif #endif /* * Conditional based on whether the current LOG_TAG is enabled at * info priority. */ +#ifndef IF_ALOGI +#define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG) +// Temporary measure for code still using old LOG macros. #ifndef IF_LOGI -#define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG) +#define IF_LOGI IF_ALOGI +#endif #endif /* * Conditional based on whether the current LOG_TAG is enabled at * warn priority. */ +#ifndef IF_ALOGW +#define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG) +// Temporary measure for code still using old LOG macros. #ifndef IF_LOGW -#define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG) +#define IF_LOGW IF_ALOGW +#endif #endif /* * Conditional based on whether the current LOG_TAG is enabled at * error priority. */ +#ifndef IF_ALOGE +#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG) +// Temporary measure for code still using old LOG macros. #ifndef IF_LOGE -#define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG) +#define IF_LOGE IF_ALOGE +#endif #endif @@ -329,9 +389,13 @@ extern "C" { * Assertion that generates a log message when the assertion fails. * Stripped out of release builds. Uses the current LOG_TAG. */ +#ifndef ALOG_ASSERT +#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__) +//#define ALOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond) +// Temporary measure for code still using old LOG macros. #ifndef LOG_ASSERT -#define LOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__) -//#define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond) +#define LOG_ASSERT ALOG_ASSERT +#endif #endif // --------------------------------------------------------------------- @@ -340,13 +404,17 @@ extern "C" { * Basic log message macro. * * Example: - * LOG(LOG_WARN, NULL, "Failed with error %d", errno); + * ALOG(LOG_WARN, NULL, "Failed with error %d", errno); * * The second argument may be NULL or "" to indicate the "global" tag. */ -#ifndef LOG -#define LOG(priority, tag, ...) \ +#ifndef ALOG +#define ALOG(priority, tag, ...) \ LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__) +// Temporary measure for code still using old LOG macros. +#ifndef LOG +#define LOG ALOG +#endif #endif /* @@ -368,9 +436,13 @@ extern "C" { /* * Conditional given a desired logging priority and tag. */ -#ifndef IF_LOG -#define IF_LOG(priority, tag) \ +#ifndef IF_ALOG +#define IF_ALOG(priority, tag) \ if (android_testLog(ANDROID_##priority, tag)) +// Temporary measure for code still using old LOG macros. +#ifndef IF_LOG +#define IF_LOG IF_ALOG +#endif #endif // --------------------------------------------------------------------- @@ -424,7 +496,7 @@ typedef enum { __android_log_vprint(prio, tag, fmt) /* XXX Macros to work around syntax errors in places where format string - * arg is not passed to LOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF + * arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF * (happens only in debug builds). */ diff --git a/init/builtins.c b/init/builtins.c index eccda3f8d..3781dcdc8 100644 --- a/init/builtins.c +++ b/init/builtins.c @@ -31,6 +31,7 @@ #include <sys/resource.h> #include <linux/loop.h> #include <cutils/partition_utils.h> +#include <sys/system_properties.h> #include "init.h" #include "keywords.h" @@ -448,22 +449,15 @@ int do_setprop(int nargs, char **args) { const char *name = args[1]; const char *value = args[2]; + char prop_val[PROP_VALUE_MAX]; + int ret; - if (value[0] == '$') { - /* Use the value of a system property if value starts with '$' */ - value++; - if (value[0] != '$') { - value = property_get(value); - if (!value) { - ERROR("property %s has no value for assigning to %s\n", value, name); - return -EINVAL; - } - } /* else fall through to support double '$' prefix for setting properties - * to string literals that start with '$' - */ + ret = expand_props(prop_val, value, sizeof(prop_val)); + if (ret) { + ERROR("cannot expand '%s' while assigning to '%s'\n", value, name); + return -EINVAL; } - - property_set(name, value); + property_set(name, prop_val); return 0; } @@ -547,21 +541,15 @@ int do_write(int nargs, char **args) { const char *path = args[1]; const char *value = args[2]; - if (value[0] == '$') { - /* Write the value of a system property if value starts with '$' */ - value++; - if (value[0] != '$') { - value = property_get(value); - if (!value) { - ERROR("property %s has no value for writing to %s\n", value, path); - return -EINVAL; - } - } /* else fall through to support double '$' prefix for writing - * string literals that start with '$' - */ - } + char prop_val[PROP_VALUE_MAX]; + int ret; - return write_file(path, value); + ret = expand_props(prop_val, value, sizeof(prop_val)); + if (ret) { + ERROR("cannot expand '%s' while writing to '%s'\n", value, path); + return -EINVAL; + } + return write_file(path, prop_val); } int do_copy(int nargs, char **args) diff --git a/init/init.c b/init/init.c index 165fea0d2..c3be93d03 100755 --- a/init/init.c +++ b/init/init.c @@ -59,13 +59,8 @@ static int bootchart_count; #endif static char console[32]; -static char serialno[32]; static char bootmode[32]; -static char baseband[32]; -static char carrier[32]; -static char bootloader[32]; static char hardware[32]; -static char modelno[32]; static unsigned revision = 0; static char qemu[32]; @@ -421,47 +416,6 @@ void handle_control_message(const char *msg, const char *arg) } } -static void import_kernel_nv(char *name, int in_qemu) -{ - char *value = strchr(name, '='); - - if (value == 0) return; - *value++ = 0; - if (*name == 0) return; - - if (!in_qemu) - { - /* on a real device, white-list the kernel options */ - if (!strcmp(name,"qemu")) { - strlcpy(qemu, value, sizeof(qemu)); - } else if (!strcmp(name,"androidboot.console")) { - strlcpy(console, value, sizeof(console)); - } else if (!strcmp(name,"androidboot.mode")) { - strlcpy(bootmode, value, sizeof(bootmode)); - } else if (!strcmp(name,"androidboot.serialno")) { - strlcpy(serialno, value, sizeof(serialno)); - } else if (!strcmp(name,"androidboot.baseband")) { - strlcpy(baseband, value, sizeof(baseband)); - } else if (!strcmp(name,"androidboot.carrier")) { - strlcpy(carrier, value, sizeof(carrier)); - } else if (!strcmp(name,"androidboot.bootloader")) { - strlcpy(bootloader, value, sizeof(bootloader)); - } else if (!strcmp(name,"androidboot.hardware")) { - strlcpy(hardware, value, sizeof(hardware)); - } else if (!strcmp(name,"androidboot.modelno")) { - strlcpy(modelno, value, sizeof(modelno)); - } - } else { - /* in the emulator, export any kernel option with the - * ro.kernel. prefix */ - char buff[32]; - int len = snprintf( buff, sizeof(buff), "ro.kernel.%s", name ); - if (len < (int)sizeof(buff)) { - property_set( buff, value ); - } - } -} - static struct command *get_first_command(struct action *act) { struct listnode *node; @@ -521,17 +475,6 @@ static int wait_for_coldboot_done_action(int nargs, char **args) return ret; } -static int property_init_action(int nargs, char **args) -{ - bool load_defaults = true; - - INFO("property init\n"); - if (!strcmp(bootmode, "charger")) - load_defaults = false; - property_init(load_defaults); - return 0; -} - static int keychord_init_action(int nargs, char **args) { keychord_init(); @@ -579,33 +522,104 @@ static int console_init_action(int nargs, char **args) return 0; } -static int set_init_properties_action(int nargs, char **args) +static void import_kernel_nv(char *name, int for_emulator) +{ + char *value = strchr(name, '='); + int name_len = strlen(name); + + if (value == 0) return; + *value++ = 0; + if (name_len == 0) return; + + if (for_emulator) { + /* in the emulator, export any kernel option with the + * ro.kernel. prefix */ + char buff[PROP_NAME_MAX]; + int len = snprintf( buff, sizeof(buff), "ro.kernel.%s", name ); + + if (len < (int)sizeof(buff)) + property_set( buff, value ); + return; + } + + if (!strcmp(name,"qemu")) { + strlcpy(qemu, value, sizeof(qemu)); + } else if (!strncmp(name, "androidboot.", 12) && name_len > 12) { + const char *boot_prop_name = name + 12; + char prop[PROP_NAME_MAX]; + int cnt; + + cnt = snprintf(prop, sizeof(prop), "ro.boot.%s", boot_prop_name); + if (cnt < PROP_NAME_MAX) + property_set(prop, value); + } +} + +static void export_kernel_boot_props(void) { char tmp[PROP_VALUE_MAX]; + const char *pval; + unsigned i; + struct { + const char *src_prop; + const char *dest_prop; + const char *def_val; + } prop_map[] = { + { "ro.boot.serialno", "ro.serialno", "", }, + { "ro.boot.mode", "ro.bootmode", "unknown", }, + { "ro.boot.baseband", "ro.baseband", "unknown", }, + { "ro.boot.carrier", "ro.carrier", "unknown", }, + { "ro.boot.bootloader", "ro.bootloader", "unknown", }, + }; + + for (i = 0; i < ARRAY_SIZE(prop_map); i++) { + pval = property_get(prop_map[i].src_prop); + property_set(prop_map[i].dest_prop, pval ?: prop_map[i].def_val); + } - if (qemu[0]) - import_kernel_cmdline(1, import_kernel_nv); + pval = property_get("ro.boot.console"); + if (pval) + strlcpy(console, pval, sizeof(console)); + + /* save a copy for init's usage during boot */ + strlcpy(bootmode, property_get("ro.bootmode"), sizeof(bootmode)); + + /* if this was given on kernel command line, override what we read + * before (e.g. from /proc/cpuinfo), if anything */ + pval = property_get("ro.boot.hardware"); + if (pval) + strlcpy(hardware, pval, sizeof(hardware)); + property_set("ro.hardware", hardware); + + snprintf(tmp, PROP_VALUE_MAX, "%d", revision); + property_set("ro.revision", tmp); + /* TODO: these are obsolete. We should delete them */ if (!strcmp(bootmode,"factory")) property_set("ro.factorytest", "1"); else if (!strcmp(bootmode,"factory2")) property_set("ro.factorytest", "2"); else property_set("ro.factorytest", "0"); +} - property_set("ro.serialno", serialno[0] ? serialno : ""); - property_set("ro.bootmode", bootmode[0] ? bootmode : "unknown"); - property_set("ro.baseband", baseband[0] ? baseband : "unknown"); - property_set("ro.carrier", carrier[0] ? carrier : "unknown"); - property_set("ro.bootloader", bootloader[0] ? bootloader : "unknown"); +static void process_kernel_cmdline(void) +{ + /* don't expose the raw commandline to nonpriv processes */ + chmod("/proc/cmdline", 0440); - if (modelno[0]) - property_set("ro.boot.modelno", modelno); + /* first pass does the common stuff, and finds if we are in qemu. + * second pass is only necessary for qemu to export all kernel params + * as props. + */ + import_kernel_cmdline(0, import_kernel_nv); + if (qemu[0]) + import_kernel_cmdline(1, import_kernel_nv); - property_set("ro.hardware", hardware); - snprintf(tmp, PROP_VALUE_MAX, "%d", revision); - property_set("ro.revision", tmp); - return 0; + /* now propogate the info given on command line to internal variables + * used by init as well as the current required properties + */ + export_kernel_boot_props(); } static int property_service_init_action(int nargs, char **args) @@ -674,6 +688,7 @@ int main(int argc, char **argv) int property_set_fd_init = 0; int signal_fd_init = 0; int keychord_fd_init = 0; + bool is_charger = false; if (!strcmp(basename(argv[0]), "ueventd")) return ueventd_main(argc, argv); @@ -707,31 +722,32 @@ int main(int argc, char **argv) */ open_devnull_stdio(); klog_init(); + property_init(); + + get_hardware_name(hardware, &revision); + + process_kernel_cmdline(); + + is_charger = !strcmp(bootmode, "charger"); + + INFO("property init\n"); + if (!is_charger) + property_load_boot_defaults(); INFO("reading config file\n"); init_parse_config_file("/init.rc"); - /* pull the kernel commandline and ramdisk properties file in */ - import_kernel_cmdline(0, import_kernel_nv); - /* don't expose the raw commandline to nonpriv processes */ - chmod("/proc/cmdline", 0440); - get_hardware_name(hardware, &revision); - snprintf(tmp, sizeof(tmp), "/init.%s.rc", hardware); - init_parse_config_file(tmp); - action_for_each_trigger("early-init", action_add_queue_tail); queue_builtin_action(wait_for_coldboot_done_action, "wait_for_coldboot_done"); - queue_builtin_action(property_init_action, "property_init"); queue_builtin_action(keychord_init_action, "keychord_init"); queue_builtin_action(console_init_action, "console_init"); - queue_builtin_action(set_init_properties_action, "set_init_properties"); /* execute all the boot actions to get us started */ action_for_each_trigger("init", action_add_queue_tail); /* skip mounting filesystems in charger mode */ - if (strcmp(bootmode, "charger") != 0) { + if (!is_charger) { action_for_each_trigger("early-fs", action_add_queue_tail); action_for_each_trigger("fs", action_add_queue_tail); action_for_each_trigger("post-fs", action_add_queue_tail); @@ -742,7 +758,7 @@ int main(int argc, char **argv) queue_builtin_action(signal_init_action, "signal_init"); queue_builtin_action(check_startup_action, "check_startup"); - if (!strcmp(bootmode, "charger")) { + if (is_charger) { action_for_each_trigger("charger", action_add_queue_tail); } else { action_for_each_trigger("early-boot", action_add_queue_tail); diff --git a/init/init_parser.c b/init/init_parser.c index 13c94eb97..d255db969 100644 --- a/init/init_parser.c +++ b/init/init_parser.c @@ -40,6 +40,11 @@ static list_declare(service_list); static list_declare(action_list); static list_declare(action_queue); +struct import { + struct listnode list; + const char *filename; +}; + static void *parse_service(struct parse_state *state, int nargs, char **args); static void parse_line_service(struct parse_state *state, int nargs, char **args); @@ -159,6 +164,149 @@ void parse_line_no_op(struct parse_state *state, int nargs, char **args) { } +static int push_chars(char **dst, int *len, const char *chars, int cnt) +{ + if (cnt > *len) + return -1; + + memcpy(*dst, chars, cnt); + *dst += cnt; + *len -= cnt; + + return 0; +} + +int expand_props(char *dst, const char *src, int dst_size) +{ + int cnt = 0; + char *dst_ptr = dst; + const char *src_ptr = src; + int src_len; + int idx = 0; + int ret = 0; + int left = dst_size - 1; + + if (!src || !dst || dst_size == 0) + return -1; + + src_len = strlen(src); + + /* - variables can either be $x.y or ${x.y}, in case they are only part + * of the string. + * - will accept $$ as a literal $. + * - no nested property expansion, i.e. ${foo.${bar}} is not supported, + * bad things will happen + */ + while (*src_ptr && left > 0) { + char *c; + char prop[PROP_NAME_MAX + 1]; + const char *prop_val; + int prop_len = 0; + + c = strchr(src_ptr, '$'); + if (!c) { + while (left-- > 0 && *src_ptr) + *(dst_ptr++) = *(src_ptr++); + break; + } + + memset(prop, 0, sizeof(prop)); + + ret = push_chars(&dst_ptr, &left, src_ptr, c - src_ptr); + if (ret < 0) + goto err_nospace; + c++; + + if (*c == '$') { + *(dst_ptr++) = *(c++); + src_ptr = c; + left--; + continue; + } else if (*c == '\0') { + break; + } + + if (*c == '{') { + c++; + while (*c && *c != '}' && prop_len < PROP_NAME_MAX) + prop[prop_len++] = *(c++); + if (*c != '}') { + /* failed to find closing brace, abort. */ + if (prop_len == PROP_NAME_MAX) + ERROR("prop name too long during expansion of '%s'\n", + src); + else if (*c == '\0') + ERROR("unexpected end of string in '%s', looking for }\n", + src); + goto err; + } + prop[prop_len] = '\0'; + c++; + } else if (*c) { + while (*c && prop_len < PROP_NAME_MAX) + prop[prop_len++] = *(c++); + if (prop_len == PROP_NAME_MAX && *c != '\0') { + ERROR("prop name too long in '%s'\n", src); + goto err; + } + prop[prop_len] = '\0'; + ERROR("using deprecated syntax for specifying property '%s', use ${name} instead\n", + prop); + } + + if (prop_len == 0) { + ERROR("invalid zero-length prop name in '%s'\n", src); + goto err; + } + + prop_val = property_get(prop); + if (!prop_val) { + ERROR("property '%s' doesn't exist while expanding '%s'\n", + prop, src); + goto err; + } + + ret = push_chars(&dst_ptr, &left, prop_val, strlen(prop_val)); + if (ret < 0) + goto err_nospace; + src_ptr = c; + continue; + } + + *dst_ptr = '\0'; + return 0; + +err_nospace: + ERROR("destination buffer overflow while expanding '%s'\n", src); +err: + return -1; +} + +void parse_import(struct parse_state *state, int nargs, char **args) +{ + struct listnode *import_list = state->priv; + struct import *import; + char conf_file[PATH_MAX]; + int ret; + + if (nargs != 2) { + ERROR("single argument needed for import\n"); + return; + } + + ret = expand_props(conf_file, args[1], sizeof(conf_file)); + if (ret) { + ERROR("error while handling import on line '%d' in '%s'\n", + state->line, state->filename); + return; + } + + import = calloc(1, sizeof(struct import)); + import->filename = strdup(conf_file); + list_add_tail(import_list, &import->list); + INFO("found import '%s', adding to import list", import->filename); +} + void parse_new_section(struct parse_state *state, int kw, int nargs, char **args) { @@ -180,13 +328,8 @@ void parse_new_section(struct parse_state *state, int kw, } break; case K_import: - if (nargs != 2) { - ERROR("single argument needed for import\n"); - } else { - int ret = init_parse_config_file(args[1]); - if (ret) - ERROR("could not import file %s\n", args[1]); - } + parse_import(state, nargs, args); + break; } state->parse_line = parse_line_no_op; } @@ -194,6 +337,8 @@ void parse_new_section(struct parse_state *state, int kw, static void parse_config(const char *fn, char *s) { struct parse_state state; + struct listnode import_list; + struct listnode *node; char *args[INIT_PARSER_MAXARGS]; int nargs; @@ -203,11 +348,15 @@ static void parse_config(const char *fn, char *s) state.ptr = s; state.nexttoken = 0; state.parse_line = parse_line_no_op; + + list_init(&import_list); + state.priv = &import_list; + for (;;) { switch (next_token(&state)) { case T_EOF: state.parse_line(&state, 0, 0); - return; + goto parser_done; case T_NEWLINE: state.line++; if (nargs) { @@ -228,6 +377,18 @@ static void parse_config(const char *fn, char *s) break; } } + +parser_done: + list_for_each(node, &import_list) { + struct import *import = node_to_item(node, struct import, list); + int ret; + + INFO("importing '%s'", import->filename); + ret = init_parse_config_file(import->filename); + if (ret) + ERROR("could not import file '%s' from '%s'\n", + import->filename, fn); + } } int init_parse_config_file(const char *fn) diff --git a/init/init_parser.h b/init/init_parser.h index ff13b04f2..b078cadbf 100644 --- a/init/init_parser.h +++ b/init/init_parser.h @@ -31,5 +31,6 @@ void queue_all_property_triggers(); void queue_builtin_action(int (*func)(int nargs, char **args), char *name); int init_parse_config_file(const char *fn); +int expand_props(char *dst, const char *src, int len); #endif diff --git a/init/parser.h b/init/parser.h index be9375805..0a5802a4a 100644 --- a/init/parser.h +++ b/init/parser.h @@ -30,6 +30,7 @@ struct parse_state void *context; void (*parse_line)(struct parse_state *state, int nargs, char **args); const char *filename; + void *priv; }; int lookup_keyword(const char *s); diff --git a/init/property_service.c b/init/property_service.c index 673343752..059db97e5 100644 --- a/init/property_service.c +++ b/init/property_service.c @@ -505,11 +505,14 @@ static void load_persistent_properties() persistent_properties_loaded = 1; } -void property_init(bool load_defaults) +void property_init(void) { init_property_area(); - if (load_defaults) - load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT); +} + +void property_load_boot_defaults(void) +{ + load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT); } int properties_inited(void) diff --git a/init/property_service.h b/init/property_service.h index 37c27882f..b9d1bf610 100644 --- a/init/property_service.h +++ b/init/property_service.h @@ -20,7 +20,8 @@ #include <stdbool.h> extern void handle_property_set_fd(void); -extern void property_init(bool load_defaults); +extern void property_init(void); +extern void property_load_boot_defaults(void); extern void load_persist_props(void); extern void start_property_service(void); void get_property_workspace(int *fd, int *sz); diff --git a/libcutils/buffer.c b/libcutils/buffer.c index f34b8f892..af99bd728 100644 --- a/libcutils/buffer.c +++ b/libcutils/buffer.c @@ -104,9 +104,9 @@ ssize_t bufferWrite(Buffer* buffer, int fd) { if (bytesWritten >= 0) { buffer->remaining -= bytesWritten; - LOGD("Buffer bytes written: %d", (int) bytesWritten); - LOGD("Buffer size: %d", (int) buffer->size); - LOGD("Buffer remaining: %d", (int) buffer->remaining); + ALOGD("Buffer bytes written: %d", (int) bytesWritten); + ALOGD("Buffer size: %d", (int) buffer->size); + ALOGD("Buffer remaining: %d", (int) buffer->remaining); return buffer->remaining; } diff --git a/libcutils/loghack.h b/libcutils/loghack.h index 2bfffe4ec..750cab097 100644 --- a/libcutils/loghack.h +++ b/libcutils/loghack.h @@ -25,14 +25,14 @@ #include <cutils/log.h> #else #include <stdio.h> -#define LOG(level, ...) \ +#define ALOG(level, ...) \ ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__)) -#define LOGV(...) LOG("V", __VA_ARGS__) -#define LOGD(...) LOG("D", __VA_ARGS__) -#define LOGI(...) LOG("I", __VA_ARGS__) -#define LOGW(...) LOG("W", __VA_ARGS__) -#define LOGE(...) LOG("E", __VA_ARGS__) -#define LOG_ALWAYS_FATAL(...) do { LOGE(__VA_ARGS__); exit(1); } while (0) +#define ALOGV(...) ALOG("V", __VA_ARGS__) +#define ALOGD(...) ALOG("D", __VA_ARGS__) +#define ALOGI(...) ALOG("I", __VA_ARGS__) +#define ALOGW(...) ALOG("W", __VA_ARGS__) +#define ALOGE(...) ALOG("E", __VA_ARGS__) +#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0) #endif #endif // _CUTILS_LOGHACK_H diff --git a/libcutils/mq.c b/libcutils/mq.c index 3b65f1f16..6f6740ebb 100644 --- a/libcutils/mq.c +++ b/libcutils/mq.c @@ -222,7 +222,7 @@ static void setNonBlocking(int fd) { static void closeWithWarning(int fd) { int result = close(fd); if (result == -1) { - LOGW("close() error: %s", strerror(errno)); + ALOGW("close() error: %s", strerror(errno)); } } @@ -263,7 +263,7 @@ static void peerUnlock(Peer* peer) { /** Frees a simple, i.e. header-only, outgoing packet. */ static void outgoingPacketFree(OutgoingPacket* packet) { - LOGD("Freeing outgoing packet."); + ALOGD("Freeing outgoing packet."); free(packet); } @@ -374,10 +374,10 @@ static bool peerProxyRemoveConnection(void* key, void* value, void* context) { */ static void peerProxyKill(PeerProxy* peerProxy, bool errnoIsSet) { if (errnoIsSet) { - LOGI("Peer %d died. errno: %s", peerProxy->credentials.pid, + ALOGI("Peer %d died. errno: %s", peerProxy->credentials.pid, strerror(errno)); } else { - LOGI("Peer %d died.", peerProxy->credentials.pid); + ALOGI("Peer %d died.", peerProxy->credentials.pid); } // If we lost the master, we're up a creek. We can't let this happen. @@ -433,12 +433,12 @@ static void peerProxyKill(PeerProxy* peerProxy, bool errnoIsSet) { static void peerProxyHandleError(PeerProxy* peerProxy, char* functionName) { if (errno == EINTR) { // Log interruptions but otherwise ignore them. - LOGW("%s() interrupted.", functionName); + ALOGW("%s() interrupted.", functionName); } else if (errno == EAGAIN) { - LOGD("EWOULDBLOCK"); + ALOGD("EWOULDBLOCK"); // Ignore. } else { - LOGW("Error returned by %s().", functionName); + ALOGW("Error returned by %s().", functionName); peerProxyKill(peerProxy, true); } } @@ -461,7 +461,7 @@ static bool peerProxyWriteFromBuffer(PeerProxy* peerProxy, Buffer* outgoing) { static void peerProxyWriteBytes(PeerProxy* peerProxy) { Buffer* buffer = peerProxy->currentPacket->bytes; if (peerProxyWriteFromBuffer(peerProxy, buffer)) { - LOGD("Bytes written."); + ALOGD("Bytes written."); peerProxyNextPacket(peerProxy); } } @@ -527,10 +527,10 @@ static void peerProxyWrite(SelectableFd* fd) { Buffer* outgoingHeader = &peerProxy->outgoingHeader; bool headerWritten = bufferWriteComplete(outgoingHeader); if (!headerWritten) { - LOGD("Writing header..."); + ALOGD("Writing header..."); headerWritten = peerProxyWriteFromBuffer(peerProxy, outgoingHeader); if (headerWritten) { - LOGD("Header written."); + ALOGD("Header written."); } } @@ -559,7 +559,7 @@ static void peerProxyWrite(SelectableFd* fd) { * Sets up a peer proxy's fd before we try to select() it. */ static void peerProxyBeforeSelect(SelectableFd* fd) { - LOGD("Before select..."); + ALOGD("Before select..."); PeerProxy* peerProxy = (PeerProxy*) fd->data; @@ -568,7 +568,7 @@ static void peerProxyBeforeSelect(SelectableFd* fd) { peerUnlock(peerProxy->peer); if (hasPackets) { - LOGD("Packets found. Setting onWritable()."); + ALOGD("Packets found. Setting onWritable()."); fd->onWritable = &peerProxyWrite; } else { @@ -579,11 +579,11 @@ static void peerProxyBeforeSelect(SelectableFd* fd) { /** Prepare to read bytes from the peer. */ static void peerProxyExpectBytes(PeerProxy* peerProxy, Header* header) { - LOGD("Expecting %d bytes.", header->size); - - peerProxy->inputState = READING_BYTES; + ALOGD("Expecting %d bytes.", header->size); + + peerProxy->inputState = READING_BYTES; if (bufferPrepareForRead(peerProxy->inputBuffer, header->size) == -1) { - LOGW("Couldn't allocate memory for incoming data. Size: %u", + ALOGW("Couldn't allocate memory for incoming data. Size: %u", (unsigned int) header->size); // TODO: Ignore the packet and log a warning? @@ -670,7 +670,7 @@ static void masterProxyExpectConnection(PeerProxy* masterProxy, // TODO: Restructure things so we don't need this check. // Verify that this really is the master. if (!masterProxy->master) { - LOGW("Non-master process %d tried to send us a connection.", + ALOGW("Non-master process %d tried to send us a connection.", masterProxy->credentials.pid); // Kill off the evil peer. peerProxyKill(masterProxy, false); @@ -686,7 +686,7 @@ static void masterProxyExpectConnection(PeerProxy* masterProxy, peerLock(localPeer); PeerProxy* peerProxy = peerProxyGetOrCreate(localPeer, pid, false); if (peerProxy == NULL) { - LOGW("Peer proxy creation failed: %s", strerror(errno)); + ALOGW("Peer proxy creation failed: %s", strerror(errno)); } else { // Fill in full credentials. peerProxy->credentials = header->credentials; @@ -746,7 +746,7 @@ static void masterProxyAcceptConnection(PeerProxy* masterProxy) { if (size < 0) { if (errno == EINTR) { // Log interruptions but otherwise ignore them. - LOGW("recvmsg() interrupted."); + ALOGW("recvmsg() interrupted."); return; } else if (errno == EAGAIN) { // Keep waiting for the connection. @@ -777,14 +777,14 @@ static void masterProxyAcceptConnection(PeerProxy* masterProxy) { // The peer proxy this connection is for. PeerProxy* peerProxy = masterProxy->connecting; if (peerProxy == NULL) { - LOGW("Received connection for unknown peer."); + ALOGW("Received connection for unknown peer."); closeWithWarning(incomingFd); } else { Peer* peer = masterProxy->peer; SelectableFd* selectableFd = selectorAdd(peer->selector, incomingFd); if (selectableFd == NULL) { - LOGW("Error adding fd to selector for %d.", + ALOGW("Error adding fd to selector for %d.", peerProxy->credentials.pid); closeWithWarning(incomingFd); peerProxyKill(peerProxy, false); @@ -811,7 +811,7 @@ static void masterConnectPeers(PeerProxy* peerA, PeerProxy* peerB) { int sockets[2]; int result = socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets); if (result == -1) { - LOGW("socketpair() error: %s", strerror(errno)); + ALOGW("socketpair() error: %s", strerror(errno)); // TODO: Send CONNECTION_FAILED packets to peers. return; } @@ -821,7 +821,7 @@ static void masterConnectPeers(PeerProxy* peerA, PeerProxy* peerB) { if (packetA == NULL || packetB == NULL) { free(packetA); free(packetB); - LOGW("malloc() error. Failed to tell process %d that process %d is" + ALOGW("malloc() error. Failed to tell process %d that process %d is" " dead.", peerA->credentials.pid, peerB->credentials.pid); return; } @@ -852,7 +852,7 @@ static void masterReportConnectionError(PeerProxy* peerProxy, Credentials credentials) { OutgoingPacket* packet = calloc(1, sizeof(OutgoingPacket)); if (packet == NULL) { - LOGW("malloc() error. Failed to tell process %d that process %d is" + ALOGW("malloc() error. Failed to tell process %d that process %d is" " dead.", peerProxy->credentials.pid, credentials.pid); return; } @@ -902,10 +902,10 @@ static void masterProxyHandleConnectionError(PeerProxy* masterProxy, peerUnlock(peer); if (peerProxy != NULL) { - LOGI("Couldn't connect to %d.", pid); + ALOGI("Couldn't connect to %d.", pid); peerProxyKill(peerProxy, false); } else { - LOGW("Peer proxy for %d not found. This shouldn't happen.", pid); + ALOGW("Peer proxy for %d not found. This shouldn't happen.", pid); } peerProxyExpectHeader(masterProxy); @@ -929,7 +929,7 @@ static void peerProxyHandleHeader(PeerProxy* peerProxy, Header* header) { peerProxyExpectBytes(peerProxy, header); break; default: - LOGW("Invalid packet type from %d: %d", peerProxy->credentials.pid, + ALOGW("Invalid packet type from %d: %d", peerProxy->credentials.pid, header->type); peerProxyKill(peerProxy, false); } @@ -947,7 +947,7 @@ static bool peerProxyBufferInput(PeerProxy* peerProxy) { return false; } else if (size == 0) { // EOF. - LOGI("EOF"); + ALOGI("EOF"); peerProxyKill(peerProxy, false); return false; } else if (bufferReadComplete(in)) { @@ -963,23 +963,23 @@ static bool peerProxyBufferInput(PeerProxy* peerProxy) { * Reads input from a peer process. */ static void peerProxyRead(SelectableFd* fd) { - LOGD("Reading..."); + ALOGD("Reading..."); PeerProxy* peerProxy = (PeerProxy*) fd->data; int state = peerProxy->inputState; Buffer* in = peerProxy->inputBuffer; switch (state) { case READING_HEADER: if (peerProxyBufferInput(peerProxy)) { - LOGD("Header read."); + ALOGD("Header read."); // We've read the complete header. Header* header = (Header*) in->data; peerProxyHandleHeader(peerProxy, header); } break; case READING_BYTES: - LOGD("Reading bytes..."); + ALOGD("Reading bytes..."); if (peerProxyBufferInput(peerProxy)) { - LOGD("Bytes read."); + ALOGD("Bytes read."); // We have the complete packet. Notify bytes listener. peerProxy->peer->onBytes(peerProxy->credentials, in->data, in->size); @@ -1026,11 +1026,11 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { // Accept connection. int socket = accept(listenerFd->fd, NULL, NULL); if (socket == -1) { - LOGW("accept() error: %s", strerror(errno)); + ALOGW("accept() error: %s", strerror(errno)); return; } - LOGD("Accepted connection as fd %d.", socket); + ALOGD("Accepted connection as fd %d.", socket); // Get credentials. Credentials credentials; @@ -1040,7 +1040,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { &ucredentials, &credentialsSize); // We might want to verify credentialsSize. if (result == -1) { - LOGW("getsockopt() error: %s", strerror(errno)); + ALOGW("getsockopt() error: %s", strerror(errno)); closeWithWarning(socket); return; } @@ -1050,7 +1050,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { credentials.uid = ucredentials.uid; credentials.gid = ucredentials.gid; - LOGI("Accepted connection from process %d.", credentials.pid); + ALOGI("Accepted connection from process %d.", credentials.pid); Peer* masterPeer = (Peer*) listenerFd->data; @@ -1061,7 +1061,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { = hashmapGet(masterPeer->peerProxies, &credentials.pid); if (peerProxy != NULL) { peerUnlock(masterPeer); - LOGW("Alread connected to process %d.", credentials.pid); + ALOGW("Alread connected to process %d.", credentials.pid); closeWithWarning(socket); return; } @@ -1070,7 +1070,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { SelectableFd* socketFd = selectorAdd(masterPeer->selector, socket); if (socketFd == NULL) { peerUnlock(masterPeer); - LOGW("malloc() failed."); + ALOGW("malloc() failed."); closeWithWarning(socket); return; } @@ -1079,7 +1079,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) { peerProxy = peerProxyCreate(masterPeer, credentials); peerUnlock(masterPeer); if (peerProxy == NULL) { - LOGW("malloc() failed."); + ALOGW("malloc() failed."); socketFd->remove = true; closeWithWarning(socket); } @@ -1118,7 +1118,7 @@ static Peer* localPeer; /** Frees a packet of bytes. */ static void outgoingPacketFreeBytes(OutgoingPacket* packet) { - LOGD("Freeing outgoing packet."); + ALOGD("Freeing outgoing packet."); bufferFree(packet->bytes); free(packet); } @@ -1270,7 +1270,7 @@ void masterPeerInitialize(BytesListener* bytesListener, LOG_ALWAYS_FATAL("bind() error: %s", strerror(errno)); } - LOGD("Listener socket: %d", listenerSocket); + ALOGD("Listener socket: %d", listenerSocket); // Queue up to 16 connections. result = listen(listenerSocket, 16); diff --git a/libcutils/properties.c b/libcutils/properties.c index 98f356b7e..f732ec067 100644 --- a/libcutils/properties.c +++ b/libcutils/properties.c @@ -99,7 +99,7 @@ static int connectToServer(const char* fileName) sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { - LOGW("UNIX domain socket create failed (errno=%d)\n", errno); + ALOGW("UNIX domain socket create failed (errno=%d)\n", errno); return -1; } @@ -110,7 +110,7 @@ static int connectToServer(const char* fileName) if (cc < 0) { // ENOENT means socket file doesn't exist // ECONNREFUSED means socket exists but nobody is listening - //LOGW("AF_UNIX connect failed for '%s': %s\n", + //ALOGW("AF_UNIX connect failed for '%s': %s\n", // fileName, strerror(errno)); close(sock); return -1; @@ -128,9 +128,9 @@ static void init(void) gPropFd = connectToServer(SYSTEM_PROPERTY_PIPE_NAME); if (gPropFd < 0) { - //LOGW("not connected to system property server\n"); + //ALOGW("not connected to system property server\n"); } else { - //LOGV("Connected to system property server\n"); + //ALOGV("Connected to system property server\n"); } } @@ -140,7 +140,7 @@ int property_get(const char *key, char *value, const char *default_value) char recvBuf[1+PROPERTY_VALUE_MAX]; int len = -1; - //LOGV("PROPERTY GET [%s]\n", key); + //ALOGV("PROPERTY GET [%s]\n", key); pthread_once(&gInitOnce, init); if (gPropFd < 0) { @@ -189,12 +189,12 @@ int property_get(const char *key, char *value, const char *default_value) strcpy(value, recvBuf+1); len = strlen(value); } else { - LOGE("Got strange response to property_get request (%d)\n", + ALOGE("Got strange response to property_get request (%d)\n", recvBuf[0]); assert(0); return -1; } - //LOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n", + //ALOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n", // recvBuf[0], default_value, len, key, value); return len; @@ -207,7 +207,7 @@ int property_set(const char *key, const char *value) char recvBuf[1]; int result = -1; - //LOGV("PROPERTY SET [%s]: [%s]\n", key, value); + //ALOGV("PROPERTY SET [%s]: [%s]\n", key, value); pthread_once(&gInitOnce, init); if (gPropFd < 0) @@ -241,7 +241,7 @@ int property_set(const char *key, const char *value) int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie) { - //LOGV("PROPERTY LIST\n"); + //ALOGV("PROPERTY LIST\n"); pthread_once(&gInitOnce, init); if (gPropFd < 0) return -1; diff --git a/libcutils/qtaguid.c b/libcutils/qtaguid.c index 994ad3283..1c57774c0 100644 --- a/libcutils/qtaguid.c +++ b/libcutils/qtaguid.c @@ -60,7 +60,7 @@ void qtaguid_resTrack(void) { static int write_ctrl(const char *cmd) { int fd, res, savedErrno; - LOGV("write_ctrl(%s)", cmd); + ALOGV("write_ctrl(%s)", cmd); fd = TEMP_FAILURE_RETRY(open(CTRL_PROCPATH, O_WRONLY)); if (fd < 0) { @@ -74,7 +74,7 @@ static int write_ctrl(const char *cmd) { savedErrno = 0; } if (res < 0) { - LOGI("Failed write_ctrl(%s) res=%d errno=%d", cmd, res, savedErrno); + ALOGI("Failed write_ctrl(%s) res=%d errno=%d", cmd, res, savedErrno); } close(fd); return -savedErrno; @@ -107,11 +107,11 @@ int qtaguid_tagSocket(int sockfd, int tag, uid_t uid) { snprintf(lineBuf, sizeof(lineBuf), "t %d %llu %d", sockfd, kTag, uid); - LOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid); + ALOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid); res = write_ctrl(lineBuf); if (res < 0) { - LOGI("Tagging socket %d with tag %llx(%d) for uid %d failed errno=%d", + ALOGI("Tagging socket %d with tag %llx(%d) for uid %d failed errno=%d", sockfd, kTag, tag, uid, res); } @@ -122,12 +122,12 @@ int qtaguid_untagSocket(int sockfd) { char lineBuf[CTRL_MAX_INPUT_LEN]; int res; - LOGV("Untagging socket %d", sockfd); + ALOGV("Untagging socket %d", sockfd); snprintf(lineBuf, sizeof(lineBuf), "u %d", sockfd); res = write_ctrl(lineBuf); if (res < 0) { - LOGI("Untagging socket %d failed errno=%d", sockfd, res); + ALOGI("Untagging socket %d failed errno=%d", sockfd, res); } return res; @@ -137,7 +137,7 @@ int qtaguid_setCounterSet(int counterSetNum, uid_t uid) { char lineBuf[CTRL_MAX_INPUT_LEN]; int res; - LOGV("Setting counters to set %d for uid %d", counterSetNum, uid); + ALOGV("Setting counters to set %d for uid %d", counterSetNum, uid); snprintf(lineBuf, sizeof(lineBuf), "s %d %d", counterSetNum, uid); res = write_ctrl(lineBuf); @@ -149,14 +149,14 @@ int qtaguid_deleteTagData(int tag, uid_t uid) { int fd, cnt = 0, res = 0; uint64_t kTag = (uint64_t)tag << 32; - LOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid); + ALOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid); pthread_once(&resTrackInitDone, qtaguid_resTrack); snprintf(lineBuf, sizeof(lineBuf), "d %llu %d", kTag, uid); res = write_ctrl(lineBuf); if (res < 0) { - LOGI("Deleteing tag data with tag %llx/%d for uid %d failed with cnt=%d errno=%d", + ALOGI("Deleteing tag data with tag %llx/%d for uid %d failed with cnt=%d errno=%d", kTag, tag, uid, cnt, errno); } diff --git a/libcutils/record_stream.c b/libcutils/record_stream.c index 274423b74..69949047c 100644 --- a/libcutils/record_stream.c +++ b/libcutils/record_stream.c @@ -144,7 +144,7 @@ int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord, && p_rs->read_end == p_rs->buffer_end ) { // this should never happen - //LOGE("max record length exceeded\n"); + //ALOGE("max record length exceeded\n"); assert (0); errno = EFBIG; return -1; diff --git a/libcutils/selector.c b/libcutils/selector.c index 943639370..3776bbbc5 100644 --- a/libcutils/selector.c +++ b/libcutils/selector.c @@ -48,7 +48,7 @@ static void eatWakeupData(SelectableFd* wakeupFd) { static char garbage[64]; if (read(wakeupFd->fd, garbage, sizeof(garbage)) < 0) { if (errno == EINTR) { - LOGI("read() interrupted."); + ALOGI("read() interrupted."); } else { LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno)); } @@ -77,7 +77,7 @@ void selectorWakeUp(Selector* selector) { static char garbage[1]; if (write(selector->wakeupPipe[1], garbage, sizeof(garbage)) < 0) { if (errno == EINTR) { - LOGI("read() interrupted."); + ALOGI("read() interrupted."); } else { LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno)); } @@ -96,7 +96,7 @@ Selector* selectorCreate(void) { LOG_ALWAYS_FATAL("pipe() error: %s", strerror(errno)); } - LOGD("Wakeup fd: %d", selector->wakeupPipe[0]); + ALOGD("Wakeup fd: %d", selector->wakeupPipe[0]); SelectableFd* wakeupFd = selectorAdd(selector, selector->wakeupPipe[0]); if (wakeupFd == NULL) { @@ -169,11 +169,11 @@ static void prepareForSelect(Selector* selector) { bool inSet = false; if (maybeAdd(selectableFd, selectableFd->onExcept, exceptFds)) { - LOGD("Selecting fd %d for writing...", selectableFd->fd); + ALOGD("Selecting fd %d for writing...", selectableFd->fd); inSet = true; } if (maybeAdd(selectableFd, selectableFd->onReadable, readFds)) { - LOGD("Selecting fd %d for reading...", selectableFd->fd); + ALOGD("Selecting fd %d for reading...", selectableFd->fd); inSet = true; } if (maybeAdd(selectableFd, selectableFd->onWritable, writeFds)) { @@ -200,9 +200,9 @@ static void prepareForSelect(Selector* selector) { */ static inline void maybeInvoke(SelectableFd* selectableFd, void (*callback)(SelectableFd*), fd_set* fdSet) { - if (callback != NULL && !selectableFd->remove && + if (callback != NULL && !selectableFd->remove && FD_ISSET(selectableFd->fd, fdSet)) { - LOGD("Selected fd %d.", selectableFd->fd); + ALOGD("Selected fd %d.", selectableFd->fd); callback(selectableFd); } } @@ -238,20 +238,20 @@ void selectorLoop(Selector* selector) { prepareForSelect(selector); - LOGD("Entering select()."); + ALOGD("Entering select()."); // Select file descriptors. int result = select(selector->maxFd + 1, &selector->readFds, &selector->writeFds, &selector->exceptFds, NULL); - LOGD("Exiting select()."); + ALOGD("Exiting select()."); setInSelect(selector, false); if (result == -1) { // Abort on everything except EINTR. if (errno == EINTR) { - LOGI("select() interrupted."); + ALOGI("select() interrupted."); } else { LOG_ALWAYS_FATAL("select() error: %s", strerror(errno)); diff --git a/libcutils/sockets.c b/libcutils/sockets.c index 101a382f2..b5a1b3d47 100644 --- a/libcutils/sockets.c +++ b/libcutils/sockets.c @@ -30,12 +30,12 @@ bool socket_peer_is_trusted(int fd) int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len); if (n != 0) { - LOGE("could not get socket credentials: %s\n", strerror(errno)); + ALOGE("could not get socket credentials: %s\n", strerror(errno)); return false; } if ((cr.uid != AID_ROOT) && (cr.uid != AID_SHELL)) { - LOGE("untrusted userid on other end of socket: userid %d\n", cr.uid); + ALOGE("untrusted userid on other end of socket: userid %d\n", cr.uid); return false; } #endif diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c index dfa1f737c..14fecec63 100644 --- a/libcutils/str_parms.c +++ b/libcutils/str_parms.c @@ -103,7 +103,7 @@ struct str_parms *str_parms_create_str(const char *_string) if (!str) goto err_strdup; - LOGV("%s: source string == '%s'\n", __func__, _string); + ALOGV("%s: source string == '%s'\n", __func__, _string); kvpair = strtok_r(str, ";", &tmpstr); while (kvpair && *kvpair) { @@ -137,7 +137,7 @@ next_pair: } if (!items) - LOGV("%s: no items found in string\n", __func__); + ALOGV("%s: no items found in string\n", __func__); free(str); @@ -281,7 +281,7 @@ char *str_parms_to_str(struct str_parms *str_parms) static bool dump_entry(void *key, void *value, void *context) { - LOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value); + ALOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value); return true; } @@ -301,7 +301,7 @@ static void test_str_parms_str(const char *str) str_parms_dump(str_parms); out_str = str_parms_to_str(str_parms); str_parms_destroy(str_parms); - LOGI("%s: '%s' stringified is '%s'", __func__, str, out_str); + ALOGI("%s: '%s' stringified is '%s'", __func__, str, out_str); free(out_str); } diff --git a/libcutils/zygote.c b/libcutils/zygote.c index aa060c05a..75ce3ba99 100644 --- a/libcutils/zygote.c +++ b/libcutils/zygote.c @@ -46,7 +46,7 @@ static int send_request(int fd, int sendStdio, int argc, const char **argv) { #ifndef HAVE_ANDROID_OS // not supported on simulator targets - //LOGE("zygote_* not supported on simulator targets"); + //ALOGE("zygote_* not supported on simulator targets"); return -1; #else /* HAVE_ANDROID_OS */ uint32_t pid; diff --git a/libdiskconfig/config_mbr.c b/libdiskconfig/config_mbr.c index 825ba6029..703484c21 100644 --- a/libdiskconfig/config_mbr.c +++ b/libdiskconfig/config_mbr.c @@ -47,7 +47,7 @@ cfg_pentry(struct pc_partition *pentry, uint8_t status, uint8_t type, pentry->start_lba = start; pentry->len_lba = len; - LOGI("Configuring pentry. status=0x%x type=0x%x start_lba=%u len_lba=%u", + ALOGI("Configuring pentry. status=0x%x type=0x%x start_lba=%u len_lba=%u", pentry->status, pentry->type, pentry->start_lba, pentry->len_lba); } @@ -62,7 +62,7 @@ kb_to_lba(uint32_t len_kb, uint32_t sect_size) lba = (lba + (uint64_t)sect_size - 1) & ~((uint64_t)sect_size - 1); lba /= (uint64_t)sect_size; if (lba >= 0xffffffffULL) - LOGE("Error converting kb -> lba. 32bit overflow, expect weirdness"); + ALOGE("Error converting kb -> lba. 32bit overflow, expect weirdness"); return (uint32_t)(lba & 0xffffffffULL); } @@ -75,12 +75,12 @@ mk_pri_pentry(struct disk_info *dinfo, struct part_info *pinfo, int pnum, struct pc_partition *pentry; if (pnum >= PC_NUM_BOOT_RECORD_PARTS) { - LOGE("Maximum number of primary partition exceeded."); + ALOGE("Maximum number of primary partition exceeded."); return NULL; } if (!(item = alloc_wl(sizeof(struct pc_partition)))) { - LOGE("Unable to allocate memory for partition entry."); + ALOGE("Unable to allocate memory for partition entry."); return NULL; } @@ -146,7 +146,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba, uint32_t len; /* in lba units */ if (!(item = alloc_wl(sizeof(struct pc_boot_record)))) { - LOGE("Unable to allocate memory for EBR."); + ALOGE("Unable to allocate memory for EBR."); return NULL; } @@ -163,7 +163,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba, len = kb_to_lba(pinfo->len_kb, dinfo->sect_size); else { if (pnext) { - LOGE("Only the last partition can be specified to fill the disk " + ALOGE("Only the last partition can be specified to fill the disk " "(name = '%s')", pinfo->name); goto fail; } @@ -233,7 +233,7 @@ config_mbr(struct disk_info *dinfo) if ((temp_wr = mk_pri_pentry(dinfo, NULL, cnt, &cur_lba))) wlist_add(&wr_list, temp_wr); else { - LOGE("Cannot create primary extended partition."); + ALOGE("Cannot create primary extended partition."); goto fail; } } @@ -259,7 +259,7 @@ config_mbr(struct disk_info *dinfo) if (temp_wr) wlist_add(&wr_list, temp_wr); else { - LOGE("Cannot create partition %d (%s).", cnt, pinfo->name); + ALOGE("Cannot create partition %d (%s).", cnt, pinfo->name); goto fail; } } @@ -270,7 +270,7 @@ config_mbr(struct disk_info *dinfo) cur_lba = 0; memset(&blank, 0, sizeof(struct part_info)); if (!(temp_wr = mk_pri_pentry(dinfo, &blank, cnt, &cur_lba))) { - LOGE("Cannot create blank partition %d.", cnt); + ALOGE("Cannot create blank partition %d.", cnt); goto fail; } wlist_add(&wr_list, temp_wr); @@ -279,7 +279,7 @@ config_mbr(struct disk_info *dinfo) return wr_list; nospace: - LOGE("Not enough space to add parttion '%s'.", pinfo->name); + ALOGE("Not enough space to add parttion '%s'.", pinfo->name); fail: wlist_free(wr_list); @@ -310,13 +310,13 @@ find_mbr_part(struct disk_info *dinfo, const char *name) num++; if (!(dev_name = malloc(MAX_NAME_LEN))) { - LOGE("Cannot allocate memory."); + ALOGE("Cannot allocate memory."); return NULL; } num = snprintf(dev_name, MAX_NAME_LEN, "%s%d", dinfo->device, num); if (num >= MAX_NAME_LEN) { - LOGE("Device name is too long?!"); + ALOGE("Device name is too long?!"); free(dev_name); return NULL; } diff --git a/libdiskconfig/diskconfig.c b/libdiskconfig/diskconfig.c index 4dd8c5265..d5425de03 100644 --- a/libdiskconfig/diskconfig.c +++ b/libdiskconfig/diskconfig.c @@ -45,7 +45,7 @@ parse_len(const char *str, uint64_t *plen) tmp[sizeof(tmp)-1] = '\0'; len_str = strlen(tmp); if (!len_str) { - LOGE("Invalid disk length specified."); + ALOGE("Invalid disk length specified."); return 1; } @@ -64,13 +64,13 @@ parse_len(const char *str, uint64_t *plen) *plen = strtoull(tmp, NULL, 0); if (!*plen) { - LOGE("Invalid length specified: %s", str); + ALOGE("Invalid length specified: %s", str); return 1; } if (*plen == (uint64_t)-1) { if (multiple > 1) { - LOGE("Size modifier illegal when len is -1"); + ALOGE("Size modifier illegal when len is -1"); return 1; } } else { @@ -80,7 +80,7 @@ parse_len(const char *str, uint64_t *plen) *plen *= multiple; if (*plen > 0xffffffffULL) { - LOGE("Length specified is too large!: %llu KB", *plen); + ALOGE("Length specified is too large!: %llu KB", *plen); return 1; } } @@ -108,7 +108,7 @@ load_partitions(cnode *root, struct disk_info *dinfo) pinfo->flags |= PART_ACTIVE_FLAG; if (!(tmp = config_str(partnode, "type", NULL))) { - LOGE("Partition type required: %s", pinfo->name); + ALOGE("Partition type required: %s", pinfo->name); return 1; } @@ -118,7 +118,7 @@ load_partitions(cnode *root, struct disk_info *dinfo) } else if (!strcmp(tmp, "fat32")) { pinfo->type = PC_PART_TYPE_FAT32; } else { - LOGE("Unsupported partition type found: %s", tmp); + ALOGE("Unsupported partition type found: %s", tmp); return 1; } @@ -146,13 +146,13 @@ load_diskconfig(const char *fn, char *path_override) const char *tmp; if (!(dinfo = malloc(sizeof(struct disk_info)))) { - LOGE("Could not malloc disk_info"); + ALOGE("Could not malloc disk_info"); return NULL; } memset(dinfo, 0, sizeof(struct disk_info)); if (!(dinfo->part_lst = malloc(MAX_NUM_PARTS * sizeof(struct part_info)))) { - LOGE("Could not malloc part_lst"); + ALOGE("Could not malloc part_lst"); goto fail; } memset(dinfo->part_lst, 0, @@ -160,33 +160,33 @@ load_diskconfig(const char *fn, char *path_override) config_load_file(root, fn); if (root->first_child == NULL) { - LOGE("Could not read config file %s", fn); + ALOGE("Could not read config file %s", fn); goto fail; } if (!(devroot = config_find(root, "device"))) { - LOGE("Could not find device section in config file '%s'", fn); + ALOGE("Could not find device section in config file '%s'", fn); goto fail; } if (!(tmp = config_str(devroot, "path", path_override))) { - LOGE("device path is requried"); + ALOGE("device path is requried"); goto fail; } dinfo->device = strdup(tmp); /* find the partition scheme */ if (!(tmp = config_str(devroot, "scheme", NULL))) { - LOGE("partition scheme is required"); + ALOGE("partition scheme is required"); goto fail; } else if (!strcmp(tmp, "mbr")) { dinfo->scheme = PART_SCHEME_MBR; } else if (!strcmp(tmp, "gpt")) { - LOGE("'gpt' partition scheme not supported yet."); + ALOGE("'gpt' partition scheme not supported yet."); goto fail; } else { - LOGE("Unknown partition scheme specified: %s", tmp); + ALOGE("Unknown partition scheme specified: %s", tmp); goto fail; } @@ -194,30 +194,30 @@ load_diskconfig(const char *fn, char *path_override) tmp = config_str(devroot, "sector_size", "512"); dinfo->sect_size = strtol(tmp, NULL, 0); if (!dinfo->sect_size) { - LOGE("Invalid sector size: %s", tmp); + ALOGE("Invalid sector size: %s", tmp); goto fail; } /* first lba where the partitions will start on disk */ if (!(tmp = config_str(devroot, "start_lba", NULL))) { - LOGE("start_lba must be provided"); + ALOGE("start_lba must be provided"); goto fail; } if (!(dinfo->skip_lba = strtol(tmp, NULL, 0))) { - LOGE("Invalid starting LBA (or zero): %s", tmp); + ALOGE("Invalid starting LBA (or zero): %s", tmp); goto fail; } /* Number of LBAs on disk */ if (!(tmp = config_str(devroot, "num_lba", NULL))) { - LOGE("num_lba is required"); + ALOGE("num_lba is required"); goto fail; } dinfo->num_lba = strtoul(tmp, NULL, 0); if (!(partnode = config_find(devroot, "partitions"))) { - LOGE("Device must specify partition list"); + ALOGE("Device must specify partition list"); goto fail; } @@ -244,12 +244,12 @@ sync_ptable(int fd) sync(); if (fstat(fd, &stat)) { - LOGE("Cannot stat, errno=%d.", errno); + ALOGE("Cannot stat, errno=%d.", errno); return -1; } if (S_ISBLK(stat.st_mode) && ((rv = ioctl(fd, BLKRRPART, NULL)) < 0)) { - LOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno); + ALOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno); return -1; } @@ -281,12 +281,12 @@ validate(struct disk_info *dinfo) return -1; if ((fd = open(dinfo->device, O_RDWR)) < 0) { - LOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno); + ALOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno); return -1; } if (fstat(fd, &stat)) { - LOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno); + ALOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno); goto fail; } @@ -299,19 +299,19 @@ validate(struct disk_info *dinfo) if (S_ISBLK(stat.st_mode)) { /* get the sector size and make sure we agree */ if (ioctl(fd, BLKSSZGET, §_sz) < 0) { - LOGE("Cannot get sector size (errno=%d)", errno); + ALOGE("Cannot get sector size (errno=%d)", errno); goto fail; } if (!sect_sz || sect_sz != dinfo->sect_size) { - LOGE("Device sector size is zero or sector sizes do not match!"); + ALOGE("Device sector size is zero or sector sizes do not match!"); goto fail; } /* allow the user override the "disk size" if they provided num_lba */ if (!dinfo->num_lba) { if (ioctl(fd, BLKGETSIZE64, &disk_size) < 0) { - LOGE("Could not get block device size (errno=%d)", errno); + ALOGE("Could not get block device size (errno=%d)", errno); goto fail; } /* XXX: we assume that the disk has < 2^32 sectors :-) */ @@ -319,9 +319,9 @@ validate(struct disk_info *dinfo) } else disk_size = (uint64_t)dinfo->num_lba * (uint64_t)dinfo->sect_size; } else if (S_ISREG(stat.st_mode)) { - LOGI("Requesting operation on a regular file, not block device."); + ALOGI("Requesting operation on a regular file, not block device."); if (!dinfo->sect_size) { - LOGE("Sector size for regular file images cannot be zero"); + ALOGE("Sector size for regular file images cannot be zero"); goto fail; } if (dinfo->num_lba) @@ -331,12 +331,12 @@ validate(struct disk_info *dinfo) disk_size = (uint64_t)stat.st_size; } } else { - LOGE("Device does not refer to a regular file or a block device!"); + ALOGE("Device does not refer to a regular file or a block device!"); goto fail; } #if 1 - LOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d", + ALOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d", dinfo->device, disk_size, dinfo->num_lba, dinfo->sect_size); #endif @@ -350,12 +350,12 @@ validate(struct disk_info *dinfo) if (part->len_kb != (uint32_t)-1) { total_size += part->len_kb * 1024; } else if (part->len_kb == 0) { - LOGE("Zero-size partition '%s' is invalid.", part->name); + ALOGE("Zero-size partition '%s' is invalid.", part->name); goto fail; } else { /* the partition requests the rest of the disk. */ if (cnt + 1 != dinfo->num_parts) { - LOGE("Only the last partition in the list can request to fill " + ALOGE("Only the last partition in the list can request to fill " "the rest of disk."); goto fail; } @@ -363,7 +363,7 @@ validate(struct disk_info *dinfo) if ((part->type != PC_PART_TYPE_LINUX) && (part->type != PC_PART_TYPE_FAT32)) { - LOGE("Unknown partition type (0x%x) encountered for partition " + ALOGE("Unknown partition type (0x%x) encountered for partition " "'%s'\n", part->type, part->name); goto fail; } @@ -371,7 +371,7 @@ validate(struct disk_info *dinfo) /* only matters for disks, not files */ if (S_ISBLK(stat.st_mode) && total_size > disk_size) { - LOGE("Total requested size of partitions (%llu) is greater than disk " + ALOGE("Total requested size of partitions (%llu) is greater than disk " "size (%llu).", total_size, disk_size); goto fail; } @@ -399,7 +399,7 @@ validate_and_config(struct disk_info *dinfo, int *fd, struct write_list **lst) case PART_SCHEME_GPT: /* not supported yet */ default: - LOGE("Uknown partition scheme."); + ALOGE("Uknown partition scheme."); break; } @@ -438,7 +438,7 @@ apply_disk_config(struct disk_info *dinfo, int test) int rv; if (validate_and_config(dinfo, &fd, &wr_lst) != 0) { - LOGE("Configuration is invalid."); + ALOGE("Configuration is invalid."); goto fail; } @@ -523,10 +523,10 @@ find_part_device(struct disk_info *dinfo, const char *name) case PART_SCHEME_MBR: return find_mbr_part(dinfo, name); case PART_SCHEME_GPT: - LOGE("GPT is presently not supported"); + ALOGE("GPT is presently not supported"); break; default: - LOGE("Unknown partition table scheme"); + ALOGE("Unknown partition table scheme"); break; } diff --git a/libdiskconfig/diskutils.c b/libdiskconfig/diskutils.c index 22767c00e..e32573543 100644 --- a/libdiskconfig/diskutils.c +++ b/libdiskconfig/diskutils.c @@ -40,20 +40,20 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test) int done = 0; uint64_t total = 0; - LOGI("Writing RAW image '%s' to '%s' (offset=%llu)", src, dst, offset); + ALOGI("Writing RAW image '%s' to '%s' (offset=%llu)", src, dst, offset); if ((src_fd = open(src, O_RDONLY)) < 0) { - LOGE("Could not open %s for reading (errno=%d).", src, errno); + ALOGE("Could not open %s for reading (errno=%d).", src, errno); goto fail; } if (!test) { if ((dst_fd = open(dst, O_RDWR)) < 0) { - LOGE("Could not open '%s' for read/write (errno=%d).", dst, errno); + ALOGE("Could not open '%s' for read/write (errno=%d).", dst, errno); goto fail; } if (lseek64(dst_fd, offset, SEEK_SET) != offset) { - LOGE("Could not seek to offset %lld in %s.", offset, dst); + ALOGE("Could not seek to offset %lld in %s.", offset, dst); goto fail; } } @@ -63,7 +63,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test) /* XXX: Should we not even bother with EINTR? */ if (errno == EINTR) continue; - LOGE("Error (%d) while reading from '%s'", errno, src); + ALOGE("Error (%d) while reading from '%s'", errno, src); goto fail; } @@ -84,7 +84,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test) /* XXX: Should we not even bother with EINTR? */ if (errno == EINTR) continue; - LOGE("Error (%d) while writing to '%s'", errno, dst); + ALOGE("Error (%d) while writing to '%s'", errno, dst); goto fail; } if (!tmp) @@ -94,14 +94,14 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test) } if (!done) { - LOGE("Exited read/write loop without setting flag! WTF?!"); + ALOGE("Exited read/write loop without setting flag! WTF?!"); goto fail; } if (dst_fd >= 0) fsync(dst_fd); - LOGI("Wrote %llu bytes to %s @ %lld", total, dst, offset); + ALOGI("Wrote %llu bytes to %s @ %lld", total, dst, offset); close(src_fd); if (dst_fd >= 0) diff --git a/libdiskconfig/dump_diskconfig.c b/libdiskconfig/dump_diskconfig.c index fff19f5ab..75256f616 100644 --- a/libdiskconfig/dump_diskconfig.c +++ b/libdiskconfig/dump_diskconfig.c @@ -28,7 +28,7 @@ main(int argc, char *argv[]) struct disk_info *dinfo; if (argc < 2) { - LOGE("usage: %s <conf file>", argv[0]); + ALOGE("usage: %s <conf file>", argv[0]); return 1; } diff --git a/libdiskconfig/write_lst.c b/libdiskconfig/write_lst.c index 12b7cd775..826ef7a3c 100644 --- a/libdiskconfig/write_lst.c +++ b/libdiskconfig/write_lst.c @@ -32,7 +32,7 @@ alloc_wl(uint32_t data_len) struct write_list *item; if (!(item = malloc(sizeof(struct write_list) + data_len))) { - LOGE("Unable to allocate memory."); + ALOGE("Unable to allocate memory."); return NULL; } @@ -71,18 +71,18 @@ wlist_commit(int fd, struct write_list *lst, int test) { for(; lst; lst = lst->next) { if (lseek64(fd, lst->offset, SEEK_SET) != (loff_t)lst->offset) { - LOGE("Cannot seek to the specified position (%lld).", lst->offset); + ALOGE("Cannot seek to the specified position (%lld).", lst->offset); goto fail; } if (!test) { if (write(fd, lst->data, lst->len) != (int)lst->len) { - LOGE("Failed writing %u bytes at position %lld.", lst->len, + ALOGE("Failed writing %u bytes at position %lld.", lst->len, lst->offset); goto fail; } } else - LOGI("Would write %d bytes @ offset %lld.", lst->len, lst->offset); + ALOGI("Would write %d bytes @ offset %lld.", lst->len, lst->offset); } return 0; diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c index 4f2d1c15e..b38e258c8 100644 --- a/libnetutils/dhcpclient.c +++ b/libnetutils/dhcpclient.c @@ -70,7 +70,7 @@ void printerr(char *fmt, ...) vsnprintf(errmsg, sizeof(errmsg), fmt, ap); va_end(ap); - LOGD("%s", errmsg); + ALOGD("%s", errmsg); } const char *dhcp_lasterror() @@ -151,14 +151,14 @@ static const char *dhcp_type_to_name(uint32_t type) void dump_dhcp_info(dhcp_info *info) { char addr[20], gway[20], mask[20]; - LOGD("--- dhcp %s (%d) ---", + ALOGD("--- dhcp %s (%d) ---", dhcp_type_to_name(info->type), info->type); strcpy(addr, ipaddr(info->ipaddr)); strcpy(gway, ipaddr(info->gateway)); - LOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength); - if (info->dns1) LOGD("dns1: %s", ipaddr(info->dns1)); - if (info->dns2) LOGD("dns2: %s", ipaddr(info->dns2)); - LOGD("server %s, lease %d seconds", + ALOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength); + if (info->dns1) ALOGD("dns1: %s", ipaddr(info->dns1)); + if (info->dns2) ALOGD("dns2: %s", ipaddr(info->dns2)); + ALOGD("server %s, lease %d seconds", ipaddr(info->serveraddr), info->lease); } @@ -250,9 +250,9 @@ void dump_dhcp_msg(dhcp_msg *msg, int len) const char *name; char buf[2048]; - LOGD("===== DHCP message:"); + ALOGD("===== DHCP message:"); if (len < DHCP_MSG_FIXED_SIZE) { - LOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE); + ALOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE); return; } @@ -264,18 +264,18 @@ void dump_dhcp_msg(dhcp_msg *msg, int len) name = "BOOTREPLY"; else name = "????"; - LOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d", + ALOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d", name, msg->op, msg->htype, msg->hlen, msg->hops); - LOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d", + ALOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d", ntohl(msg->xid), ntohs(msg->secs), ntohs(msg->flags), len); - LOGD("ciaddr = %s", ipaddr(msg->ciaddr)); - LOGD("yiaddr = %s", ipaddr(msg->yiaddr)); - LOGD("siaddr = %s", ipaddr(msg->siaddr)); - LOGD("giaddr = %s", ipaddr(msg->giaddr)); + ALOGD("ciaddr = %s", ipaddr(msg->ciaddr)); + ALOGD("yiaddr = %s", ipaddr(msg->yiaddr)); + ALOGD("siaddr = %s", ipaddr(msg->siaddr)); + ALOGD("giaddr = %s", ipaddr(msg->giaddr)); c = msg->hlen > 16 ? 16 : msg->hlen; hex2str(buf, msg->chaddr, c); - LOGD("chaddr = {%s}", buf); + ALOGD("chaddr = {%s}", buf); for (n = 0; n < 64; n++) { if ((msg->sname[n] < ' ') || (msg->sname[n] > 127)) { @@ -293,8 +293,8 @@ void dump_dhcp_msg(dhcp_msg *msg, int len) } msg->file[127] = 0; - LOGD("sname = '%s'", msg->sname); - LOGD("file = '%s'", msg->file); + ALOGD("sname = '%s'", msg->sname); + ALOGD("file = '%s'", msg->file); if (len < 4) return; len -= 4; @@ -327,7 +327,7 @@ void dump_dhcp_msg(dhcp_msg *msg, int len) name = dhcp_type_to_name(x[2]); else name = NULL; - LOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name); + ALOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name); len -= optsz; x = x + optsz + 2; } @@ -347,28 +347,28 @@ static int send_message(int sock, int if_index, dhcp_msg *msg, int size) static int is_valid_reply(dhcp_msg *msg, dhcp_msg *reply, int sz) { if (sz < DHCP_MSG_FIXED_SIZE) { - if (verbose) LOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE); + if (verbose) ALOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE); return 0; } if (reply->op != OP_BOOTREPLY) { - if (verbose) LOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY); + if (verbose) ALOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY); return 0; } if (reply->xid != msg->xid) { - if (verbose) LOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid), + if (verbose) ALOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid), ntohl(msg->xid)); return 0; } if (reply->htype != msg->htype) { - if (verbose) LOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype); + if (verbose) ALOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype); return 0; } if (reply->hlen != msg->hlen) { - if (verbose) LOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen); + if (verbose) ALOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen); return 0; } if (memcmp(msg->chaddr, reply->chaddr, msg->hlen)) { - if (verbose) LOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr)); + if (verbose) ALOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr)); return 0; } return 1; @@ -469,7 +469,7 @@ int dhcp_init_ifc(const char *ifname) r = receive_packet(s, &reply); if (r < 0) { if (errno != 0) { - LOGD("receive_packet failed (%d): %s", r, strerror(errno)); + ALOGD("receive_packet failed (%d): %s", r, strerror(errno)); if (errno == ENETDOWN || errno == ENXIO) { return -1; } diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c index 0a2f76045..186b98c3a 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c @@ -46,8 +46,8 @@ #else #include <stdio.h> #include <string.h> -#define LOGD printf -#define LOGW printf +#define ALOGD printf +#define ALOGW printf #endif static int ifc_ctl_sock = -1; @@ -382,7 +382,7 @@ int ifc_clear_ipv6_addresses(const char *name) { ret = ifc_del_address(ifname, addrstr, prefixlen); if (ret) { - LOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname, + ALOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname, strerror(-ret)); lasterror = ret; } @@ -686,7 +686,7 @@ int ifc_remove_host_routes(const char *name) init_sockaddr_in(&rt.rt_genmask, mask); addr.s_addr = dest; if (ioctl(ifc_ctl_sock, SIOCDELRT, &rt) < 0) { - LOGD("failed to remove route for %s to %s: %s", + ALOGD("failed to remove route for %s to %s: %s", ifname, inet_ntoa(addr), strerror(errno)); } } @@ -752,7 +752,7 @@ int ifc_set_default_route(const char *ifname, in_addr_t gateway) ifc_init(); addr.s_addr = gateway; if ((result = ifc_create_default_route(ifname, gateway)) < 0) { - LOGD("failed to add %s as default route for %s: %s", + ALOGD("failed to add %s as default route for %s: %s", inet_ntoa(addr), ifname, strerror(errno)); } ifc_close(); @@ -773,7 +773,7 @@ int ifc_remove_default_route(const char *ifname) rt.rt_flags = RTF_UP|RTF_GATEWAY; init_sockaddr_in(&rt.rt_dst, 0); if ((result = ioctl(ifc_ctl_sock, SIOCDELRT, &rt)) < 0) { - LOGD("failed to remove default route for %s: %s", ifname, strerror(errno)); + ALOGD("failed to remove default route for %s: %s", ifname, strerror(errno)); } ifc_close(); return result; diff --git a/libnetutils/packet.c b/libnetutils/packet.c index 9388345c7..3ec83fe06 100644 --- a/libnetutils/packet.c +++ b/libnetutils/packet.c @@ -31,8 +31,8 @@ #else #include <stdio.h> #include <string.h> -#define LOGD printf -#define LOGW printf +#define ALOGD printf +#define ALOGW printf #endif #include "dhcpmsg.h" @@ -179,23 +179,23 @@ int receive_packet(int s, struct dhcp_msg *msg) is_valid = 0; if (nread < (int)(sizeof(struct iphdr) + sizeof(struct udphdr))) { #if VERBOSE - LOGD("Packet is too small (%d) to be a UDP datagram", nread); + ALOGD("Packet is too small (%d) to be a UDP datagram", nread); #endif } else if (packet.ip.version != IPVERSION || packet.ip.ihl != (sizeof(packet.ip) >> 2)) { #if VERBOSE - LOGD("Not a valid IP packet"); + ALOGD("Not a valid IP packet"); #endif } else if (nread < ntohs(packet.ip.tot_len)) { #if VERBOSE - LOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len)); + ALOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len)); #endif } else if (packet.ip.protocol != IPPROTO_UDP) { #if VERBOSE - LOGD("IP protocol (%d) is not UDP", packet.ip.protocol); + ALOGD("IP protocol (%d) is not UDP", packet.ip.protocol); #endif } else if (packet.udp.dest != htons(PORT_BOOTP_CLIENT)) { #if VERBOSE - LOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest)); + ALOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest)); #endif } else { is_valid = 1; @@ -209,7 +209,7 @@ int receive_packet(int s, struct dhcp_msg *msg) /* validate IP header checksum */ sum = finish_sum(checksum(&packet.ip, sizeof(packet.ip), 0)); if (sum != 0) { - LOGW("IP header checksum failure (0x%x)", packet.ip.check); + ALOGW("IP header checksum failure (0x%x)", packet.ip.check); return -1; } /* @@ -231,7 +231,7 @@ int receive_packet(int s, struct dhcp_msg *msg) sum = finish_sum(checksum(&packet, nread, 0)); packet.udp.check = temp; if (temp != sum) { - LOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp); + ALOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp); return -1; } memcpy(msg, &packet.dhcp, dhcp_size); diff --git a/libpixelflinger/codeflinger/ARMAssembler.cpp b/libpixelflinger/codeflinger/ARMAssembler.cpp index 4726a08ec..0dc50376d 100644 --- a/libpixelflinger/codeflinger/ARMAssembler.cpp +++ b/libpixelflinger/codeflinger/ARMAssembler.cpp @@ -177,7 +177,7 @@ int ARMAssembler::generate(const char* name) // the instruction cache is flushed by CodeCache const int64_t duration = ggl_system_time() - mDuration; const char * const format = "generated %s (%d ins) at [%p:%p] in %lld ns\n"; - LOGI(format, name, int(pc()-base()), base(), pc(), duration); + ALOGI(format, name, int(pc()-base()), base(), pc(), duration); #if defined(WITH_LIB_HARDWARE) if (__builtin_expect(mQemuTracing, 0)) { diff --git a/libpixelflinger/codeflinger/CodeCache.cpp b/libpixelflinger/codeflinger/CodeCache.cpp index 125c3ce05..a713febaf 100644 --- a/libpixelflinger/codeflinger/CodeCache.cpp +++ b/libpixelflinger/codeflinger/CodeCache.cpp @@ -159,7 +159,7 @@ int CodeCache::cache( const AssemblyKeyBase& keyBase, const long base = long(assembly->base()); const long curr = base + long(assembly->size()); err = cacheflush(base, curr, 0); - LOGE_IF(err, "__ARM_NR_cacheflush error %s\n", + ALOGE_IF(err, "__ARM_NR_cacheflush error %s\n", strerror(errno)); #endif } diff --git a/libpixelflinger/codeflinger/GGLAssembler.cpp b/libpixelflinger/codeflinger/GGLAssembler.cpp index 1cd189c9f..f1d81b27c 100644 --- a/libpixelflinger/codeflinger/GGLAssembler.cpp +++ b/libpixelflinger/codeflinger/GGLAssembler.cpp @@ -82,7 +82,7 @@ int GGLAssembler::scanline(const needs_t& needs, context_t const* c) needs.p, needs.n, needs.t[0], needs.t[1], per_fragment_ops); if (err) { - LOGE("Error while generating ""%s""\n", name); + ALOGE("Error while generating ""%s""\n", name); disassemble(name); return -1; } @@ -1095,7 +1095,7 @@ int RegisterAllocator::RegisterFile::obtain() } // this is not an error anymore because, we'll try again with // a lower optimization level. - //LOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n"); + //ALOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n"); if (i >= nbreg) { mStatus |= OUT_OF_REGISTERS; // we return SP so we can more easily debug things diff --git a/libpixelflinger/codeflinger/blending.cpp b/libpixelflinger/codeflinger/blending.cpp index 083042ce9..c90eaa0f5 100644 --- a/libpixelflinger/codeflinger/blending.cpp +++ b/libpixelflinger/codeflinger/blending.cpp @@ -536,7 +536,7 @@ void GGLAssembler::mul_factor( component_t& d, } } - LOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs); + ALOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs); int vreg = v.reg; int freg = f.reg; @@ -574,7 +574,7 @@ void GGLAssembler::mul_factor_add( component_t& d, int as = a.h; int ms = vs+fs; - LOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as); + ALOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as); integer_t add(a.reg, a.h, a.flags); diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index ed20a0011..62aa05c10 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -257,7 +257,7 @@ void GGLAssembler::downshift( int dbits = dh - dl; int dithering = 0; - LOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits); + ALOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits); if (sbits>dbits) { // see if we need to dither diff --git a/libpixelflinger/codeflinger/texturing.cpp b/libpixelflinger/codeflinger/texturing.cpp index 7f6f8da4e..8464fbd84 100644 --- a/libpixelflinger/codeflinger/texturing.cpp +++ b/libpixelflinger/codeflinger/texturing.cpp @@ -778,7 +778,7 @@ void GGLAssembler::filter16( break; default: // unsupported format, do something sensical... - LOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx); + ALOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx); LDRH(AL, texel.reg, txPtr.reg); return; } diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index a37b47e18..93440f521 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -351,7 +351,7 @@ static void pick_scanline(context_t* c) } #if DEBUG_NEEDS - LOGI("Needs: n=0x%08x p=0x%08x t0=0x%08x t1=0x%08x", + ALOGI("Needs: n=0x%08x p=0x%08x t0=0x%08x t1=0x%08x", c->state.needs.n, c->state.needs.p, c->state.needs.t[0], c->state.needs.t[1]); #endif @@ -381,7 +381,7 @@ static void pick_scanline(context_t* c) err = gCodeCache.cache(a->key(), a); } if (ggl_unlikely(err)) { - LOGE("error generating or caching assembly. Reverting to NOP."); + ALOGE("error generating or caching assembly. Reverting to NOP."); c->scanline = scanline_noop; c->init_y = init_y_noop; c->step_y = step_y__nop; @@ -395,12 +395,12 @@ static void pick_scanline(context_t* c) c->scanline_as->decStrong(c); } - //LOGI("using generated pixel-pipeline"); + //ALOGI("using generated pixel-pipeline"); c->scanline_as = assembly.get(); c->scanline_as->incStrong(c); // hold on to assembly c->scanline = (void(*)(context_t* c))assembly->base(); #else -// LOGW("using generic (slow) pixel-pipeline"); +// ALOGW("using generic (slow) pixel-pipeline"); c->scanline = scanline; #endif } @@ -1761,7 +1761,7 @@ void init_y_error(context_t* c, int32_t y0) // woooops, shoud never happen, // fail gracefully (don't display anything) init_y_noop(c, y0); - LOGE("color-buffer has an invalid format!"); + ALOGE("color-buffer has an invalid format!"); } // ---------------------------------------------------------------------------- diff --git a/libpixelflinger/tinyutils/VectorImpl.cpp b/libpixelflinger/tinyutils/VectorImpl.cpp index a04970642..05c4945b6 100644 --- a/libpixelflinger/tinyutils/VectorImpl.cpp +++ b/libpixelflinger/tinyutils/VectorImpl.cpp @@ -57,7 +57,7 @@ VectorImpl::VectorImpl(const VectorImpl& rhs) VectorImpl::~VectorImpl() { - LOG_ASSERT(!mCount, + ALOG_ASSERT(!mCount, "[%p] " "subclasses of VectorImpl must call finish_vector()" " in their destructor. Leaking %d bytes.", @@ -67,7 +67,7 @@ VectorImpl::~VectorImpl() VectorImpl& VectorImpl::operator = (const VectorImpl& rhs) { - LOG_ASSERT(mItemSize == rhs.mItemSize, + ALOG_ASSERT(mItemSize == rhs.mItemSize, "Vector<> have different types (this=%p, rhs=%p)", this, &rhs); if (this != &rhs) { release_storage(); @@ -176,7 +176,7 @@ ssize_t VectorImpl::replaceAt(size_t index) ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) { - LOG_ASSERT(index<size(), + ALOG_ASSERT(index<size(), "[%p] replace: index=%d, size=%d", this, (int)index, (int)size()); void* item = editItemLocation(index); @@ -193,7 +193,7 @@ ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) ssize_t VectorImpl::removeItemsAt(size_t index, size_t count) { - LOG_ASSERT((index+count)<=size(), + ALOG_ASSERT((index+count)<=size(), "[%p] remove: index=%d, count=%d, size=%d", this, (int)index, (int)count, (int)size()); @@ -217,7 +217,7 @@ void VectorImpl::clear() void* VectorImpl::editItemLocation(size_t index) { - LOG_ASSERT(index<capacity(), + ALOG_ASSERT(index<capacity(), "[%p] itemLocation: index=%d, capacity=%d, count=%d", this, (int)index, (int)capacity(), (int)mCount); @@ -229,7 +229,7 @@ void* VectorImpl::editItemLocation(size_t index) const void* VectorImpl::itemLocation(size_t index) const { - LOG_ASSERT(index<capacity(), + ALOG_ASSERT(index<capacity(), "[%p] editItemLocation: index=%d, capacity=%d, count=%d", this, (int)index, (int)capacity(), (int)mCount); @@ -272,7 +272,7 @@ void VectorImpl::release_storage() void* VectorImpl::_grow(size_t where, size_t amount) { -// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); if (where > mCount) @@ -281,7 +281,7 @@ void* VectorImpl::_grow(size_t where, size_t amount) const size_t new_size = mCount + amount; if (capacity() < new_size) { const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2); -// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); if ((mStorage) && (mCount==where) && (mFlags & HAS_TRIVIAL_COPY) && @@ -325,7 +325,7 @@ void VectorImpl::_shrink(size_t where, size_t amount) if (!mStorage) return; -// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); if (where >= mCount) @@ -334,7 +334,7 @@ void VectorImpl::_shrink(size_t where, size_t amount) const size_t new_size = mCount - amount; if (new_size*3 < capacity()) { const size_t new_capacity = max(kMinVectorCapacity, new_size*2); -// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); if ((where == mCount-amount) && (mFlags & HAS_TRIVIAL_COPY) && (mFlags & HAS_TRIVIAL_DTOR)) diff --git a/libpixelflinger/trap.cpp b/libpixelflinger/trap.cpp index 30b633f1b..80efeff71 100644 --- a/libpixelflinger/trap.cpp +++ b/libpixelflinger/trap.cpp @@ -94,15 +94,15 @@ static inline void swap(T& a, T& b) { static void triangle_dump_points( const GGLcoord* v0, const GGLcoord* v1, - const GGLcoord* v2 ) + const GGLcoord* v2 ) { float tri = 1.0f / TRI_ONE; - LOGD( " P0=(%.3f, %.3f) [%08x, %08x]\n" - " P1=(%.3f, %.3f) [%08x, %08x]\n" - " P2=(%.3f, %.3f) [%08x, %08x]\n", - v0[0]*tri, v0[1]*tri, v0[0], v0[1], - v1[0]*tri, v1[1]*tri, v1[0], v1[1], - v2[0]*tri, v2[1]*tri, v2[0], v2[1] ); + ALOGD(" P0=(%.3f, %.3f) [%08x, %08x]\n" + " P1=(%.3f, %.3f) [%08x, %08x]\n" + " P2=(%.3f, %.3f) [%08x, %08x]\n", + v0[0]*tri, v0[1]*tri, v0[0], v0[1], + v1[0]*tri, v1[1]*tri, v1[0], v1[1], + v2[0]*tri, v2[1]*tri, v2[0], v2[1] ); } // ---------------------------------------------------------------------------- @@ -639,7 +639,7 @@ struct Edge static void edge_dump( Edge* edge ) { - LOGI( " top=%d (%.3f) bot=%d (%.3f) x=%d (%.3f) ix=%d (%.3f)", + ALOGI( " top=%d (%.3f) bot=%d (%.3f) x=%d (%.3f) ix=%d (%.3f)", edge->y_top, edge->y_top/float(TRI_ONE), edge->y_bot, edge->y_bot/float(TRI_ONE), edge->x, edge->x/float(FIXED_ONE), @@ -650,7 +650,7 @@ static void triangle_dump_edges( Edge* edges, int count ) { - LOGI( "%d edge%s:\n", count, count == 1 ? "" : "s" ); + ALOGI( "%d edge%s:\n", count, count == 1 ? "" : "s" ); for ( ; count > 0; count--, edges++ ) edge_dump( edges ); } @@ -835,7 +835,7 @@ void AAEdge::dump() float tri = 1.0f / TRI_ONE; float iter = 1.0f / (1<<TRI_ITERATORS_BITS); float fix = 1.0f / FIXED_ONE; - LOGD( "x=%08x (%.3f), " + ALOGD( "x=%08x (%.3f), " "x_incr=%08x (%.3f), y_incr=%08x (%.3f), " "y_top=%08x (%.3f), y_bot=%08x (%.3f) ", x, x*fix, diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c index b1c967d2a..5d261cd76 100644 --- a/libusbhost/usbhost.c +++ b/libusbhost/usbhost.c @@ -20,7 +20,7 @@ #ifdef USE_LIBLOG #define LOG_TAG "usbhost" #include "utils/Log.h" -#define D LOGD +#define D ALOGD #else #define D printf #endif diff --git a/logwrapper/logwrapper.c b/logwrapper/logwrapper.c index bdf53e843..6a805605a 100644 --- a/logwrapper/logwrapper.c +++ b/logwrapper/logwrapper.c @@ -28,7 +28,7 @@ void fatal(const char *msg) { fprintf(stderr, "%s", msg); - LOG(LOG_ERROR, "logwrapper", "%s", msg); + ALOG(LOG_ERROR, "logwrapper", "%s", msg); exit(-1); } @@ -60,7 +60,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { buffer[b] = '\0'; } else if (buffer[b] == '\n') { buffer[b] = '\0'; - LOG(LOG_INFO, tag, "%s", &buffer[a]); + ALOG(LOG_INFO, tag, "%s", &buffer[a]); a = b + 1; } } @@ -68,7 +68,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { if (a == 0 && b == sizeof(buffer) - 1) { // buffer is full, flush buffer[b] = '\0'; - LOG(LOG_INFO, tag, "%s", &buffer[a]); + ALOG(LOG_INFO, tag, "%s", &buffer[a]); b = 0; } else if (a != b) { // Keep left-overs @@ -84,21 +84,21 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { // Flush remaining data if (a != b) { buffer[b] = '\0'; - LOG(LOG_INFO, tag, "%s", &buffer[a]); + ALOG(LOG_INFO, tag, "%s", &buffer[a]); } status = 0xAAAA; if (wait(&status) != -1) { // Wait for child if (WIFEXITED(status)) - LOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag, + ALOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag, WEXITSTATUS(status)); else if (WIFSIGNALED(status)) - LOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag, + ALOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag, WTERMSIG(status)); else if (WIFSTOPPED(status)) - LOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag, + ALOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag, WSTOPSIG(status)); } else - LOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag, + ALOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag, strerror(errno), errno); if (seg_fault_on_exit) *(int *)status = 0; // causes SIGSEGV with fault_address = status @@ -111,7 +111,7 @@ void child(int argc, char* argv[]) { argv_child[argc] = NULL; if (execvp(argv_child[0], argv_child)) { - LOG(LOG_ERROR, "logwrapper", + ALOG(LOG_ERROR, "logwrapper", "executing %s failed: %s\n", argv_child[0], strerror(errno)); exit(-1); } diff --git a/nexus/CommandListener.cpp b/nexus/CommandListener.cpp index 5973ff510..7c934a75a 100644 --- a/nexus/CommandListener.cpp +++ b/nexus/CommandListener.cpp @@ -213,12 +213,12 @@ int CommandListener::ListCmd::runCommand(SocketClient *cli, int argc, char **arg if (!NetworkManager::Instance()->getPropMngr()->get((*it), p_v, sizeof(p_v))) { - LOGW("Failed to get %s (%s)", (*it), strerror(errno)); + ALOGW("Failed to get %s (%s)", (*it), strerror(errno)); } char *buf; if (asprintf(&buf, "%s %s", (*it), p_v) < 0) { - LOGE("Failed to allocate memory"); + ALOGE("Failed to allocate memory"); free((*it)); continue; } diff --git a/nexus/Controller.cpp b/nexus/Controller.cpp index f6a24361c..dae8783a3 100644 --- a/nexus/Controller.cpp +++ b/nexus/Controller.cpp @@ -86,7 +86,7 @@ int Controller::unloadKernelModule(const char *modtag) { } if (rc != 0) { - LOGW("Unable to unload kernel driver '%s' (%s)", modtag, + ALOGW("Unable to unload kernel driver '%s' (%s)", modtag, strerror(errno)); } return rc; @@ -96,7 +96,7 @@ bool Controller::isKernelModuleLoaded(const char *modtag) { FILE *fp = fopen("/proc/modules", "r"); if (!fp) { - LOGE("Unable to open /proc/modules (%s)", strerror(errno)); + ALOGE("Unable to open /proc/modules (%s)", strerror(errno)); return false; } @@ -105,7 +105,7 @@ bool Controller::isKernelModuleLoaded(const char *modtag) { char *endTag = strchr(line, ' '); if (!endTag) { - LOGW("Unable to find tag for line '%s'", line); + ALOGW("Unable to find tag for line '%s'", line); continue; } if (!strncmp(line, modtag, (endTag - line))) { diff --git a/nexus/DhcpClient.cpp b/nexus/DhcpClient.cpp index 713059d88..81fdf47bf 100644 --- a/nexus/DhcpClient.cpp +++ b/nexus/DhcpClient.cpp @@ -53,7 +53,7 @@ DhcpClient::~DhcpClient() { } int DhcpClient::start(Controller *c) { - LOGD("Starting DHCP service (arp probe = %d)", mDoArpProbe); + ALOGD("Starting DHCP service (arp probe = %d)", mDoArpProbe); char svc[PROPERTY_VALUE_MAX]; snprintf(svc, sizeof(svc), @@ -72,7 +72,7 @@ int DhcpClient::start(Controller *c) { sockaddr_in addr; if ((mListenerSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - LOGE("Failed to create DHCP listener socket"); + ALOGE("Failed to create DHCP listener socket"); pthread_mutex_unlock(&mLock); return -1; } @@ -82,7 +82,7 @@ int DhcpClient::start(Controller *c) { addr.sin_port = htons(DhcpClient::STATUS_MONITOR_PORT); if (bind(mListenerSocket, (struct sockaddr *) &addr, sizeof(addr))) { - LOGE("Failed to bind DHCP listener socket"); + ALOGE("Failed to bind DHCP listener socket"); close(mListenerSocket); mListenerSocket = -1; pthread_mutex_unlock(&mLock); @@ -90,14 +90,14 @@ int DhcpClient::start(Controller *c) { } if (mServiceManager->start(svc)) { - LOGE("Failed to start dhcp service"); + ALOGE("Failed to start dhcp service"); pthread_mutex_unlock(&mLock); return -1; } mListener = new DhcpListener(mController, mListenerSocket, mHandlers); if (mListener->startListener()) { - LOGE("Failed to start listener"); + ALOGE("Failed to start listener"); #if 0 mServiceManager->stop("dhcpcd"); return -1; @@ -126,7 +126,7 @@ int DhcpClient::stop() { close(mListenerSocket); if (mServiceManager->stop("dhcpcd")) { - LOGW("Failed to stop DHCP service (%s)", strerror(errno)); + ALOGW("Failed to stop DHCP service (%s)", strerror(errno)); // XXX: Kill it the hard way.. but its gotta go! } diff --git a/nexus/DhcpEvent.cpp b/nexus/DhcpEvent.cpp index 58893f409..2f1ce6fbc 100644 --- a/nexus/DhcpEvent.cpp +++ b/nexus/DhcpEvent.cpp @@ -50,7 +50,7 @@ int DhcpEvent::parseString(const char *buffer) { else if (!strcasecmp(buffer, "TIMEOUT")) return DhcpEvent::TIMEOUT; else { - LOGW("Bad event '%s'", buffer); + ALOGW("Bad event '%s'", buffer); return -1; } } diff --git a/nexus/DhcpListener.cpp b/nexus/DhcpListener.cpp index afa68ebdb..16c369b81 100644 --- a/nexus/DhcpListener.cpp +++ b/nexus/DhcpListener.cpp @@ -42,7 +42,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) { int rc; if ((rc = read(cli->getSocket(), buffer, sizeof(buffer))) < 0) { - LOGW("Error reading dhcp status msg (%s)", strerror(errno)); + ALOGW("Error reading dhcp status msg (%s)", strerror(errno)); return true; } @@ -53,7 +53,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) { for (i = 0; i < 2; i++) { if (!(tmp = strsep(&next, ":"))) { - LOGW("Error parsing state '%s'", buffer); + ALOGW("Error parsing state '%s'", buffer); return true; } } @@ -65,22 +65,22 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) { struct in_addr ipaddr, netmask, gateway, broadcast, dns1, dns2; if (!inet_aton(strsep(&next, ":"), &ipaddr)) { - LOGW("Malformatted IP specified"); + ALOGW("Malformatted IP specified"); } if (!inet_aton(strsep(&next, ":"), &netmask)) { - LOGW("Malformatted netmask specified"); + ALOGW("Malformatted netmask specified"); } if (!inet_aton(strsep(&next, ":"), &broadcast)) { - LOGW("Malformatted broadcast specified"); + ALOGW("Malformatted broadcast specified"); } if (!inet_aton(strsep(&next, ":"), &gateway)) { - LOGW("Malformatted gateway specified"); + ALOGW("Malformatted gateway specified"); } if (!inet_aton(strsep(&next, ":"), &dns1)) { - LOGW("Malformatted dns1 specified"); + ALOGW("Malformatted dns1 specified"); } if (!inet_aton(strsep(&next, ":"), &dns2)) { - LOGW("Malformatted dns2 specified"); + ALOGW("Malformatted dns2 specified"); } mHandlers->onDhcpLeaseUpdated(mController, &ipaddr, &netmask, &broadcast, &gateway, &dns1, &dns2); @@ -92,7 +92,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) { for (i = 0; i < 2; i++) { if (!(tmp = strsep(&next, ":"))) { - LOGW("Error parsing event '%s'", buffer); + ALOGW("Error parsing event '%s'", buffer); return true; } } @@ -101,7 +101,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) { mHandlers->onDhcpEvent(mController, ev); } else { - LOGW("Unknown DHCP monitor msg '%s'", buffer); + ALOGW("Unknown DHCP monitor msg '%s'", buffer); } return true; diff --git a/nexus/DhcpState.cpp b/nexus/DhcpState.cpp index c9d513581..b86c1861c 100644 --- a/nexus/DhcpState.cpp +++ b/nexus/DhcpState.cpp @@ -74,7 +74,7 @@ int DhcpState::parseString(const char *buffer) { else if (!strcasecmp(buffer, "ANNOUNCING")) return DhcpState::ANNOUNCING; else { - LOGW("Bad state '%s'", buffer); + ALOGW("Bad state '%s'", buffer); return -1; } } diff --git a/nexus/NetworkManager.cpp b/nexus/NetworkManager.cpp index e0df4096a..d4285bfa1 100644 --- a/nexus/NetworkManager.cpp +++ b/nexus/NetworkManager.cpp @@ -49,7 +49,7 @@ NetworkManager::~NetworkManager() { int NetworkManager::run() { if (startControllers()) { - LOGW("Unable to start all controllers (%s)", strerror(errno)); + ALOGW("Unable to start all controllers (%s)", strerror(errno)); } return 0; } @@ -107,29 +107,29 @@ Controller *NetworkManager::findController(const char *name) { } void NetworkManager::onInterfaceConnected(Controller *c) { - LOGD("Controller %s interface %s connected", c->getName(), c->getBoundInterface()); + ALOGD("Controller %s interface %s connected", c->getName(), c->getBoundInterface()); if (mDhcp->start(c)) { - LOGE("Failed to start DHCP (%s)", strerror(errno)); + ALOGE("Failed to start DHCP (%s)", strerror(errno)); return; } } void NetworkManager::onInterfaceDisconnected(Controller *c) { - LOGD("Controller %s interface %s disconnected", c->getName(), + ALOGD("Controller %s interface %s disconnected", c->getName(), c->getBoundInterface()); mDhcp->stop(); } void NetworkManager::onControllerSuspending(Controller *c) { - LOGD("Controller %s interface %s suspending", c->getName(), + ALOGD("Controller %s interface %s suspending", c->getName(), c->getBoundInterface()); mDhcp->stop(); } void NetworkManager::onControllerResumed(Controller *c) { - LOGD("Controller %s interface %s resumed", c->getName(), + ALOGD("Controller %s interface %s resumed", c->getName(), c->getBoundInterface()); } @@ -137,7 +137,7 @@ void NetworkManager::onDhcpStateChanged(Controller *c, int state) { char tmp[255]; char tmp2[255]; - LOGD("onDhcpStateChanged(%s -> %s)", + ALOGD("onDhcpStateChanged(%s -> %s)", DhcpState::toString(mLastDhcpState, tmp, sizeof(tmp)), DhcpState::toString(state, tmp2, sizeof(tmp2))); @@ -169,7 +169,7 @@ void NetworkManager::onDhcpStateChanged(Controller *c, int state) { void NetworkManager::onDhcpEvent(Controller *c, int evt) { char tmp[64]; - LOGD("onDhcpEvent(%s)", DhcpEvent::toString(evt, tmp, sizeof(tmp))); + ALOGD("onDhcpEvent(%s)", DhcpEvent::toString(evt, tmp, sizeof(tmp))); } void NetworkManager::onDhcpLeaseUpdated(Controller *c, struct in_addr *addr, diff --git a/nexus/OpenVpnController.cpp b/nexus/OpenVpnController.cpp index f1ea51022..6b6d8927c 100644 --- a/nexus/OpenVpnController.cpp +++ b/nexus/OpenVpnController.cpp @@ -53,7 +53,7 @@ int OpenVpnController::enable() { char tmp[64]; if (!mPropMngr->get("vpn.gateway", tmp, sizeof(tmp))) { - LOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno)); + ALOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno)); return -1; } snprintf(svc, sizeof(svc), "openvpn:--remote %s 1194", tmp); diff --git a/nexus/Property.cpp b/nexus/Property.cpp index d02769d57..6cfa955cf 100644 --- a/nexus/Property.cpp +++ b/nexus/Property.cpp @@ -30,7 +30,7 @@ Property::Property(const char *name, bool readOnly, mName(name), mReadOnly(readOnly), mType(type), mNumElements(numElements) { if (index(name, '.')) { - LOGW("Property name %s violates namespace rules", name); + ALOGW("Property name %s violates namespace rules", name); } } @@ -38,22 +38,22 @@ StringProperty::StringProperty(const char *name, bool ro, int elements) : Property(name, ro, Property::Type_STRING, elements) { } int StringProperty::set(int idx, int value) { - LOGE("Integer 'set' called on string property!"); + ALOGE("Integer 'set' called on string property!"); errno = EINVAL; return -1; } int StringProperty::set(int idx, struct in_addr *value) { - LOGE("IpAddr 'set' called on string property!"); + ALOGE("IpAddr 'set' called on string property!"); errno = EINVAL; return -1; } int StringProperty::get(int idx, int *buffer) { - LOGE("Integer 'get' called on string property!"); + ALOGE("Integer 'get' called on string property!"); errno = EINVAL; return -1; } int StringProperty::get(int idx, struct in_addr *buffer) { - LOGE("IpAddr 'get' called on string property!"); + ALOGE("IpAddr 'get' called on string property!"); errno = EINVAL; return -1; } @@ -67,7 +67,7 @@ StringPropertyHelper::StringPropertyHelper(const char *name, bool ro, int StringPropertyHelper::set(int idx, const char *value) { if (idx != 0) { - LOGW("Attempt to use array index on StringPropertyHelper::set"); + ALOGW("Attempt to use array index on StringPropertyHelper::set"); errno = EINVAL; return -1; } @@ -77,7 +77,7 @@ int StringPropertyHelper::set(int idx, const char *value) { int StringPropertyHelper::get(int idx, char *buffer, size_t max) { if (idx != 0) { - LOGW("Attempt to use array index on StringPropertyHelper::get"); + ALOGW("Attempt to use array index on StringPropertyHelper::get"); errno = EINVAL; return -1; } @@ -90,22 +90,22 @@ IntegerProperty::IntegerProperty(const char *name, bool ro, int elements) : } int IntegerProperty::set(int idx, const char *value) { - LOGE("String 'set' called on integer property!"); + ALOGE("String 'set' called on integer property!"); errno = EINVAL; return -1; } int IntegerProperty::set(int idx, struct in_addr *value) { - LOGE("IpAddr 'set' called on integer property!"); + ALOGE("IpAddr 'set' called on integer property!"); errno = EINVAL; return -1; } int IntegerProperty::get(int idx, char *buffer, size_t max) { - LOGE("String 'get' called on integer property!"); + ALOGE("String 'get' called on integer property!"); errno = EINVAL; return -1; } int IntegerProperty::get(int idx, struct in_addr *buffer) { - LOGE("IpAddr 'get' called on integer property!"); + ALOGE("IpAddr 'get' called on integer property!"); errno = EINVAL; return -1; } @@ -118,7 +118,7 @@ IntegerPropertyHelper::IntegerPropertyHelper(const char *name, bool ro, int IntegerPropertyHelper::set(int idx, int value) { if (idx != 0) { - LOGW("Attempt to use array index on IntegerPropertyHelper::set"); + ALOGW("Attempt to use array index on IntegerPropertyHelper::set"); errno = EINVAL; return -1; } @@ -128,7 +128,7 @@ int IntegerPropertyHelper::set(int idx, int value) { int IntegerPropertyHelper::get(int idx, int *buffer) { if (idx != 0) { - LOGW("Attempt to use array index on IntegerPropertyHelper::get"); + ALOGW("Attempt to use array index on IntegerPropertyHelper::get"); errno = EINVAL; return -1; } @@ -141,22 +141,22 @@ IPV4AddressProperty::IPV4AddressProperty(const char *name, bool ro, int elements } int IPV4AddressProperty::set(int idx, const char *value) { - LOGE("String 'set' called on ipv4 property!"); + ALOGE("String 'set' called on ipv4 property!"); errno = EINVAL; return -1; } int IPV4AddressProperty::set(int idx, int value) { - LOGE("Integer 'set' called on ipv4 property!"); + ALOGE("Integer 'set' called on ipv4 property!"); errno = EINVAL; return -1; } int IPV4AddressProperty::get(int idx, char *buffer, size_t max) { - LOGE("String 'get' called on ipv4 property!"); + ALOGE("String 'get' called on ipv4 property!"); errno = EINVAL; return -1; } int IPV4AddressProperty::get(int idx, int *buffer) { - LOGE("Integer 'get' called on ipv4 property!"); + ALOGE("Integer 'get' called on ipv4 property!"); errno = EINVAL; return -1; } @@ -169,7 +169,7 @@ IPV4AddressPropertyHelper::IPV4AddressPropertyHelper(const char *name, bool ro, int IPV4AddressPropertyHelper::set(int idx, struct in_addr *value) { if (idx != 0) { - LOGW("Attempt to use array index on IPV4AddressPropertyHelper::set"); + ALOGW("Attempt to use array index on IPV4AddressPropertyHelper::set"); errno = EINVAL; return -1; } @@ -179,7 +179,7 @@ int IPV4AddressPropertyHelper::set(int idx, struct in_addr *value) { int IPV4AddressPropertyHelper::get(int idx, struct in_addr *buffer) { if (idx != 0) { - LOGW("Attempt to use array index on IPV4AddressPropertyHelper::get"); + ALOGW("Attempt to use array index on IPV4AddressPropertyHelper::get"); errno = EINVAL; return -1; } diff --git a/nexus/PropertyManager.cpp b/nexus/PropertyManager.cpp index 704b2230b..41cdb41fa 100644 --- a/nexus/PropertyManager.cpp +++ b/nexus/PropertyManager.cpp @@ -66,10 +66,10 @@ Property *PropertyManager::lookupProperty_UNLOCKED(PropertyNamespace *ns, const int PropertyManager::attachProperty(const char *ns_name, Property *p) { PropertyNamespace *ns; - LOGD("Attaching property %s to namespace %s", p->getName(), ns_name); + ALOGD("Attaching property %s to namespace %s", p->getName(), ns_name); pthread_mutex_lock(&mLock); if (!(ns = lookupNamespace_UNLOCKED(ns_name))) { - LOGD("Creating namespace %s", ns_name); + ALOGD("Creating namespace %s", ns_name); ns = new PropertyNamespace(ns_name); mNamespaces->push_back(ns); } @@ -77,7 +77,7 @@ int PropertyManager::attachProperty(const char *ns_name, Property *p) { if (lookupProperty_UNLOCKED(ns, p->getName())) { errno = EADDRINUSE; pthread_mutex_unlock(&mLock); - LOGE("Failed to register property %s.%s (%s)", + ALOGE("Failed to register property %s.%s (%s)", ns_name, p->getName(), strerror(errno)); return -1; } @@ -90,11 +90,11 @@ int PropertyManager::attachProperty(const char *ns_name, Property *p) { int PropertyManager::detachProperty(const char *ns_name, Property *p) { PropertyNamespace *ns; - LOGD("Detaching property %s from namespace %s", p->getName(), ns_name); + ALOGD("Detaching property %s from namespace %s", p->getName(), ns_name); pthread_mutex_lock(&mLock); if (!(ns = lookupNamespace_UNLOCKED(ns_name))) { pthread_mutex_unlock(&mLock); - LOGE("Namespace '%s' not found", ns_name); + ALOGE("Namespace '%s' not found", ns_name); return -1; } @@ -110,7 +110,7 @@ int PropertyManager::detachProperty(const char *ns_name, Property *p) { } } - LOGE("Property %s.%s not found", ns_name, p->getName()); + ALOGE("Property %s.%s not found", ns_name, p->getName()); pthread_mutex_unlock(&mLock); errno = ENOENT; return -1; @@ -130,7 +130,7 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) { errno = 0; tmp = strtol(value, (char **) NULL, 10); if (errno) { - LOGE("Failed to convert '%s' to int", value); + ALOGE("Failed to convert '%s' to int", value); errno = EINVAL; return -1; } @@ -138,13 +138,13 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) { } else if (p->getType() == Property::Type_IPV4) { struct in_addr tmp; if (!inet_aton(value, &tmp)) { - LOGE("Failed to convert '%s' to ipv4", value); + ALOGE("Failed to convert '%s' to ipv4", value); errno = EINVAL; return -1; } return p->set(idx, &tmp); } else { - LOGE("Property '%s' has an unknown type (%d)", p->getName(), + ALOGE("Property '%s' has an unknown type (%d)", p->getName(), p->getType()); errno = EINVAL; return -1; @@ -157,7 +157,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) { if (p->getType() == Property::Type_STRING) { if (p->get(idx, buffer, max)) { - LOGW("String property %s get failed (%s)", p->getName(), + ALOGW("String property %s get failed (%s)", p->getName(), strerror(errno)); return -1; } @@ -165,7 +165,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) { else if (p->getType() == Property::Type_INTEGER) { int tmp; if (p->get(idx, &tmp)) { - LOGW("Integer property %s get failed (%s)", p->getName(), + ALOGW("Integer property %s get failed (%s)", p->getName(), strerror(errno)); return -1; } @@ -173,13 +173,13 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) { } else if (p->getType() == Property::Type_IPV4) { struct in_addr tmp; if (p->get(idx, &tmp)) { - LOGW("IPV4 property %s get failed (%s)", p->getName(), + ALOGW("IPV4 property %s get failed (%s)", p->getName(), strerror(errno)); return -1; } strncpy(buffer, inet_ntoa(tmp), max); } else { - LOGE("Property '%s' has an unknown type (%d)", p->getName(), + ALOGE("Property '%s' has an unknown type (%d)", p->getName(), p->getType()); errno = EINVAL; return -1; @@ -193,7 +193,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) { int PropertyManager::set(const char *name, const char *value) { - LOGD("set %s = '%s'", name, value); + ALOGD("set %s = '%s'", name, value); pthread_mutex_lock(&mLock); PropertyNamespaceCollection::iterator ns_it; for (ns_it = mNamespaces->begin(); ns_it != mNamespaces->end(); ++ns_it) { @@ -215,7 +215,7 @@ int PropertyManager::set(const char *name, const char *value) { } } - LOGE("Property %s not found", name); + ALOGE("Property %s not found", name); pthread_mutex_unlock(&mLock); errno = ENOENT; return -1; @@ -246,7 +246,7 @@ const char *PropertyManager::get(const char *name, char *buffer, size_t max) { } } - LOGE("Property %s not found", name); + ALOGE("Property %s not found", name); pthread_mutex_unlock(&mLock); errno = ENOENT; return NULL; diff --git a/nexus/ScanResult.cpp b/nexus/ScanResult.cpp index e9a286c3d..72cb16401 100644 --- a/nexus/ScanResult.cpp +++ b/nexus/ScanResult.cpp @@ -74,7 +74,7 @@ ScanResult::ScanResult(char *rawResult) { return; out_bad: - LOGW("Malformatted scan result (%s)", rawResult); + ALOGW("Malformatted scan result (%s)", rawResult); } ScanResult::~ScanResult() { diff --git a/nexus/Supplicant.cpp b/nexus/Supplicant.cpp index 6aa36e875..b604698ef 100644 --- a/nexus/Supplicant.cpp +++ b/nexus/Supplicant.cpp @@ -64,22 +64,22 @@ Supplicant::~Supplicant() { int Supplicant::start() { if (setupConfig()) { - LOGW("Unable to setup supplicant.conf"); + ALOGW("Unable to setup supplicant.conf"); } if (mServiceManager->start(SUPPLICANT_SERVICE_NAME)) { - LOGE("Error starting supplicant (%s)", strerror(errno)); + ALOGE("Error starting supplicant (%s)", strerror(errno)); return -1; } wpa_ctrl_cleanup(); if (connectToSupplicant()) { - LOGE("Error connecting to supplicant (%s)\n", strerror(errno)); + ALOGE("Error connecting to supplicant (%s)\n", strerror(errno)); return -1; } if (retrieveInterfaceName()) { - LOGE("Error retrieving interface name (%s)\n", strerror(errno)); + ALOGE("Error retrieving interface name (%s)\n", strerror(errno)); return -1; } @@ -89,12 +89,12 @@ int Supplicant::start() { int Supplicant::stop() { if (mListener->stopListener()) { - LOGW("Unable to stop supplicant listener (%s)", strerror(errno)); + ALOGW("Unable to stop supplicant listener (%s)", strerror(errno)); return -1; } if (mServiceManager->stop(SUPPLICANT_SERVICE_NAME)) { - LOGW("Error stopping supplicant (%s)", strerror(errno)); + ALOGW("Error stopping supplicant (%s)", strerror(errno)); } if (mCtrl) { @@ -120,7 +120,7 @@ int Supplicant::sendCommand(const char *cmd, char *reply, size_t *reply_len) { return -1; } -// LOGD("sendCommand(): -> '%s'", cmd); +// ALOGD("sendCommand(): -> '%s'", cmd); int rc; memset(reply, 0, *reply_len); @@ -133,7 +133,7 @@ int Supplicant::sendCommand(const char *cmd, char *reply, size_t *reply_len) { return -1; } - // LOGD("sendCommand(): <- '%s'", reply); + // ALOGD("sendCommand(): <- '%s'", reply); return 0; } SupplicantStatus *Supplicant::getStatus() { @@ -178,7 +178,7 @@ int Supplicant::refreshNetworkList() { char *linep_next = NULL; if (!strtok_r(reply, "\n", &linep_next)) { - LOGW("Malformatted network list\n"); + ALOGW("Malformatted network list\n"); free(reply); errno = EIO; return -1; @@ -199,7 +199,7 @@ int Supplicant::refreshNetworkList() { if ((merge_wn = this->lookupNetwork_UNLOCKED(new_wn->getNetworkId()))) { num_refreshed++; if (merge_wn->refresh()) { - LOGW("Error refreshing network %d (%s)", + ALOGW("Error refreshing network %d (%s)", merge_wn->getNetworkId(), strerror(errno)); } delete new_wn; @@ -210,7 +210,7 @@ int Supplicant::refreshNetworkList() { new_wn->attachProperties(pm, new_ns); mNetworks->push_back(new_wn); if (new_wn->refresh()) { - LOGW("Unable to refresh network id %d (%s)", + ALOGW("Unable to refresh network id %d (%s)", new_wn->getNetworkId(), strerror(errno)); } } @@ -233,7 +233,7 @@ int Supplicant::refreshNetworkList() { } - LOGD("Networks added %d, refreshed %d, removed %d\n", + ALOGD("Networks added %d, refreshed %d, removed %d\n", num_added, num_refreshed, num_removed); pthread_mutex_unlock(&mNetworksLock); @@ -243,11 +243,11 @@ int Supplicant::refreshNetworkList() { int Supplicant::connectToSupplicant() { if (!isStarted()) - LOGW("Supplicant service not running"); + ALOGW("Supplicant service not running"); mCtrl = wpa_ctrl_open("tiwlan0"); // XXX: if (mCtrl == NULL) { - LOGE("Unable to open connection to supplicant on \"%s\": %s", + ALOGE("Unable to open connection to supplicant on \"%s\": %s", "tiwlan0", strerror(errno)); return -1; } @@ -267,7 +267,7 @@ int Supplicant::connectToSupplicant() { mListener = new SupplicantListener(mHandlers, mMonitor); if (mListener->startListener()) { - LOGE("Error - unable to start supplicant listener"); + ALOGE("Error - unable to start supplicant listener"); stop(); return -1; } @@ -280,7 +280,7 @@ int Supplicant::setScanMode(bool active) { if (sendCommand((active ? "DRIVER SCAN-ACTIVE" : "DRIVER SCAN-PASSIVE"), reply, &len)) { - LOGW("triggerScan(%d): Error setting scan mode (%s)", active, + ALOGW("triggerScan(%d): Error setting scan mode (%s)", active, strerror(errno)); return -1; } @@ -292,7 +292,7 @@ int Supplicant::triggerScan() { size_t len = sizeof(reply); if (sendCommand("SCAN", reply, &len)) { - LOGW("triggerScan(): Error initiating scan"); + ALOGW("triggerScan(): Error initiating scan"); return -1; } return 0; @@ -303,7 +303,7 @@ int Supplicant::getRssi(int *buffer) { size_t len = sizeof(reply); if (sendCommand("DRIVER RSSI", reply, &len)) { - LOGW("Failed to get RSSI (%s)", strerror(errno)); + ALOGW("Failed to get RSSI (%s)", strerror(errno)); return -1; } @@ -311,7 +311,7 @@ int Supplicant::getRssi(int *buffer) { char *s; for (int i = 0; i < 3; i++) { if (!(s = strsep(&next, " "))) { - LOGE("Error parsing RSSI"); + ALOGE("Error parsing RSSI"); errno = EIO; return -1; } @@ -325,7 +325,7 @@ int Supplicant::getLinkSpeed() { size_t len = sizeof(reply); if (sendCommand("DRIVER LINKSPEED", reply, &len)) { - LOGW("Failed to get LINKSPEED (%s)", strerror(errno)); + ALOGW("Failed to get LINKSPEED (%s)", strerror(errno)); return -1; } @@ -333,13 +333,13 @@ int Supplicant::getLinkSpeed() { char *s; if (!(s = strsep(&next, " "))) { - LOGE("Error parsing LINKSPEED"); + ALOGE("Error parsing LINKSPEED"); errno = EIO; return -1; } if (!(s = strsep(&next, " "))) { - LOGE("Error parsing LINKSPEED"); + ALOGE("Error parsing LINKSPEED"); errno = EIO; return -1; } @@ -350,10 +350,10 @@ int Supplicant::stopDriver() { char reply[64]; size_t len = sizeof(reply); - LOGD("stopDriver()"); + ALOGD("stopDriver()"); if (sendCommand("DRIVER STOP", reply, &len)) { - LOGW("Failed to stop driver (%s)", strerror(errno)); + ALOGW("Failed to stop driver (%s)", strerror(errno)); return -1; } return 0; @@ -363,9 +363,9 @@ int Supplicant::startDriver() { char reply[64]; size_t len = sizeof(reply); - LOGD("startDriver()"); + ALOGD("startDriver()"); if (sendCommand("DRIVER START", reply, &len)) { - LOGW("Failed to start driver (%s)", strerror(errno)); + ALOGW("Failed to start driver (%s)", strerror(errno)); return -1; } return 0; @@ -452,26 +452,26 @@ int Supplicant::setupConfig() { if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) { return 0; } else if (errno != ENOENT) { - LOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno)); + ALOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno)); return -1; } srcfd = open(SUPP_CONFIG_TEMPLATE, O_RDONLY); if (srcfd < 0) { - LOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); + ALOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); return -1; } destfd = open(SUPP_CONFIG_FILE, O_CREAT|O_WRONLY, 0660); if (destfd < 0) { close(srcfd); - LOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno)); + ALOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno)); return -1; } while ((nread = read(srcfd, buf, sizeof(buf))) != 0) { if (nread < 0) { - LOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); + ALOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); close(srcfd); close(destfd); unlink(SUPP_CONFIG_FILE); @@ -484,7 +484,7 @@ int Supplicant::setupConfig() { close(srcfd); if (chown(SUPP_CONFIG_FILE, AID_SYSTEM, AID_WIFI) < 0) { - LOGE("Error changing group ownership of %s to %d: %s", + ALOGE("Error changing group ownership of %s to %d: %s", SUPP_CONFIG_FILE, AID_WIFI, strerror(errno)); unlink(SUPP_CONFIG_FILE); return -1; @@ -496,7 +496,7 @@ int Supplicant::setNetworkVar(int networkId, const char *var, const char *val) { char reply[255]; size_t len = sizeof(reply) -1; - LOGD("netid %d, var '%s' = '%s'", networkId, var, val); + ALOGD("netid %d, var '%s' = '%s'", networkId, var, val); char *tmp; asprintf(&tmp, "SET_NETWORK %d %s %s", networkId, var, val); if (sendCommand(tmp, reply, &len)) { @@ -507,7 +507,7 @@ int Supplicant::setNetworkVar(int networkId, const char *var, const char *val) { len = sizeof(reply) -1; if (sendCommand("SAVE_CONFIG", reply, &len)) { - LOGE("Error saving config after %s = %s", var, val); + ALOGE("Error saving config after %s = %s", var, val); return -1; } return 0; @@ -621,7 +621,7 @@ int Supplicant::setBluetoothCoexistenceMode(int mode) { int Supplicant::setApScanMode(int mode) { char req[64]; -// LOGD("setApScanMode(%d)", mode); +// ALOGD("setApScanMode(%d)", mode); sprintf(req, "AP_SCAN %d", mode); char reply[16]; diff --git a/nexus/SupplicantAssociatingEvent.cpp b/nexus/SupplicantAssociatingEvent.cpp index c6e9fe338..8fe502ee4 100644 --- a/nexus/SupplicantAssociatingEvent.cpp +++ b/nexus/SupplicantAssociatingEvent.cpp @@ -46,7 +46,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event, // p char *q = index(p, '\''); if (!q) { - LOGE("Unable to decode SSID (p = {%s})\n", p); + ALOGE("Unable to decode SSID (p = {%s})\n", p); return; } mSsid = (char *) malloc((q - p) +1); @@ -59,7 +59,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event, // ^ // p if (!(q = index(p, ' '))) { - LOGE("Unable to decode frequency\n"); + ALOGE("Unable to decode frequency\n"); return; } *q = '\0'; @@ -73,7 +73,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event, char *q = index(p, '\''); if (!q) { - LOGE("Unable to decode SSID (p = {%s})\n", p); + ALOGE("Unable to decode SSID (p = {%s})\n", p); return; } mSsid = (char *) malloc((q - p) +1); diff --git a/nexus/SupplicantConnectedEvent.cpp b/nexus/SupplicantConnectedEvent.cpp index e58bab22e..107c76682 100644 --- a/nexus/SupplicantConnectedEvent.cpp +++ b/nexus/SupplicantConnectedEvent.cpp @@ -42,9 +42,9 @@ SupplicantConnectedEvent::SupplicantConnectedEvent(int level, char *event, else mReassociated = true; } else - LOGE("Unable to decode re-assocation"); + ALOGE("Unable to decode re-assocation"); } else - LOGE("Unable to decode event"); + ALOGE("Unable to decode event"); } SupplicantConnectedEvent::SupplicantConnectedEvent(const char *bssid, diff --git a/nexus/SupplicantEventFactory.cpp b/nexus/SupplicantEventFactory.cpp index 8695aca19..f91db158a 100644 --- a/nexus/SupplicantEventFactory.cpp +++ b/nexus/SupplicantEventFactory.cpp @@ -57,9 +57,9 @@ SupplicantEvent *SupplicantEventFactory::createEvent(char *event, size_t len) { level = atoi(tmp); event += (match - event) + 1; } else - LOGW("Unclosed level brace in event"); + ALOGW("Unclosed level brace in event"); } else - LOGW("No level specified in event"); + ALOGW("No level specified in event"); /* * <N>CTRL-EVENT-XXX diff --git a/nexus/SupplicantListener.cpp b/nexus/SupplicantListener.cpp index b91fc02db..421d84d0f 100644 --- a/nexus/SupplicantListener.cpp +++ b/nexus/SupplicantListener.cpp @@ -48,13 +48,13 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) { size_t nread = buflen - 1; if ((rc = wpa_ctrl_recv(mMonitor, buf, &nread))) { - LOGE("wpa_ctrl_recv failed (%s)", strerror(errno)); + ALOGE("wpa_ctrl_recv failed (%s)", strerror(errno)); return false; } buf[nread] = '\0'; if (!rc && !nread) { - LOGD("Received EOF on supplicant socket\n"); + ALOGD("Received EOF on supplicant socket\n"); strncpy(buf, WPA_EVENT_TERMINATING " - signal 0 received", buflen-1); buf[buflen-1] = '\0'; return false; @@ -63,7 +63,7 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) { SupplicantEvent *evt = mFactory->createEvent(buf, nread); if (!evt) { - LOGW("Dropping unknown supplicant event '%s'", buf); + ALOGW("Dropping unknown supplicant event '%s'", buf); return true; } @@ -83,7 +83,7 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) { else if (evt->getType() == SupplicantEvent::EVENT_DISCONNECTED) mHandlers->onDisconnectedEvent((SupplicantDisconnectedEvent *) evt); else - LOGW("Whoops - no handler available for event '%s'\n", buf); + ALOGW("Whoops - no handler available for event '%s'\n", buf); #if 0 else if (evt->getType() == SupplicantEvent::EVENT_TERMINATING) mHandlers->onTerminatingEvent(evt); diff --git a/nexus/SupplicantStateChangeEvent.cpp b/nexus/SupplicantStateChangeEvent.cpp index cf0b9daa6..fd9233a49 100644 --- a/nexus/SupplicantStateChangeEvent.cpp +++ b/nexus/SupplicantStateChangeEvent.cpp @@ -28,7 +28,7 @@ SupplicantStateChangeEvent::SupplicantStateChangeEvent(int level, char *event, // XXX: move this stuff into a static creation method char *p = index(event, ' '); if (!p) { - LOGW("Bad event '%s'\n", event); + ALOGW("Bad event '%s'\n", event); return; } diff --git a/nexus/SupplicantStatus.cpp b/nexus/SupplicantStatus.cpp index b3c560a81..8f28abe2f 100644 --- a/nexus/SupplicantStatus.cpp +++ b/nexus/SupplicantStatus.cpp @@ -81,9 +81,9 @@ SupplicantStatus *SupplicantStatus::createStatus(char *data, int len) { else if (!strcmp(value, "IDLE")) state = SupplicantState::IDLE; else - LOGE("Unknown supplicant state '%s'", value); + ALOGE("Unknown supplicant state '%s'", value); } else - LOGD("Ignoring unsupported status token '%s'", token); + ALOGD("Ignoring unsupported status token '%s'", token); } return new SupplicantStatus(state, id, bssid, ssid); diff --git a/nexus/TiwlanEventListener.cpp b/nexus/TiwlanEventListener.cpp index 15e693017..fde3a44d2 100644 --- a/nexus/TiwlanEventListener.cpp +++ b/nexus/TiwlanEventListener.cpp @@ -33,25 +33,25 @@ bool TiwlanEventListener::onDataAvailable(SocketClient *cli) { struct ipc_ev_data *data; if (!(data = (struct ipc_ev_data *) malloc(sizeof(struct ipc_ev_data)))) { - LOGE("Failed to allocate packet (out of memory)"); + ALOGE("Failed to allocate packet (out of memory)"); return true; } if (recv(cli->getSocket(), data, sizeof(struct ipc_ev_data), 0) < 0) { - LOGE("recv failed (%s)", strerror(errno)); + ALOGE("recv failed (%s)", strerror(errno)); goto out; } if (data->event_type == IPC_EVENT_LINK_SPEED) { uint32_t *spd = (uint32_t *) data->buffer; *spd /= 2; -// LOGD("Link speed = %u MB/s", *spd); +// ALOGD("Link speed = %u MB/s", *spd); } else if (data->event_type == IPC_EVENT_LOW_SNR) { - LOGW("Low signal/noise ratio"); + ALOGW("Low signal/noise ratio"); } else if (data->event_type == IPC_EVENT_LOW_RSSI) { - LOGW("Low RSSI"); + ALOGW("Low RSSI"); } else { -// LOGD("Dropping unhandled driver event %d", data->event_type); +// ALOGD("Dropping unhandled driver event %d", data->event_type); } // TODO: Tell WifiController about the event diff --git a/nexus/TiwlanWifiController.cpp b/nexus/TiwlanWifiController.cpp index 016c79074..76b6a2edf 100644 --- a/nexus/TiwlanWifiController.cpp +++ b/nexus/TiwlanWifiController.cpp @@ -75,23 +75,23 @@ int TiwlanWifiController::loadFirmware() { while (count-- > 0) { if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) { if (!strcmp(driver_status, "ok")) { - LOGD("Firmware loaded OK"); + ALOGD("Firmware loaded OK"); if (startDriverEventListener()) { - LOGW("Failed to start driver event listener (%s)", + ALOGW("Failed to start driver event listener (%s)", strerror(errno)); } return 0; } else if (!strcmp(DRIVER_PROP_NAME, "failed")) { - LOGE("Firmware load failed"); + ALOGE("Firmware load failed"); return -1; } } usleep(200000); } property_set(DRIVER_PROP_NAME, "timeout"); - LOGE("Firmware load timed out"); + ALOGE("Firmware load timed out"); return -1; } @@ -99,13 +99,13 @@ int TiwlanWifiController::startDriverEventListener() { struct sockaddr_in addr; if (mListenerSock != -1) { - LOGE("Listener already started!"); + ALOGE("Listener already started!"); errno = EBUSY; return -1; } if ((mListenerSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - LOGE("socket failed (%s)", strerror(errno)); + ALOGE("socket failed (%s)", strerror(errno)); return -1; } @@ -117,14 +117,14 @@ int TiwlanWifiController::startDriverEventListener() { if (bind(mListenerSock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - LOGE("bind failed (%s)", strerror(errno)); + ALOGE("bind failed (%s)", strerror(errno)); goto out_err; } mEventListener = new TiwlanEventListener(mListenerSock); if (mEventListener->startListener()) { - LOGE("Error starting driver listener (%s)", strerror(errno)); + ALOGE("Error starting driver listener (%s)", strerror(errno)); goto out_err; } return 0; diff --git a/nexus/WifiController.cpp b/nexus/WifiController.cpp index c218c30ad..cedd01387 100644 --- a/nexus/WifiController.cpp +++ b/nexus/WifiController.cpp @@ -108,50 +108,50 @@ int WifiController::stop() { int WifiController::enable() { if (!isPoweredUp()) { - LOGI("Powering up"); + ALOGI("Powering up"); sendStatusBroadcast("Powering up WiFi hardware"); if (powerUp()) { - LOGE("Powerup failed (%s)", strerror(errno)); + ALOGE("Powerup failed (%s)", strerror(errno)); return -1; } } if (mModuleName[0] != '\0' && !isKernelModuleLoaded(mModuleName)) { - LOGI("Loading driver"); + ALOGI("Loading driver"); sendStatusBroadcast("Loading WiFi driver"); if (loadKernelModule(mModulePath, mModuleArgs)) { - LOGE("Kernel module load failed (%s)", strerror(errno)); + ALOGE("Kernel module load failed (%s)", strerror(errno)); goto out_powerdown; } } if (!isFirmwareLoaded()) { - LOGI("Loading firmware"); + ALOGI("Loading firmware"); sendStatusBroadcast("Loading WiFI firmware"); if (loadFirmware()) { - LOGE("Firmware load failed (%s)", strerror(errno)); + ALOGE("Firmware load failed (%s)", strerror(errno)); goto out_powerdown; } } if (!mSupplicant->isStarted()) { - LOGI("Starting WPA Supplicant"); + ALOGI("Starting WPA Supplicant"); sendStatusBroadcast("Starting WPA Supplicant"); if (mSupplicant->start()) { - LOGE("Supplicant start failed (%s)", strerror(errno)); + ALOGE("Supplicant start failed (%s)", strerror(errno)); goto out_unloadmodule; } } if (Controller::bindInterface(mSupplicant->getInterfaceName())) { - LOGE("Error binding interface (%s)", strerror(errno)); + ALOGE("Error binding interface (%s)", strerror(errno)); goto out_unloadmodule; } if (mSupplicant->refreshNetworkList()) - LOGW("Error getting list of networks (%s)", strerror(errno)); + ALOGW("Error getting list of networks (%s)", strerror(errno)); - LOGW("TODO: Set # of allowed regulatory channels!"); + ALOGW("TODO: Set # of allowed regulatory channels!"); mPropMngr->attachProperty("wifi", mDynamicProperties.propSupplicantState); mPropMngr->attachProperty("wifi", mDynamicProperties.propActiveScan); @@ -167,19 +167,19 @@ int WifiController::enable() { mPropMngr->attachProperty("wifi", mDynamicProperties.propNetCount); mPropMngr->attachProperty("wifi", mDynamicProperties.propTriggerScan); - LOGI("Enabled successfully"); + ALOGI("Enabled successfully"); return 0; out_unloadmodule: if (mModuleName[0] != '\0' && !isKernelModuleLoaded(mModuleName)) { if (unloadKernelModule(mModuleName)) { - LOGE("Unable to unload module after failure!"); + ALOGE("Unable to unload module after failure!"); } } out_powerdown: if (powerDown()) { - LOGE("Unable to powerdown after failure!"); + ALOGE("Unable to powerdown after failure!"); } return -1; } @@ -195,7 +195,7 @@ int WifiController::setSuspend(bool suspend) { pthread_mutex_lock(&mLock); if (suspend == mSuspended) { - LOGW("Suspended state already = %d", suspend); + ALOGW("Suspended state already = %d", suspend); pthread_mutex_unlock(&mLock); return 0; } @@ -204,29 +204,29 @@ int WifiController::setSuspend(bool suspend) { mHandlers->onControllerSuspending(this); char tmp[80]; - LOGD("Suspending from supplicant state %s", + ALOGD("Suspending from supplicant state %s", SupplicantState::toString(mSupplicantState, tmp, sizeof(tmp))); if (mSupplicantState != SupplicantState::IDLE) { - LOGD("Forcing Supplicant disconnect"); + ALOGD("Forcing Supplicant disconnect"); if (mSupplicant->disconnect()) { - LOGW("Error disconnecting (%s)", strerror(errno)); + ALOGW("Error disconnecting (%s)", strerror(errno)); } } - LOGD("Stopping Supplicant driver"); + ALOGD("Stopping Supplicant driver"); if (mSupplicant->stopDriver()) { - LOGE("Error stopping driver (%s)", strerror(errno)); + ALOGE("Error stopping driver (%s)", strerror(errno)); pthread_mutex_unlock(&mLock); return -1; } } else { - LOGD("Resuming"); + ALOGD("Resuming"); if (mSupplicant->startDriver()) { - LOGE("Error resuming driver (%s)", strerror(errno)); + ALOGE("Error resuming driver (%s)", strerror(errno)); pthread_mutex_unlock(&mLock); return -1; } @@ -241,7 +241,7 @@ int WifiController::setSuspend(bool suspend) { mSuspended = suspend; pthread_mutex_unlock(&mLock); - LOGD("Suspend / Resume completed"); + ALOGD("Suspend / Resume completed"); return 0; } @@ -269,16 +269,16 @@ int WifiController::disable() { if (mSupplicant->isStarted()) { sendStatusBroadcast("Stopping WPA Supplicant"); if (mSupplicant->stop()) { - LOGE("Supplicant stop failed (%s)", strerror(errno)); + ALOGE("Supplicant stop failed (%s)", strerror(errno)); return -1; } } else - LOGW("disable(): Supplicant not running?"); + ALOGW("disable(): Supplicant not running?"); if (mModuleName[0] != '\0' && isKernelModuleLoaded(mModuleName)) { sendStatusBroadcast("Unloading WiFi driver"); if (unloadKernelModule(mModuleName)) { - LOGE("Unable to unload module (%s)", strerror(errno)); + ALOGE("Unable to unload module (%s)", strerror(errno)); return -1; } } @@ -286,7 +286,7 @@ int WifiController::disable() { if (isPoweredUp()) { sendStatusBroadcast("Powering down WiFi hardware"); if (powerDown()) { - LOGE("Powerdown failed (%s)", strerror(errno)); + ALOGE("Powerdown failed (%s)", strerror(errno)); return -1; } } @@ -426,38 +426,38 @@ int WifiController::setBluetoothCoexistenceMode(int mode) { } void WifiController::onAssociatingEvent(SupplicantAssociatingEvent *evt) { - LOGD("onAssociatingEvent(%s, %s, %d)", + ALOGD("onAssociatingEvent(%s, %s, %d)", (evt->getBssid() ? evt->getBssid() : "n/a"), (evt->getSsid() ? evt->getSsid() : "n/a"), evt->getFreq()); } void WifiController::onAssociatedEvent(SupplicantAssociatedEvent *evt) { - LOGD("onAssociatedEvent(%s)", evt->getBssid()); + ALOGD("onAssociatedEvent(%s)", evt->getBssid()); } void WifiController::onConnectedEvent(SupplicantConnectedEvent *evt) { - LOGD("onConnectedEvent(%s, %d)", evt->getBssid(), evt->getReassociated()); + ALOGD("onConnectedEvent(%s, %d)", evt->getBssid(), evt->getReassociated()); SupplicantStatus *ss = mSupplicant->getStatus(); WifiNetwork *wn; if (ss->getWpaState() != SupplicantState::COMPLETED) { char tmp[32]; - LOGW("onConnected() with SupplicantState = %s!", + ALOGW("onConnected() with SupplicantState = %s!", SupplicantState::toString(ss->getWpaState(), tmp, sizeof(tmp))); return; } if (ss->getId() == -1) { - LOGW("onConnected() with id = -1!"); + ALOGW("onConnected() with id = -1!"); return; } mCurrentlyConnectedNetworkId = ss->getId(); if (!(wn = mSupplicant->lookupNetwork(ss->getId()))) { - LOGW("Error looking up connected network id %d (%s)", + ALOGW("Error looking up connected network id %d (%s)", ss->getId(), strerror(errno)); return; } @@ -470,7 +470,7 @@ void WifiController::onScanResultsEvent(SupplicantScanResultsEvent *evt) { char *reply; if (!(reply = (char *) malloc(4096))) { - LOGE("Out of memory"); + ALOGE("Out of memory"); return; } @@ -481,7 +481,7 @@ void WifiController::onScanResultsEvent(SupplicantScanResultsEvent *evt) { size_t len = 4096; if (mSupplicant->sendCommand("SCAN_RESULTS", reply, &len)) { - LOGW("onScanResultsEvent: Error getting scan results (%s)", + ALOGW("onScanResultsEvent: Error getting scan results (%s)", strerror(errno)); free(reply); return; @@ -530,7 +530,7 @@ void WifiController::onStateChangeEvent(SupplicantStateChangeEvent *evt) { if (evt->getState() == mSupplicantState) return; - LOGD("onStateChangeEvent(%s -> %s)", + ALOGD("onStateChangeEvent(%s -> %s)", SupplicantState::toString(mSupplicantState, tmp, sizeof(tmp)), SupplicantState::toString(evt->getState(), tmp2, sizeof(tmp2))); @@ -559,7 +559,7 @@ void WifiController::onStateChangeEvent(SupplicantStateChangeEvent *evt) { } void WifiController::onConnectionTimeoutEvent(SupplicantConnectionTimeoutEvent *evt) { - LOGD("onConnectionTimeoutEvent(%s)", evt->getBssid()); + ALOGD("onConnectionTimeoutEvent(%s)", evt->getBssid()); } void WifiController::onDisconnectedEvent(SupplicantDisconnectedEvent *evt) { @@ -569,39 +569,39 @@ void WifiController::onDisconnectedEvent(SupplicantDisconnectedEvent *evt) { #if 0 void WifiController::onTerminatingEvent(SupplicantEvent *evt) { - LOGD("onTerminatingEvent(%s)", evt->getEvent()); + ALOGD("onTerminatingEvent(%s)", evt->getEvent()); } void WifiController::onPasswordChangedEvent(SupplicantEvent *evt) { - LOGD("onPasswordChangedEvent(%s)", evt->getEvent()); + ALOGD("onPasswordChangedEvent(%s)", evt->getEvent()); } void WifiController::onEapNotificationEvent(SupplicantEvent *evt) { - LOGD("onEapNotificationEvent(%s)", evt->getEvent()); + ALOGD("onEapNotificationEvent(%s)", evt->getEvent()); } void WifiController::onEapStartedEvent(SupplicantEvent *evt) { - LOGD("onEapStartedEvent(%s)", evt->getEvent()); + ALOGD("onEapStartedEvent(%s)", evt->getEvent()); } void WifiController::onEapMethodEvent(SupplicantEvent *evt) { - LOGD("onEapMethodEvent(%s)", evt->getEvent()); + ALOGD("onEapMethodEvent(%s)", evt->getEvent()); } void WifiController::onEapSuccessEvent(SupplicantEvent *evt) { - LOGD("onEapSuccessEvent(%s)", evt->getEvent()); + ALOGD("onEapSuccessEvent(%s)", evt->getEvent()); } void WifiController::onEapFailureEvent(SupplicantEvent *evt) { - LOGD("onEapFailureEvent(%s)", evt->getEvent()); + ALOGD("onEapFailureEvent(%s)", evt->getEvent()); } void WifiController::onLinkSpeedEvent(SupplicantEvent *evt) { - LOGD("onLinkSpeedEvent(%s)", evt->getEvent()); + ALOGD("onLinkSpeedEvent(%s)", evt->getEvent()); } void WifiController::onDriverStateEvent(SupplicantEvent *evt) { - LOGD("onDriverStateEvent(%s)", evt->getEvent()); + ALOGD("onDriverStateEvent(%s)", evt->getEvent()); } #endif @@ -609,7 +609,7 @@ void WifiController::onStatusPollInterval() { pthread_mutex_lock(&mLock); int rssi; if (mSupplicant->getRssi(&rssi)) { - LOGE("Failed to get rssi (%s)", strerror(errno)); + ALOGE("Failed to get rssi (%s)", strerror(errno)); pthread_mutex_unlock(&mLock); return; } diff --git a/nexus/WifiNetwork.cpp b/nexus/WifiNetwork.cpp index 6a0f6840b..0197b642d 100644 --- a/nexus/WifiNetwork.cpp +++ b/nexus/WifiNetwork.cpp @@ -43,15 +43,15 @@ WifiNetwork::WifiNetwork(WifiController *c, Supplicant *suppl, const char *data) char *flags; if (!(id = strsep(&next, "\t"))) - LOGE("Failed to extract network id"); + ALOGE("Failed to extract network id"); if (!(ssid = strsep(&next, "\t"))) - LOGE("Failed to extract ssid"); + ALOGE("Failed to extract ssid"); if (!(bssid = strsep(&next, "\t"))) - LOGE("Failed to extract bssid"); + ALOGE("Failed to extract bssid"); if (!(flags = strsep(&next, "\t"))) - LOGE("Failed to extract flags"); + ALOGE("Failed to extract flags"); - // LOGD("id '%s', ssid '%s', bssid '%s', flags '%s'", id, ssid, bssid, + // ALOGD("id '%s', ssid '%s', bssid '%s', flags '%s'", id, ssid, bssid, // flags ? flags :"null"); if (id) @@ -77,7 +77,7 @@ WifiNetwork::WifiNetwork(WifiController *c, Supplicant *suppl, const char *data) if (!strcmp(flags, "[DISABLED]")) mEnabled = false; else - LOGW("Unsupported flags '%s'", flags); + ALOGW("Unsupported flags '%s'", flags); } free(tmp); @@ -215,7 +215,7 @@ int WifiNetwork::refresh() { len = sizeof(buffer); if (mSuppl->getNetworkVar(mNetid, "key_mgmt", buffer, len)) { if (WifiNetwork::parseKeyManagementMask(buffer, &mask)) { - LOGE("Error parsing key_mgmt (%s)", strerror(errno)); + ALOGE("Error parsing key_mgmt (%s)", strerror(errno)); } else { mKeyManagement = mask; } @@ -224,7 +224,7 @@ int WifiNetwork::refresh() { len = sizeof(buffer); if (mSuppl->getNetworkVar(mNetid, "proto", buffer, len)) { if (WifiNetwork::parseProtocolsMask(buffer, &mask)) { - LOGE("Error parsing proto (%s)", strerror(errno)); + ALOGE("Error parsing proto (%s)", strerror(errno)); } else { mProtocols = mask; } @@ -233,7 +233,7 @@ int WifiNetwork::refresh() { len = sizeof(buffer); if (mSuppl->getNetworkVar(mNetid, "auth_alg", buffer, len)) { if (WifiNetwork::parseAuthAlgorithmsMask(buffer, &mask)) { - LOGE("Error parsing auth_alg (%s)", strerror(errno)); + ALOGE("Error parsing auth_alg (%s)", strerror(errno)); } else { mAuthAlgorithms = mask; } @@ -242,7 +242,7 @@ int WifiNetwork::refresh() { len = sizeof(buffer); if (mSuppl->getNetworkVar(mNetid, "pairwise", buffer, len)) { if (WifiNetwork::parsePairwiseCiphersMask(buffer, &mask)) { - LOGE("Error parsing pairwise (%s)", strerror(errno)); + ALOGE("Error parsing pairwise (%s)", strerror(errno)); } else { mPairwiseCiphers = mask; } @@ -251,7 +251,7 @@ int WifiNetwork::refresh() { len = sizeof(buffer); if (mSuppl->getNetworkVar(mNetid, "group", buffer, len)) { if (WifiNetwork::parseGroupCiphersMask(buffer, &mask)) { - LOGE("Error parsing group (%s)", strerror(errno)); + ALOGE("Error parsing group (%s)", strerror(errno)); } else { mGroupCiphers = mask; } @@ -259,7 +259,7 @@ int WifiNetwork::refresh() { return 0; out_err: - LOGE("Refresh failed (%s)",strerror(errno)); + ALOGE("Refresh failed (%s)",strerror(errno)); return -1; } @@ -453,12 +453,12 @@ int WifiNetwork::setEnabled(bool enabled) { if (enabled) { if (getPriority() == -1) { - LOGE("Cannot enable network when priority is not set"); + ALOGE("Cannot enable network when priority is not set"); errno = EAGAIN; return -1; } if (getKeyManagement() == KeyManagementMask::UNKNOWN) { - LOGE("Cannot enable network when KeyManagement is not set"); + ALOGE("Cannot enable network when KeyManagement is not set"); errno = EAGAIN; return -1; } @@ -511,7 +511,7 @@ int WifiNetwork::parseKeyManagementMask(const char *buffer, uint32_t *mask) { char *v_next = v_tmp; char *v_token; -// LOGD("parseKeyManagementMask(%s)", buffer); +// ALOGD("parseKeyManagementMask(%s)", buffer); *mask = 0; while((v_token = strsep(&v_next, " "))) { @@ -526,13 +526,13 @@ int WifiNetwork::parseKeyManagementMask(const char *buffer, uint32_t *mask) { else if (!strcasecmp(v_token, "IEEE8021X")) *mask |= KeyManagementMask::IEEE8021X; else { - LOGW("Invalid KeyManagementMask value '%s'", v_token); + ALOGW("Invalid KeyManagementMask value '%s'", v_token); errno = EINVAL; free(v_tmp); return -1; } } else { - LOGW("KeyManagementMask value '%s' when NONE", v_token); + ALOGW("KeyManagementMask value '%s' when NONE", v_token); errno = EINVAL; free(v_tmp); return -1; @@ -548,7 +548,7 @@ int WifiNetwork::parseProtocolsMask(const char *buffer, uint32_t *mask) { char *v_next = v_tmp; char *v_token; -// LOGD("parseProtocolsMask(%s)", buffer); +// ALOGD("parseProtocolsMask(%s)", buffer); *mask = 0; while((v_token = strsep(&v_next, " "))) { if (!strcasecmp(v_token, "WPA")) @@ -556,7 +556,7 @@ int WifiNetwork::parseProtocolsMask(const char *buffer, uint32_t *mask) { else if (!strcasecmp(v_token, "RSN")) *mask |= SecurityProtocolMask::RSN; else { - LOGW("Invalid ProtocolsMask value '%s'", v_token); + ALOGW("Invalid ProtocolsMask value '%s'", v_token); errno = EINVAL; free(v_tmp); return -1; @@ -573,7 +573,7 @@ int WifiNetwork::parseAuthAlgorithmsMask(const char *buffer, uint32_t *mask) { char *v_next = v_tmp; char *v_token; -// LOGD("parseAuthAlgorithmsMask(%s)", buffer); +// ALOGD("parseAuthAlgorithmsMask(%s)", buffer); *mask = 0; if (buffer[0] == '\0') @@ -587,7 +587,7 @@ int WifiNetwork::parseAuthAlgorithmsMask(const char *buffer, uint32_t *mask) { else if (!strcasecmp(v_token, "LEAP")) *mask |= AuthenticationAlgorithmMask::LEAP; else { - LOGW("Invalid AuthAlgorithmsMask value '%s'", v_token); + ALOGW("Invalid AuthAlgorithmsMask value '%s'", v_token); errno = EINVAL; free(v_tmp); return -1; @@ -603,7 +603,7 @@ int WifiNetwork::parsePairwiseCiphersMask(const char *buffer, uint32_t *mask) { char *v_next = v_tmp; char *v_token; -// LOGD("parsePairwiseCiphersMask(%s)", buffer); +// ALOGD("parsePairwiseCiphersMask(%s)", buffer); *mask = 0; while((v_token = strsep(&v_next, " "))) { @@ -616,13 +616,13 @@ int WifiNetwork::parsePairwiseCiphersMask(const char *buffer, uint32_t *mask) { else if (!strcasecmp(v_token, "CCMP")) *mask |= PairwiseCiphersMask::CCMP; else { - LOGW("PairwiseCiphersMask value '%s' when NONE", v_token); + ALOGW("PairwiseCiphersMask value '%s' when NONE", v_token); errno = EINVAL; free(v_tmp); return -1; } } else { - LOGW("Invalid PairwiseCiphersMask value '%s'", v_token); + ALOGW("Invalid PairwiseCiphersMask value '%s'", v_token); errno = EINVAL; free(v_tmp); return -1; @@ -638,7 +638,7 @@ int WifiNetwork::parseGroupCiphersMask(const char *buffer, uint32_t *mask) { char *v_next = v_tmp; char *v_token; -// LOGD("parseGroupCiphersMask(%s)", buffer); +// ALOGD("parseGroupCiphersMask(%s)", buffer); *mask = 0; while((v_token = strsep(&v_next, " "))) { @@ -651,7 +651,7 @@ int WifiNetwork::parseGroupCiphersMask(const char *buffer, uint32_t *mask) { else if (!strcasecmp(v_token, "CCMP")) *mask |= GroupCiphersMask::CCMP; else { - LOGW("Invalid GroupCiphersMask value '%s'", v_token); + ALOGW("Invalid GroupCiphersMask value '%s'", v_token); errno = EINVAL; free(v_tmp); return -1; diff --git a/nexus/WifiScanner.cpp b/nexus/WifiScanner.cpp index bdfa49752..4c956ac72 100644 --- a/nexus/WifiScanner.cpp +++ b/nexus/WifiScanner.cpp @@ -58,13 +58,13 @@ int WifiScanner::stop() { char c = 0; if (write(mCtrlPipe[1], &c, 1) != 1) { - LOGE("Error writing to control pipe (%s)", strerror(errno)); + ALOGE("Error writing to control pipe (%s)", strerror(errno)); return -1; } void *ret; if (pthread_join(mThread, &ret)) { - LOGE("Error joining to scanner thread (%s)", strerror(errno)); + ALOGE("Error joining to scanner thread (%s)", strerror(errno)); return -1; } @@ -74,7 +74,7 @@ int WifiScanner::stop() { } void WifiScanner::run() { - LOGD("Starting wifi scanner (active = %d)", mActive); + ALOGD("Starting wifi scanner (active = %d)", mActive); while(1) { fd_set read_fds; @@ -88,16 +88,16 @@ void WifiScanner::run() { FD_SET(mCtrlPipe[0], &read_fds); if (mSuppl->triggerScan(mActive)) { - LOGW("Error triggering scan (%s)", strerror(errno)); + ALOGW("Error triggering scan (%s)", strerror(errno)); } if ((rc = select(mCtrlPipe[0] + 1, &read_fds, NULL, NULL, &to)) < 0) { - LOGE("select failed (%s) - sleeping for one scanner period", strerror(errno)); + ALOGE("select failed (%s) - sleeping for one scanner period", strerror(errno)); sleep(mPeriod); continue; } else if (!rc) { } else if (FD_ISSET(mCtrlPipe[0], &read_fds)) break; } // while - LOGD("Stopping wifi scanner"); + ALOGD("Stopping wifi scanner"); } diff --git a/nexus/WifiStatusPoller.cpp b/nexus/WifiStatusPoller.cpp index cf717337e..015af5da7 100644 --- a/nexus/WifiStatusPoller.cpp +++ b/nexus/WifiStatusPoller.cpp @@ -50,13 +50,13 @@ int WifiStatusPoller::stop() { char c = 0; if (write(mCtrlPipe[1], &c, 1) != 1) { - LOGE("Error writing to control pipe (%s)", strerror(errno)); + ALOGE("Error writing to control pipe (%s)", strerror(errno)); return -1; } void *ret; if (pthread_join(mThread, &ret)) { - LOGE("Error joining to listener thread (%s)", strerror(errno)); + ALOGE("Error joining to listener thread (%s)", strerror(errno)); return -1; } close(mCtrlPipe[0]); @@ -68,10 +68,10 @@ void *WifiStatusPoller::threadStart(void *obj) { WifiStatusPoller *me = reinterpret_cast<WifiStatusPoller *>(obj); me->mStarted = true; - LOGD("Starting"); + ALOGD("Starting"); me->run(); me->mStarted = false; - LOGD("Stopping"); + ALOGD("Stopping"); pthread_exit(NULL); return NULL; } @@ -92,7 +92,7 @@ void WifiStatusPoller::run() { max = mCtrlPipe[0]; if ((rc = select(max + 1, &read_fds, NULL, NULL, &to)) < 0) { - LOGE("select failed (%s)", strerror(errno)); + ALOGE("select failed (%s)", strerror(errno)); sleep(1); continue; } else if (!rc) { diff --git a/nexus/main.cpp b/nexus/main.cpp index 936d33f65..7d2af02e8 100644 --- a/nexus/main.cpp +++ b/nexus/main.cpp @@ -28,13 +28,13 @@ #include "TiwlanWifiController.h" int main() { - LOGI("Nexus version 0.1 firing up"); + ALOGI("Nexus version 0.1 firing up"); CommandListener *cl = new CommandListener(); NetworkManager *nm; if (!(nm = NetworkManager::Instance())) { - LOGE("Unable to create NetworkManager"); + ALOGE("Unable to create NetworkManager"); exit (-1); }; @@ -47,12 +47,12 @@ int main() { if (NetworkManager::Instance()->run()) { - LOGE("Unable to Run NetworkManager (%s)", strerror(errno)); + ALOGE("Unable to Run NetworkManager (%s)", strerror(errno)); exit (1); } if (cl->startListener()) { - LOGE("Unable to start CommandListener (%s)", strerror(errno)); + ALOGE("Unable to start CommandListener (%s)", strerror(errno)); exit (1); } @@ -62,6 +62,6 @@ int main() { sleep(1000); } - LOGI("Nexus exiting"); + ALOGI("Nexus exiting"); exit(0); } diff --git a/rootdir/init.rc b/rootdir/init.rc index cad4cd868..290e37596 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -1,3 +1,5 @@ +import /init.${ro.hardware}.rc + on early-init # Set init and its forked children's oom_adj. write /proc/1/oom_adj -16 @@ -299,7 +301,7 @@ on property:sys.usb.config=none stop adbd write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/bDeviceClass 0 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} # adb only USB configuration # This should only be used during device bringup @@ -308,34 +310,34 @@ on property:sys.usb.config=adb write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18d1 write /sys/class/android_usb/android0/idProduct D002 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} # USB accessory configuration on property:sys.usb.config=accessory write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18d1 write /sys/class/android_usb/android0/idProduct 2d00 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} # USB accessory configuration, with adb on property:sys.usb.config=accessory,adb write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18d1 write /sys/class/android_usb/android0/idProduct 2d01 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} # Used to set USB configuration at boot and to switch the configuration # when changing the default configuration on property:persist.sys.usb.config=* - setprop sys.usb.config $persist.sys.usb.config + setprop sys.usb.config ${persist.sys.usb.config} ## Daemon processes to be run by init. ## diff --git a/toolbox/rmmod.c b/toolbox/rmmod.c index 7e10c061b..25257cc39 100644 --- a/toolbox/rmmod.c +++ b/toolbox/rmmod.c @@ -25,6 +25,8 @@ int rmmod_main(int argc, char **argv) modname = strrchr(argv[1], '/'); if (!modname) modname = argv[1]; + else modname++; + dot = strchr(argv[1], '.'); if (dot) *dot = '\0'; |