summaryrefslogtreecommitdiffstats
path: root/libwifi_hal
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2016-09-09 13:48:15 -0700
committerChristopher Wiley <wiley@google.com>2016-09-09 15:56:36 -0700
commit86105fb24919eca17e71a5ec820d75ac57bbdc65 (patch)
tree7668051dff4f0b24528353339c9c6f2f3ee299e5 /libwifi_hal
parentaf52902e4746aab2bd667ac9bdeb1bbb3e46b539 (diff)
downloadandroid_frameworks_opt_net_wifi-86105fb24919eca17e71a5ec820d75ac57bbdc65.tar.gz
android_frameworks_opt_net_wifi-86105fb24919eca17e71a5ec820d75ac57bbdc65.tar.bz2
android_frameworks_opt_net_wifi-86105fb24919eca17e71a5ec820d75ac57bbdc65.zip
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
Diffstat (limited to 'libwifi_hal')
-rw-r--r--libwifi_hal/Android.mk3
-rw-r--r--libwifi_hal/wifi_hal_common.cpp17
2 files changed, 9 insertions, 11 deletions
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 <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#include <cutils/log.h>
+#include <android-base/logging.h>
#include <cutils/misc.h>
#include <cutils/properties.h>
@@ -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);