From 86105fb24919eca17e71a5ec820d75ac57bbdc65 Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Fri, 9 Sep 2016 13:48:15 -0700 Subject: Use libbase logging in libwifi_hal This allows log messages to appear with the global tag of the process using the code, rather than a tag per file. Bug: 31398942 Test: Compiles Change-Id: I90a696eb21764edf1a6430059bcd1903e50bf792 --- libwifi_hal/Android.mk | 3 ++- libwifi_hal/wifi_hal_common.cpp | 17 +++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'libwifi_hal') diff --git a/libwifi_hal/Android.mk b/libwifi_hal/Android.mk index 1ed59882f..14f529626 100644 --- a/libwifi_hal/Android.mk +++ b/libwifi_hal/Android.mk @@ -66,8 +66,9 @@ endif include $(CLEAR_VARS) LOCAL_MODULE := libwifi-hal-common LOCAL_CFLAGS := $(wifi_hal_cflags) -LOCAL_SRC_FILES := wifi_hal_common.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/include +LOCAL_SHARED_LIBRARIES := libbase +LOCAL_SRC_FILES := wifi_hal_common.cpp include $(BUILD_STATIC_LIBRARY) # A fallback "vendor" HAL library. diff --git a/libwifi_hal/wifi_hal_common.cpp b/libwifi_hal/wifi_hal_common.cpp index 459fdf515..7df84bd95 100644 --- a/libwifi_hal/wifi_hal_common.cpp +++ b/libwifi_hal/wifi_hal_common.cpp @@ -16,13 +16,11 @@ #include "hardware_legacy/wifi.h" -#define LOG_TAG "WifiHalCommon" - #include #include #include -#include +#include #include #include @@ -80,8 +78,7 @@ static int rmmod(const char *modname) { } if (ret != 0) - ALOGD("Unable to unload driver module \"%s\": %s\n", modname, - strerror(errno)); + PLOG(DEBUG) << "Unable to unload driver module '" << modname << "'"; return ret; } @@ -94,12 +91,12 @@ int wifi_change_driver_state(const char *state) { if (!state) return -1; fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_STATE_CTRL_PARAM, O_WRONLY)); if (fd < 0) { - ALOGE("Failed to open driver state control param (%s)", strerror(errno)); + PLOG(ERROR) << "Failed to open driver state control param"; return -1; } len = strlen(state) + 1; if (TEMP_FAILURE_RETRY(write(fd, state, len)) != len) { - ALOGE("Failed to write driver state control param (%s)", strerror(errno)); + PLOG(ERROR) << "Failed to write driver state control param"; ret = -1; } close(fd); @@ -126,7 +123,7 @@ int is_wifi_driver_loaded() { * crash. */ if ((proc = fopen(MODULE_FILE, "r")) == NULL) { - ALOGW("Could not open %s: %s", MODULE_FILE, strerror(errno)); + PLOG(WARNING) << "Could not open " << MODULE_FILE; property_set(DRIVER_PROP_NAME, "unloaded"); return 0; } @@ -210,12 +207,12 @@ int wifi_change_fw_path(const char *fwpath) { if (!fwpath) return ret; fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY)); if (fd < 0) { - ALOGE("Failed to open wlan fw path param (%s)", strerror(errno)); + PLOG(ERROR) << "Failed to open wlan fw path param"; return -1; } len = strlen(fwpath) + 1; if (TEMP_FAILURE_RETRY(write(fd, fwpath, len)) != len) { - ALOGE("Failed to write wlan fw path param (%s)", strerror(errno)); + PLOG(ERROR) << "Failed to write wlan fw path param"; ret = -1; } close(fd); -- cgit v1.2.3