[Spice-devel] [PATCH spice-gtk 1/3] Suppress libusb open error messages when trying to open a device

Hans de Goede hdegoede at redhat.com
Sat Nov 19 07:29:40 PST 2011


We first try to open the device without invoking the acl helper, to avoid
invoking the helper unnecessary. This causes libusb to send errors like these:
libusb:error [op_open] libusb couldn't open USB device /dev/bus/usb/002/017: Permission denied.
libusb:error [op_open] libusb requires write access to USB device nodes.

This patch supresses these error messages.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-usbredir.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index e9a4e58..d79a85c 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -169,7 +169,11 @@ static gboolean spice_usbredir_channel_open_device(
 #endif
                          , FALSE);
 
+    /* Silence open failing (ie permission denied) errors */
+    g_object_set(priv->context, "debug_level", 0, NULL);
     rc = libusb_open(_g_usb_device_get_device(priv->device), &handle);
+    g_object_set(priv->context, "debug_level",
+                 spice_util_get_debug() ? 3 : 2, NULL);
     if (rc != 0) {
         g_set_error(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
                     "Could not open usb device: %s [%i]",
-- 
1.7.7.3



More information about the Spice-devel mailing list