summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-06 22:12:22 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-08-22 22:59:27 +0200
commit33da6d6f4d29d0231433dacb0a609efd3ca71108 (patch)
tree4978c8e0b0417217c54b6d54c376591bef62db48
parent5b25ce610f7bf2f9e543eb22939f7bbe381bb6ea (diff)
downloadupower-33da6d6f4d29d0231433dacb0a609efd3ca71108.tar.gz
hidpp: do not print warnings if device is offline
This reduces spam in stderr (which is logged to the systemd journal). Signed-off-by: Peter Wu <lekensteyn@gmail.com>
-rw-r--r--src/linux/hidpp-device.c7
-rw-r--r--src/linux/up-device-unifying.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c
index 468ad4e..1d53bc6 100644
--- a/src/linux/hidpp-device.c
+++ b/src/linux/hidpp-device.c
@@ -855,6 +855,13 @@ hidpp_device_refresh (HidppDevice *device,
}
}
out:
+ /* do not spam when device is unreachable */
+ if (hidpp_is_error(&msg, &error_code) &&
+ (error_code == HIDPP10_ERROR_CODE_RESOURCE_ERROR)) {
+ g_debug("HID++ error: %s", (*error)->message);
+ g_error_free(*error);
+ *error = NULL;
+ }
if (name != NULL)
g_string_free (name, TRUE);
return ret;
diff --git a/src/linux/up-device-unifying.c b/src/linux/up-device-unifying.c
index d98ba88..119c517 100644
--- a/src/linux/up-device-unifying.c
+++ b/src/linux/up-device-unifying.c
@@ -73,9 +73,11 @@ up_device_unifying_refresh (UpDevice *device)
refresh_flags,
&error);
if (!ret) {
- g_warning ("failed to coldplug unifying device: %s",
- error->message);
- g_error_free (error);
+ if (error) {
+ g_warning ("failed to coldplug unifying device: %s",
+ error->message);
+ g_error_free (error);
+ }
goto out;
}
switch (hidpp_device_get_batt_status (priv->hidpp_device)) {
@@ -240,9 +242,11 @@ up_device_unifying_coldplug (UpDevice *device)
HIDPP_REFRESH_FLAGS_MODEL,
&error);
if (!ret) {
- g_warning ("failed to coldplug unifying device: %s",
- error->message);
- g_error_free (error);
+ if (error) {
+ g_warning ("failed to coldplug unifying device: %s",
+ error->message);
+ g_error_free (error);
+ }
goto out;
}