Hi,

On 11/20/2011 11:58 PM, Marc-André Lureau wrote:
hi

On Sat, Nov 19, 2011 at 4:29 PM, Hans de Goede<[email protected]>  wrote:
    /* 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);

You have to admit it looks more like a quick patch rather than a
proper solution.

I admit :)

It would make sense if it would report a GError domain/code when
trying to open a device. This would need a wrap of libusb_open, which
I wonder why it is not done yet

GUsb already has a class for this, but libusbredirhost does not
use gusb, it wants a raw libusb device handle. Note that I could
change the g_object_set(priv->context calls with raw libusb calls
to match, that wouldn't make the code prettier, but it would make
it more consistent. Also before you ask I use 0, 2 and 3 and not
defines, because libusb has no defines for these ...

and perhaps some changes in libusb
also, to not print a "normal error" case.

I'm afraid that libusb has 2 (well it has 4 levels) modes:
1) Silent in all cases
2) print errors in all error cases including once which could be
considered more or less normal.

I also think that some libusb programs will depend on libusb reporting
an error to the user in this case, and thus won't do that themselves...

Regards,

Hans
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to