This reduces spam in stderr (which is logged to the systemd journal). Signed-off-by: Peter Wu <lekenst...@gmail.com> --- src/linux/hidpp-device.c | 7 +++++++ src/linux/up-device-unifying.c | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c index 8ef1443..8672eb4 100644 --- a/src/linux/hidpp-device.c +++ b/src/linux/hidpp-device.c @@ -851,6 +851,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; } -- 1.8.3.4 _______________________________________________ devkit-devel mailing list devkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/devkit-devel