battery: convert info.online value to standard one 24/272024/1 accepted/tizen/6.5/unified/20220314.125431 submit/tizen_6.5/20220308.032730 submit/tizen_6.5/20220311.031819
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 7 Mar 2022 02:17:18 +0000 (11:17 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 7 Mar 2022 02:39:35 +0000 (02:39 +0000)
Change-Id: I9c9d9c5ed7e8b67d92f2a7a8ee801baaeeca0900
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
hw/battery/battery.c

index 650a2a480c5ae9a2d560689098b4ed6c13eb332f..6eedc6006a064151cd708a4bf89786c4c1eb2e8d 100644 (file)
@@ -102,6 +102,12 @@ static void signal_delivered(GDBusConnection *conn,
        info.present = atoi(present);
        info.capacity = atoi(capacity);
 
+       /* convert info.online to linux standard one */
+       if (info.online == 1) // disconnected: 1 -> 0
+               info.online = 0;
+       else if (info.online == 2) // connected: 2 -> 1
+               info.online = 1;
+
        if (!strncmp(status, "Charging", strlen(status))) {
                info.current_now = 1000; /* uA */
                info.current_average = 1000; /* uA */