summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authormyfluxi <linflux@arcor.de>2014-12-17 19:15:19 +0100
committerShareef Ali <shareefalis@gmail.com>2015-10-19 00:50:04 -0400
commit72d52954af098600818d9afdc15ccdad289ba473 (patch)
tree8df8e774971589dd9657d7f19fdc51e45599f996 /healthd
parentfaa3d3c9bc2b07c8aa54be624b3de85efa968100 (diff)
downloadsystem_core-72d52954af098600818d9afdc15ccdad289ba473.zip
system_core-72d52954af098600818d9afdc15ccdad289ba473.tar.gz
system_core-72d52954af098600818d9afdc15ccdad289ba473.tar.bz2
healthd: Detect power supply type for all charger devices
Power supply type is not determined via the device name, hence iterate over all available devices in the subsystem node and read the type from device file. shell@hammerhead:/ $ ls /sys/class/power_supply ac batt_therm battery touch usb wireless <4>[ 3184.867782] healthd: touch: Unknown power supply type <4>[ 3184.868039] healthd: batt_therm: Unknown power supply type <6>[ 3184.880506] healthd: battery l=89 v=4181 t=25.5 h=2 st=2 c=-288 chg=u <4>[ 3184.890362] healthd: touch: Unknown power supply type <4>[ 3184.890549] healthd: batt_therm: Unknown power supply type <6>[ 3184.899419] healthd: battery l=89 v=4181 t=25.5 h=2 st=2 c=-59 chg=u <4>[ 3184.908756] healthd: touch: Unknown power supply type <4>[ 3184.908984] healthd: batt_therm: Unknown power supply type <6>[ 3184.919672] healthd: battery l=89 v=4181 t=25.6 h=2 st=2 c=-25 chg=u Change-Id: I863bfab95193899460237b51997e0418eeb4ee2c
Diffstat (limited to 'healthd')
-rw-r--r--healthd/BatteryMonitor.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index b0e9a4d..c336c0a 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -231,9 +231,9 @@ bool BatteryMonitor::update(void) {
path.clear();
path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name);
switch(readPowerSupplyType(path)) {
- case ANDROID_POWER_SUPPLY_TYPE_AC:
- case ANDROID_POWER_SUPPLY_TYPE_USB:
- case ANDROID_POWER_SUPPLY_TYPE_WIRELESS:
+ case ANDROID_POWER_SUPPLY_TYPE_BATTERY:
+ break;
+ default:
path.clear();
path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name);
if (access(path.string(), R_OK) == 0) {
@@ -261,10 +261,6 @@ bool BatteryMonitor::update(void) {
}
}
break;
- case ANDROID_POWER_SUPPLY_TYPE_BATTERY:
- break;
- default:
- break;
} //switch
} //while
closedir(dir);