diff options
author | lokilee73 <changjoo.lee@samsung.com> | 2018-05-15 11:34:32 +0900 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2018-07-06 10:40:33 +0000 |
commit | d612c060f74082b72f637278ca7a32f5bf85119a (patch) | |
tree | 678650a1b449f4e27738d339d9334d16f4b15d61 | |
parent | ebe51d11473bf29ab93431ccb9ddd5d2ef884061 (diff) | |
download | device-tm1-d612c060f74082b72f637278ca7a32f5bf85119a.tar.gz device-tm1-d612c060f74082b72f637278ca7a32f5bf85119a.tar.bz2 device-tm1-d612c060f74082b72f637278ca7a32f5bf85119a.zip |
Add voltage and temperature data in uevent
Change-Id: I5238c313804d2cda6ebd1ca30b6eba32d1fdfedb
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rwxr-xr-x[-rw-r--r--] | hw/battery/battery.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/hw/battery/battery.c b/hw/battery/battery.c index 5751943..75f79ac 100644..100755 --- a/hw/battery/battery.c +++ b/hw/battery/battery.c @@ -135,6 +135,21 @@ static void uevent_delivered(struct udev_device *dev) return; info.power_source = val; + val = (char *)udev_device_get_property_value(dev, "POWER_SUPPLY_VOLTAGE_NOW"); + if (!val) + return; + info.voltage_now = atoi(val); /* uV */ + + val = (char *)udev_device_get_property_value(dev, "POWER_SUPPLY_VOLTAGE_AVG"); + if (!val) + return; + info.voltage_average = atoi(val); /* uV */ + + val = (char *)udev_device_get_property_value(dev, "POWER_SUPPLY_TEMP"); + if (!val) + return; + info.temperature = atoi(val); + udata.updated_cb(&info, udata.data); } @@ -257,6 +272,30 @@ static int battery_get_current_state( } info.current_average = val; + path = BATTERY_ROOT_PATH"/battery/voltage_now"; + ret = sys_get_int(path, &val); + if (ret < 0) { + _E("Failed to get value of (%s, %d)", path, ret); + return ret; + } + info.voltage_now = val; + + path = BATTERY_ROOT_PATH"/battery/voltage_avg"; + ret = sys_get_int(path, &val); + if (ret < 0) { + _E("Failed to get value of (%s, %d)", path, ret); + return ret; + } + info.voltage_average = val; + + path = BATTERY_ROOT_PATH"/battery/temp"; + ret = sys_get_int(path, &val); + if (ret < 0) { + _E("Failed to get value of (%s, %d)", path, ret); + return ret; + } + info.temperature = val; + updated_cb(&info, data); return 0; |