aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2013-12-10 17:03:54 +0000
committerUbuntu <vishal.bhoj@linaro.org>2014-06-05 10:01:58 +0000
commit308bf67b1ac8d270ff19939e76ebb11b03f3ed81 (patch)
tree2317b93f7695dc55e66d525aaf378c7062829f79
parent03f96cf1219534a638f4e127212566e09933460a (diff)
healtd: Send messages to Android log, not the kernel log
If the system doesn't have the expected battery configuration then healthd is quite noisy with it's log messages during boot and every minute thereafter. Rather than have this spamming the kernels serial console, direct this instead to Android's logging system. This also has the effect of working around a serial port bug on vexpress: https://bugs.launchpad.net/linaro-android/+bug/1254738 but reducing mostly spurious serial port noise is a good aim in itself. Change-Id: I0eff5637009cfee47891a9c2363145634cbf0ae1 Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--healthd/BatteryMonitor.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index 688c7ff5..41b8266d 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <batteryservice/BatteryService.h>
-#include <cutils/klog.h>
+#include <cutils/log.h>
#include <utils/String8.h>
#include <utils/Vector.h>
@@ -63,7 +63,7 @@ int BatteryMonitor::getBatteryStatus(const char* status) {
ret = mapSysfsString(status, batteryStatusMap);
if (ret < 0) {
- KLOG_WARNING(LOG_TAG, "Unknown battery status '%s'\n", status);
+ ALOGW("Unknown battery status '%s'\n", status);
ret = BATTERY_STATUS_UNKNOWN;
}
@@ -85,7 +85,7 @@ int BatteryMonitor::getBatteryHealth(const char* status) {
ret = mapSysfsString(status, batteryHealthMap);
if (ret < 0) {
- KLOG_WARNING(LOG_TAG, "Unknown battery health '%s'\n", status);
+ ALOGW("Unknown battery health '%s'\n", status);
ret = BATTERY_HEALTH_UNKNOWN;
}
@@ -99,7 +99,7 @@ int BatteryMonitor::readFromFile(const String8& path, char* buf, size_t size) {
return -1;
int fd = open(path.string(), O_RDONLY, 0);
if (fd == -1) {
- KLOG_ERROR(LOG_TAG, "Could not open '%s'\n", path.string());
+ ALOGE("Could not open '%s'\n", path.string());
return -1;
}
@@ -233,7 +233,7 @@ bool BatteryMonitor::update(void) {
props.chargerWirelessOnline = true;
break;
default:
- KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n",
+ ALOGW("%s: Unknown power supply type\n",
mChargerNames[i].string());
}
}
@@ -259,7 +259,7 @@ bool BatteryMonitor::update(void) {
strlcat(dmesgline, b, sizeof(dmesgline));
}
- KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline,
+ ALOGI("%s chg=%s%s%s\n", dmesgline,
props.chargerAcOnline ? "a" : "",
props.chargerUsbOnline ? "u" : "",
props.chargerWirelessOnline ? "w" : "");
@@ -278,7 +278,7 @@ void BatteryMonitor::init(struct healthd_config *hc, bool nosvcmgr) {
mHealthdConfig = hc;
DIR* dir = opendir(POWER_SUPPLY_SYSFS_PATH);
if (dir == NULL) {
- KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH);
+ ALOGE("Could not open %s\n", POWER_SUPPLY_SYSFS_PATH);
} else {
struct dirent* entry;
@@ -399,21 +399,21 @@ void BatteryMonitor::init(struct healthd_config *hc, bool nosvcmgr) {
}
if (!mChargerNames.size())
- KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
+ ALOGE("No charger supplies found\n");
if (mHealthdConfig->batteryStatusPath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryStatusPath not found\n");
+ ALOGW("BatteryStatusPath not found\n");
if (mHealthdConfig->batteryHealthPath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryHealthPath not found\n");
+ ALOGW("BatteryHealthPath not found\n");
if (mHealthdConfig->batteryPresentPath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryPresentPath not found\n");
+ ALOGW("BatteryPresentPath not found\n");
if (mHealthdConfig->batteryCapacityPath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryCapacityPath not found\n");
+ ALOGW("BatteryCapacityPath not found\n");
if (mHealthdConfig->batteryVoltagePath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryVoltagePath not found\n");
+ ALOGW("BatteryVoltagePath not found\n");
if (mHealthdConfig->batteryTemperaturePath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryTemperaturePath not found\n");
+ ALOGW("BatteryTemperaturePath not found\n");
if (mHealthdConfig->batteryTechnologyPath.isEmpty())
- KLOG_WARNING(LOG_TAG, "BatteryTechnologyPath not found\n");
+ ALOGW("BatteryTechnologyPath not found\n");
if (nosvcmgr == false) {
mBatteryPropertiesRegistrar = new BatteryPropertiesRegistrar(this);