* [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci
@ 2016-01-28 17:15 Qixiong Su
2016-01-29 18:07 ` P J P
0 siblings, 1 reply; 2+ messages in thread
From: Qixiong Su @ 2016-01-28 17:15 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]
QEMU crashes when redirect a usb 3.0 device which attached to a xHCI controller. The assertion of "dev->state == 3" in "usb_handle_packet" has failed.
Signed-off-by: Qixiong Su <916628390@qq.com>
---
hw/usb/redirect.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 44522d9..cd29776 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1437,6 +1437,17 @@ static void usbredir_handle_destroy(USBDevice *udev)
free(dev->filter_rules);
}
+static void usbredir_handle_attach(USBDevice *udev)
+{
+ assert(udev != NULL);
+ assert(udev->attached);
+ assert(udev->state == USB_STATE_ATTACHED);
+
+ if (udev->speed == USB_SPEED_SUPER && (udev->port->speedmask & USB_SPEED_MASK_SUPER)) {
+ udev->state = USB_STATE_DEFAULT;
+ }
+}
+
static int usbredir_check_filter(USBRedirDevice *dev)
{
if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
@@ -2480,6 +2491,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
uc->init = usbredir_initfn;
uc->product_desc = "USB Redirection Device";
uc->handle_destroy = usbredir_handle_destroy;
+ uc->handle_attach = usbredir_handle_attach;
uc->cancel_packet = usbredir_cancel_packet;
uc->handle_reset = usbredir_handle_reset;
uc->handle_data = usbredir_handle_data;
--
2.1.3
[-- Attachment #2: Type: text/html, Size: 2143 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci
2016-01-28 17:15 [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci Qixiong Su
@ 2016-01-29 18:07 ` P J P
0 siblings, 0 replies; 2+ messages in thread
From: P J P @ 2016-01-29 18:07 UTC (permalink / raw)
To: Qixiong Su; +Cc: qemu-devel
Hello Qixiong,
+-- On Fri, 29 Jan 2016, Qixiong Su wrote --+
| QEMU crashes when redirect a usb 3.0 device which attached to a xHCI
| controller. The assertion of "dev->state == 3" in "usb_handle_packet" has
| failed.
You need to follow git commit message syntax. ie. One line commit summary,
leave second line blank and then commit log message stating why you are doing
the proposed change.
Please see:
-> http://qemu-project.org/Contribute/SubmitAPatch
| diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
| index 44522d9..cd29776 100644
| --- a/hw/usb/redirect.c
| +++ b/hw/usb/redirect.c
| +static void usbredir_handle_attach(USBDevice *udev)
| +{
| + assert(udev != NULL);
| + assert(udev->attached);
| + assert(udev->state == USB_STATE_ATTACHED);
This is done in usb_attach() routine, may not be required here.
| + if (udev->speed == USB_SPEED_SUPER && (udev->port->speedmask & USB_SPEED_MASK_SUPER)) {
| + udev->state = USB_STATE_DEFAULT;
Why conditionally set it to default?
--
- P J P
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-29 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-28 17:15 [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci Qixiong Su
2016-01-29 18:07 ` P J P
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).