author | Thomas Zimmermann <tdz@users.sourceforge.net> |
Wed, 26 Sep 2012 08:45:06 -0700 | |
changeset 108147 | 20169e3f33b350e251a8c228a140c5afa51f25e4 |
parent 108146 | 745b5180e4ebf5afec3265c50dca3344dcfe3395 |
child 108148 | 6351566e60838680b216e7b3bdbd970904ed9fbd |
push id | 23539 |
push user | ryanvm@gmail.com |
push date | Wed, 26 Sep 2012 22:55:55 +0000 |
treeherder | autoland@ec079fd92224 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dhylands |
bugs | 794051 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -346,18 +346,18 @@ GetCurrentBatteryInformation(hal::Batter done = true; } if (!done) { // toro devices support chargingFile = fopen("/sys/class/power_supply/battery/status", "r"); if (chargingFile) { char status[16]; - fscanf(chargingFile, "%s", &status); - if (!strcmp(status, "Charging") || !strcmp(status, "Full")) { + char *str = fgets(status, sizeof(status), chargingFile); + if (str && (!strcmp(str, "Charging\n") || !strcmp(str, "Full\n"))) { // no way here to know if we're charging from USB or AC. chargingSrc = BATTERY_CHARGING_USB; } else { chargingSrc = BATTERY_NOT_CHARGING; } fclose(chargingFile); done = true; }