In linux backend, g_object_set was called with wrong argument types for time-to-empty,time-to-full and percentage properties. This patch uses explicit casts in the same way as freebsd backend.
Signed-off-by: Mariusz Ceier <mce...@gmail.com> --- src/linux/up-device-hid.c | 2 +- src/linux/up-device-supply.c | 26 +++++++++++++------------- src/org.freedesktop.UPower.Device.xml | 4 ++-- src/up-device.c | 16 ++++++++-------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/linux/up-device-hid.c b/src/linux/up-device-hid.c index e77be8e..3bdd12d 100644 --- a/src/linux/up-device-hid.c +++ b/src/linux/up-device-hid.c @@ -192,7 +192,7 @@ up_device_hid_set_values (UpDeviceHid *hid, int code, int value) g_object_set (device, "percentage", (gfloat) value, NULL); break; case UP_DEVICE_HID_RUNTIME_TO_EMPTY: - g_object_set (device, "time-to-empty", (gint64) value, NULL); + g_object_set (device, "time-to-empty", (guint64) value, NULL); break; case UP_DEVICE_HID_CHARGING: if (value != 0) diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index ec405f4..f70e6b4 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -104,25 +104,25 @@ up_device_supply_reset_values (UpDeviceSupply *supply) "vendor", NULL, "model", NULL, "serial", NULL, - "update-time", 0, + "update-time", (guint64) 0, "power-supply", FALSE, "online", FALSE, - "energy", 0.0, + "energy", (gdouble) 0.0, "is-present", FALSE, "is-rechargeable", FALSE, "has-history", FALSE, "has-statistics", FALSE, - "state", NULL, - "capacity", 0.0, - "energy-empty", 0.0, - "energy-full", 0.0, - "energy-full-design", 0.0, - "energy-rate", 0.0, - "voltage", 0.0, - "time-to-empty", 0, - "time-to-full", 0, - "percentage", 0, - "technology", NULL, + "state", UP_DEVICE_STATE_UNKNOWN, + "capacity", (gdouble) 0.0, + "energy-empty", (gdouble) 0.0, + "energy-full", (gdouble) 0.0, + "energy-full-design", (gdouble) 0.0, + "energy-rate", (gdouble) 0.0, + "voltage", (gdouble) 0.0, + "time-to-empty", (guint64) 0, + "time-to-full", (guint64) 0, + "percentage", (gdouble) 0.0, + "technology", UP_DEVICE_TECHNOLOGY_UNKNOWN, NULL); } diff --git a/src/org.freedesktop.UPower.Device.xml b/src/org.freedesktop.UPower.Device.xml index 7c9a65b..d9bee54 100644 --- a/src/org.freedesktop.UPower.Device.xml +++ b/src/org.freedesktop.UPower.Device.xml @@ -95,11 +95,11 @@ method return sender=:1.386 -> dest=:1.477 reply_serial=2 ) dict entry( string "time-to-empty" - variant int64 0 + variant uint64 0 ) dict entry( string "time-to-full" - variant int64 0 + variant uint64 0 ) dict entry( string "percentage" diff --git a/src/up-device.c b/src/up-device.c index a6de925..631f902 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -238,10 +238,10 @@ up_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe g_value_set_double (value, device->priv->voltage); break; case PROP_TIME_TO_EMPTY: - g_value_set_int64 (value, device->priv->time_to_empty); + g_value_set_uint64 (value, device->priv->time_to_empty); break; case PROP_TIME_TO_FULL: - g_value_set_int64 (value, device->priv->time_to_full); + g_value_set_uint64 (value, device->priv->time_to_full); break; case PROP_PERCENTAGE: g_value_set_double (value, device->priv->percentage); @@ -338,10 +338,10 @@ up_device_set_property (GObject *object, guint prop_id, const GValue *value, GPa device->priv->voltage = g_value_get_double (value); break; case PROP_TIME_TO_EMPTY: - device->priv->time_to_empty = g_value_get_int64 (value); + device->priv->time_to_empty = g_value_get_uint64 (value); break; case PROP_TIME_TO_FULL: - device->priv->time_to_full = g_value_get_int64 (value); + device->priv->time_to_full = g_value_get_uint64 (value); break; case PROP_PERCENTAGE: device->priv->percentage = g_value_get_double (value); @@ -1136,16 +1136,16 @@ up_device_class_init (UpDeviceClass *klass) */ g_object_class_install_property (object_class, PROP_TIME_TO_EMPTY, - g_param_spec_int64 ("time-to-empty", NULL, NULL, - 0, G_MAXINT64, 0, + g_param_spec_uint64 ("time-to-empty", NULL, NULL, + 0, G_MAXUINT64, 0, G_PARAM_READWRITE)); /** * UpDevice:time-to-full: */ g_object_class_install_property (object_class, PROP_TIME_TO_FULL, - g_param_spec_int64 ("time-to-full", NULL, NULL, - 0, G_MAXINT64, 0, + g_param_spec_uint64 ("time-to-full", NULL, NULL, + 0, G_MAXUINT64, 0, G_PARAM_READWRITE)); /** * UpDevice:percentage: -- 1.7.1.1 _______________________________________________ devkit-devel mailing list devkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/devkit-devel