Re: [spice-gtk Win32 v3 04/12] Add implementation of SpiceUsbDevice as a gobject (new files spice-usb-device*)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/28/2012 12:49 PM, Christophe Fergeau wrote:
On Thu, Jun 28, 2012 at 04:46:33AM +0300, Uri Lublin wrote:
diff --git a/gtk/spice-usb-device.c b/gtk/spice-usb-device.c
+void spice_usb_device_set_info(SpiceUsbDevice *self, libusb_device *libdev)
When USE_USBREDIR is not defined, there still is a libusb_device definition
available?

You are correct. This breaks the build with no USE_USBREDIR.
I need to fix that.

+{
+    SpiceUsbDevicePrivate *priv;
+
+    g_return_if_fail(SPICE_IS_USB_DEVICE(self));
+    priv = self->priv;
+
+    g_warn_if_fail(libdev != NULL);
+
+#ifdef USE_USBREDIR
+    if (libdev) {
+        struct libusb_device_descriptor desc;
+        int errcode;
+        const gchar *errstr;
+
+        priv->bus  = libusb_get_bus_number(libdev);
+        priv->addr = libusb_get_device_address(libdev);
+
+        errcode = libusb_get_device_descriptor(libdev,&desc);
+        if (errcode<  0) {
+            errstr = spice_usbutil_libusb_strerror(errcode);
+            g_warning("cannot get device descriptor for (%p) %d.%d -- %s(%d)",
+                      libdev, priv->bus, priv->addr, errstr, errcode);
+            priv->vid = -1;
+            priv->pid = -1;
Won't you get a warning with some compilers if you assign -1 to an unsigned
integer ?

I guess there exist compilers that complain about such a statement.
I can remove those lines and leave vid,pid with the value 0.

Thanks,
    Uri.


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]