From: "Qixiong Su" <916628390@qq.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci
Date: Fri, 29 Jan 2016 01:15:44 +0800 [thread overview]
Message-ID: <tencent_4AC4E71A69161C0F50EBE6F8@qq.com> (raw)
[-- 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 --]
next reply other threads:[~2016-01-28 17:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 17:15 Qixiong Su [this message]
2016-01-29 18:07 ` [Qemu-devel] [PATCH 1/1] redirect: change the state after attach usb 3.0 devices to xhci P J P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_4AC4E71A69161C0F50EBE6F8@qq.com \
--to=916628390@qq.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).