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> --- devkit-power-gobject/dkp-device.c | 20 ++++++++++---------- libupower-glib/up-device.c | 16 ++++++++-------- 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 ++++++++-------- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/devkit-power-gobject/dkp-device.c b/devkit-power-gobject/dkp-device.c index 6f1e569..70126e0 100644 --- a/devkit-power-gobject/dkp-device.c +++ b/devkit-power-gobject/dkp-device.c @@ -181,9 +181,9 @@ dkp_device_collect_props_cb (const char *key, const GValue *value, DkpDevice *de } else if (g_strcmp0 (key, "Voltage") == 0) { device->priv->voltage = g_value_get_double (value); } else if (g_strcmp0 (key, "TimeToFull") == 0) { - device->priv->time_to_full = g_value_get_int64 (value); + device->priv->time_to_full = g_value_get_uint64 (value); } else if (g_strcmp0 (key, "TimeToEmpty") == 0) { - device->priv->time_to_empty = g_value_get_int64 (value); + device->priv->time_to_empty = g_value_get_uint64 (value); } else if (g_strcmp0 (key, "Percentage") == 0) { device->priv->percentage = g_value_get_double (value); } else if (g_strcmp0 (key, "Technology") == 0) { @@ -723,10 +723,10 @@ dkp_device_set_property (GObject *object, guint prop_id, const GValue *value, GP 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); @@ -824,10 +824,10 @@ dkp_device_get_property (GObject *object, guint prop_id, GValue *value, GParamSp 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); @@ -1066,16 +1066,16 @@ dkp_device_class_init (DkpDeviceClass *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)); /** * DkpDevice: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)); /** * DkpDevice:percentage: diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 3aecfd3..bb6ee26 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -196,9 +196,9 @@ up_device_collect_props_cb (const char *key, const GValue *value, UpDevice *devi } else if (g_strcmp0 (key, "Voltage") == 0) { device->priv->voltage = g_value_get_double (value); } else if (g_strcmp0 (key, "TimeToFull") == 0) { - device->priv->time_to_full = g_value_get_int64 (value); + device->priv->time_to_full = g_value_get_uint64 (value); } else if (g_strcmp0 (key, "TimeToEmpty") == 0) { - device->priv->time_to_empty = g_value_get_int64 (value); + device->priv->time_to_empty = g_value_get_uint64 (value); } else if (g_strcmp0 (key, "Percentage") == 0) { device->priv->percentage = g_value_get_double (value); } else if (g_strcmp0 (key, "Technology") == 0) { @@ -791,10 +791,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); @@ -892,10 +892,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); @@ -1226,7 +1226,7 @@ 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, + g_param_spec_uint64 ("time-to-empty", NULL, NULL, 0, G_MAXINT64, 0, G_PARAM_READWRITE)); /** @@ -1238,7 +1238,7 @@ up_device_class_init (UpDeviceClass *klass) **/ g_object_class_install_property (object_class, PROP_TIME_TO_FULL, - g_param_spec_int64 ("time-to-full", NULL, NULL, + g_param_spec_uint64 ("time-to-full", NULL, NULL, 0, G_MAXINT64, 0, G_PARAM_READWRITE)); /** 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