Quick question. I am using the mangOH red with the WP8548 and i am trying to read the battery level using the Input Power Supply Monitoring API provided by modem Services. The battery level returned by le_ips_GetBatteryLevel always equals to zero, according to the documentation that means the battery is drained or it doesn’t have a battery connected. The battery definetly isn’t drained because i am able to power my platform only using the battery. Also le_ips_GetPowerSource always tells me it is powered by an external source and not the battery (even after disconnecting all usb connections).
Am I using the API wrong or is it because of the mangOH board?
But “cm ips” obviously doesn’t display the battery value and displays it is powered by an external source even if it is powered by a battery. Also i can use the API in the app and get the power source and voltage levels.
Edit: With BatteryLevel i mean the battery percentage and not the voltage, sorry if that was unclear
I looked throug the source code and found following function:
static unsigned int ComputePercentage
unsigned int mAh
// Compute the battery charge percentage, rounding up from half a percent or higher.
uint32_t percentTimesTen = 1000UL * mAh / Capacity;
unsigned int percentage = (percentTimesTen / 10);
if ((percentTimesTen % 10) >= 5)
percentage += 1;
// Clamp at 100%
if (percentage > 100)
LE_WARN("Battery monitor reports available charge (%u mAh) higher than maximum of %u mAh.",
percentage = 100;
“Capacity” is just the battery Capacity, which i could set myself depending on the battery.
The mAh is the remaining charge calculated in another function using:
int pathLen = snprintf(path, sizeof(path), "%s/%s", MonitorDirPath, ChargeNowFileName);
LE_ASSERT(pathLen < sizeof(path));
le_result_t r = util_ReadIntFromFile(path, &uAh);
if (r == LE_OK)
*charge = uAh / 1000;
The weird thing is, “MonitorDirPath” is set via:
static const char MonitorDirPath = “/sys/class/power_supply/LTC2942”;
and it seems i don’t have the path on my mangOH specified in MonitorDirPath