battery: convert info.online value to standard one 23/272023/2 accepted/tizen/unified/20220310.120855 submit/tizen/20220308.032646
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 7 Mar 2022 02:17:18 +0000 (11:17 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 7 Mar 2022 02:34:54 +0000 (11:34 +0900)
Change-Id: I9c9d9c5ed7e8b67d92f2a7a8ee801baaeeca0900
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
hw/battery/battery.c

index 1731c5f..2081ce1 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 */