From 4a33a9ea06f6fbb08d8311a7cfed72975344f9ab Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 14 Oct 2011 11:36:43 +0200 Subject: usb-hub: wakeup on attach When attaching a new device we must send a wakeup request to the root hub, otherwise the guest will not notice the new device in case the usb hub is suspended. Signed-off-by: Gerd Hoffmann --- hw/usb-hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 09c6516..7b47079 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -163,6 +163,7 @@ static void usb_hub_attach(USBPort *port1) } else { port->wPortStatus &= ~PORT_STAT_LOW_SPEED; } + usb_wakeup(&s->dev); } static void usb_hub_detach(USBPort *port1) -- cgit v1.1 From db80358a20e2597a0844998c832b2dce667d0aa0 Mon Sep 17 00:00:00 2001 From: Roy Tam Date: Thu, 15 Sep 2011 11:25:47 +0800 Subject: usb: change VID/PID for usb-hub and usb-msd to prevent conflict Some USB drivers, for example USBASPI.SYS, will skip different type of device which has same VID/PID. The following patch helps preventing usb-msd being skipped by the driver. Signed-off-by: Roy Tam Signed-off-by: Gerd Hoffmann --- hw/usb-hub.c | 4 ++-- hw/usb-msd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 7b47079..3eb0f1a 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -127,8 +127,8 @@ static const USBDescDevice desc_device_hub = { static const USBDesc desc_hub = { .id = { - .idVendor = 0, - .idProduct = 0, + .idVendor = 0x0409, + .idProduct = 0x55aa, .bcdDevice = 0x0101, .iManufacturer = STR_MANUFACTURER, .iProduct = STR_PRODUCT, diff --git a/hw/usb-msd.c b/hw/usb-msd.c index 1a0815a..b734177 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -162,8 +162,8 @@ static const USBDescDevice desc_device_high = { static const USBDesc desc = { .id = { - .idVendor = 0, - .idProduct = 0, + .idVendor = 0x46f4, /* CRC16() of "QEMU" */ + .idProduct = 0x0001, .bcdDevice = 0, .iManufacturer = STR_MANUFACTURER, .iProduct = STR_PRODUCT, -- cgit v1.1 From 39fba3ada9a9e36a29a40e1acddec0923839c39b Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 28 Oct 2011 16:13:50 +0200 Subject: usb-host: fix host close The whole usb_host_close() function is skipped in case the device is not in attached state. This is wrong though, only then usb_device_detach() must be skipped, all other cleanup (especially device reset and closing the file handle) still needs to be done. There are code paths where usb_host_close() is called with the device in detached state already. This fixes usb-host devices not being released and returned to the host after removing them with device_del. Signed-off-by: Gerd Hoffmann --- usb-linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 7d4d1d7..f086d57 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1349,7 +1349,7 @@ static int usb_host_close(USBHostDevice *dev) { int i; - if (dev->fd == -1 || !dev->dev.attached) { + if (dev->fd == -1) { return -1; } @@ -1367,7 +1367,9 @@ static int usb_host_close(USBHostDevice *dev) } async_complete(dev); dev->closing = 0; - usb_device_detach(&dev->dev); + if (dev->dev.attached) { + usb_device_detach(&dev->dev); + } ioctl(dev->fd, USBDEVFS_RESET); close(dev->fd); dev->fd = -1; -- cgit v1.1