Skip to contentSkip to conversation

Fix usage of USB_DEV_FLAG_IS_HOST flag.

PATCH In review Michael Marineau 2 participants 4 messages May 12, 2013 – May 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix usage of USB_DEV_FLAG_IS_HOST flag.

USB_DEV_FLAG_IS_HOST is the bit number, not value. Booting with a "Fitbit Base Station" USB dongle was triggering this assert.

---
 hw/usb/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/core.c +1 -1
index 15a150a..05948ca 100644
@@ -410,7 +410,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
             assert(p->ep->type != USB_ENDPOINT_XFER_ISOC);
             /* using async for interrupt packets breaks migration */
             assert(p->ep->type != USB_ENDPOINT_XFER_INT ||
-                   (dev->flags & USB_DEV_FLAG_IS_HOST));
+                   (dev->flags & (1 << USB_DEV_FLAG_IS_HOST)));
             usb_packet_set_state(p, USB_PACKET_ASYNC);
             QTAILQ_INSERT_TAIL(&p->ep->queue, p, queue);
         } else if (p->status == USB_RET_ADD_TO_QUEUE) {
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Michael Marineau

USB_DEV_FLAG_IS_HOST is the bit number, not value. Booting with a "Fitbit Base Station" USB dongle was triggering this assert.

---
 hw/usb/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/core.c +0 -0
index 15a150a..05948ca 100644

hw/usb/core.c void usb_handle_packet(USBDevice *dev, USBPacket *p) · line 416

Quoted 8 lines
hw/usb/core.c +1 -1
@@ -410,7 +410,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
             assert(p->ep->type != USB_ENDPOINT_XFER_ISOC);
             /* using async for interrupt packets breaks migration */
             assert(p->ep->type != USB_ENDPOINT_XFER_INT ||
-                   (dev->flags & USB_DEV_FLAG_IS_HOST));
+                   (dev->flags & (1 << USB_DEV_FLAG_IS_HOST)));
             usb_packet_set_state(p, USB_PACKET_ASYNC);
             QTAILQ_INSERT_TAIL(&p->ep->queue, p, queue);
         } else if (p->status == USB_RET_ADD_TO_QUEUE) {

Looks good.

Anthony? Can you pick it for 1.5 directly? I don't have any other pending usb bits for 1.5 at the moment.

cheers,
Gerd

#2 lore raw
Quoted 25 lines · Gerd Hoffmann
Quoted 13 lines · Michael Marineau

USB_DEV_FLAG_IS_HOST is the bit number, not value. Booting with a "Fitbit Base Station" USB dongle was triggering this assert.

---
 hw/usb/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/core.c +0 -0
index 15a150a..05948ca 100644

hw/usb/core.c void usb_handle_packet(USBDevice *dev, USBPacket *p) · line 416

Quoted 8 lines
hw/usb/core.c +1 -1
@@ -410,7 +410,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
             assert(p->ep->type != USB_ENDPOINT_XFER_ISOC);
             /* using async for interrupt packets breaks migration */
             assert(p->ep->type != USB_ENDPOINT_XFER_INT ||
-                   (dev->flags & USB_DEV_FLAG_IS_HOST));
+                   (dev->flags & (1 << USB_DEV_FLAG_IS_HOST)));
             usb_packet_set_state(p, USB_PACKET_ASYNC);
             QTAILQ_INSERT_TAIL(&p->ep->queue, p, queue);
         } else if (p->status == USB_RET_ADD_TO_QUEUE) {

Looks good.

Quoted 8 lines

Anthony? Can you pick it for 1.5 directly? I don't have any other pending usb bits for 1.5 at the moment.

cheers,
Gerd

Ping, looks like this hasn't managed to land in master yet and just wanted to make sure it doesn't get forgotten. I probably should have noted in the original email that this bug was introduced
in be41efde3ca0372dbf7543e09ff473b4eec25057 and impacts both 1.4 and 1.5.

Signature · 1 line
Michael Marineau
#3 lore raw

Hi,

Quoted 7 lines
Quoted 7 lines

Looks good.

Anthony? Can you pick it for 1.5 directly? I don't have any other pending usb bits for 1.5 at the moment.

Quoted 8 lines
Quoted 3 lines

cheers,
Gerd

Ping, looks like this hasn't managed to land in master yet and just wanted to make sure it doesn't get forgotten. I probably should have noted in the original email that this bug was introduced
in be41efde3ca0372dbf7543e09ff473b4eec25057 and impacts both 1.4 and 1.5.

Damn, missed 1.5. Added to usb patch queue now.
Will also queue up for stable (aka 1.5.1).

cheers,
Gerd