summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-11-07 13:15:40 +0000
committerRichard Hughes <richard@hughsie.com>2008-11-07 13:15:40 +0000
commit7d87461bb3adb59588c8b80f747937058b76489c (patch)
treec16e86e3e23243b30f9539b0a31078dd4238c1aa
parent885c3e474898b641f23d365688aa77852345996a (diff)
more trivial WUP fixes
-rw-r--r--src/95-devkit-power-wup.rules2
-rw-r--r--src/dkp-history.c3
-rw-r--r--src/dkp-wup.c8
3 files changed, 10 insertions, 3 deletions
diff --git a/src/95-devkit-power-wup.rules b/src/95-devkit-power-wup.rules
index 90b9f88..c0afa52 100644
--- a/src/95-devkit-power-wup.rules
+++ b/src/95-devkit-power-wup.rules
@@ -1,5 +1,5 @@
##############################################################################################################
# Watts Up? Pro Devices
#
-ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", ATTR{serial}=="A80????G", ENV{ID_VENDOR}="Watts Up, Inc.", ENV{ID_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
+ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", ATTR{serial}=="A80?????", ENV{ID_VENDOR}="Watts Up, Inc.", ENV{ID_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
diff --git a/src/dkp-history.c b/src/dkp-history.c
index 513a9ad..597fd80 100644
--- a/src/dkp-history.c
+++ b/src/dkp-history.c
@@ -708,9 +708,10 @@ dkp_history_finalize (GObject *object)
history = DKP_HISTORY (object);
/* save */
+ if (history->priv->save_id > 0)
+ g_source_remove (history->priv->save_id);
if (history->priv->id != NULL)
dkp_history_save_data (history);
-
g_object_unref (history->priv->data_rate);
g_object_unref (history->priv->data_charge);
g_object_unref (history->priv->data_time_full);
diff --git a/src/dkp-wup.c b/src/dkp-wup.c
index 519310c..7e006af 100644
--- a/src/dkp-wup.c
+++ b/src/dkp-wup.c
@@ -254,8 +254,14 @@ dkp_wup_parse_command (DkpWup *wup, const gchar *data)
* \-----/
* so try to find the start and the end */
- /* strip to the first '#' char */
+ /* ensure we have a long enough response */
length = strlen (data);
+ if (length < 3) {
+ egg_debug ("not enough data '%s'", data);
+ goto out;
+ }
+
+ /* strip to the first '#' char */
for (i=0; i<length-1; i++)
if (data[i] == '#')
packet = g_strdup (data+i);