summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2022-01-27 15:02:15 +0900
committerYoungjae Cho <y0.cho@samsung.com>2022-02-03 14:20:22 +0900
commitb55fe6104e3b6dc10082ba48346370dfb7d89ebd (patch)
tree1075aafb4e1e5df7371716fddcf4ce27be8b2d71
parent8b581c284a7bb9f69f1de5e4ca9d8462e9b260dc (diff)
downloaddevice-tw3-b55fe6104e3b6dc10082ba48346370dfb7d89ebd.tar.gz
device-tw3-b55fe6104e3b6dc10082ba48346370dfb7d89ebd.tar.bz2
device-tw3-b55fe6104e3b6dc10082ba48346370dfb7d89ebd.zip
battery: convert ONLINE property value to standard onesubmit/tizen/20220208.075544
Change-Id: I0a98cd552865437cf4b45316e256d75375aeaaa4 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--hw/battery/battery.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/hw/battery/battery.c b/hw/battery/battery.c
index 3a3d962..70e9812 100644
--- a/hw/battery/battery.c
+++ b/hw/battery/battery.c
@@ -87,6 +87,7 @@ static void uevent_delivered(struct udev_device *dev)
struct battery_info info;
char *val;
int ret;
+ int temp;
_I("POWER_SUPPLY uevent is delivered");
@@ -113,7 +114,19 @@ static void uevent_delivered(struct udev_device *dev)
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)