struct battery_info info;
char *val;
int ret;
+ int temp;
_I("POWER_SUPPLY uevent is delivered");
val = (char *)udev_device_get_property_value(dev, "POWER_SUPPLY_ONLINE");
if (!val)
return;
- info.online = atoi(val);
+ /*
+ * Convert the value to standard value, 0 or 1.
+ * POWER_SUPPLY_TYPE_UNKNOWN=0, -> 0(disconnected)
+ * POWER_SUPPLY_TYPE_BATTERY=1, -> 0(disconnected)
+ * POWER_SUPPLY_TYPE_UPS=2, -> 1(connected)
+ * POWER_SUPPLY_TYPE_MAINS=3, -> 1(connected)
+ * POWER_SUUPLY_TYPE_USB=4 -> 1(connected)
+ */
+ temp = atoi(val);
+ if (temp == 1 || temp == 0)
+ info.online = 0;
+ else
+ info.online = 1;
val = (char *)udev_device_get_property_value(dev, "POWER_SUPPLY_PRESENT");
if (!val)