diff options
author | myfluxi <linflux@arcor.de> | 2014-12-17 19:15:19 +0100 |
---|---|---|
committer | Shareef Ali <shareefalis@gmail.com> | 2015-10-19 00:50:04 -0400 |
commit | 72d52954af098600818d9afdc15ccdad289ba473 (patch) | |
tree | 8df8e774971589dd9657d7f19fdc51e45599f996 | |
parent | faa3d3c9bc2b07c8aa54be624b3de85efa968100 (diff) | |
download | system_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
-rw-r--r-- | healthd/BatteryMonitor.cpp | 10 |
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); |