From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/7] usb-host: fix halted endpoints
Date: Fri, 2 Sep 2011 12:01:09 +0200 [thread overview]
Message-ID: <1314957674-30133-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1314957674-30133-1-git-send-email-kraxel@redhat.com>
Two fixes for the price of one ;)
First, reinitialize the endpoint table after device reset.
This is needed anyway as the reset might have switched interfaces.
It also clears the endpoint halted state.
Second the CLEAR_HALT ioctl wants a unsigned int passed in as
argument, not uint8_t.
This gets my usb sd card reader (sandisk micromate) going.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit a8b44be4da11ba57ab3219a55eecbc422663c9b3)
---
usb-linux.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 7d8a103..1d0ccf8 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -142,6 +142,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f);
static void usb_host_auto_check(void *unused);
static int usb_host_read_file(char *line, size_t line_size,
const char *device_file, const char *device_name);
+static int usb_linux_update_endp_table(USBHostDevice *s);
static struct endp_data *get_endp(USBHostDevice *s, int ep)
{
@@ -509,6 +510,7 @@ static void usb_host_handle_reset(USBDevice *dev)
ioctl(s->fd, USBDEVFS_RESET);
usb_host_claim_interfaces(s, s->configuration);
+ usb_linux_update_endp_table(s);
}
static void usb_host_handle_destroy(USBDevice *dev)
@@ -520,8 +522,6 @@ static void usb_host_handle_destroy(USBDevice *dev)
qemu_remove_exit_notifier(&s->exit);
}
-static int usb_linux_update_endp_table(USBHostDevice *s);
-
/* iso data is special, we need to keep enough urbs in flight to make sure
that the controller never runs out of them, otherwise the device will
likely suffer a buffer underrun / overrun. */
@@ -723,7 +723,8 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p)
}
if (is_halted(s, p->devep)) {
- ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &ep);
+ unsigned int arg = ep;
+ ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &arg);
if (ret < 0) {
DPRINTF("husb: failed to clear halt. ep 0x%x errno %d\n",
ep, errno);
--
1.7.1
next prev parent reply other threads:[~2011-09-02 10:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 10:01 [Qemu-devel] [STABLE PULL] usb bugfixes Gerd Hoffmann
2011-09-02 10:01 ` [Qemu-devel] [PATCH 1/7] usb-host: reapurb error report fix Gerd Hoffmann
2011-09-02 10:01 ` Gerd Hoffmann [this message]
2011-09-02 10:01 ` [Qemu-devel] [PATCH 3/7] usb-host: fix configuration tracking Gerd Hoffmann
2011-09-02 10:01 ` [Qemu-devel] [PATCH 4/7] usb-host: endpoint table fixup Gerd Hoffmann
2011-09-02 10:01 ` [Qemu-devel] [PATCH 5/7] usb-ehci: handle siTDs Gerd Hoffmann
2011-09-02 10:01 ` [Qemu-devel] [PATCH 6/7] usb: fix use after free Gerd Hoffmann
2011-09-02 10:01 ` [Qemu-devel] [PATCH 7/7] usb: claim port at device initialization time Gerd Hoffmann
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=1314957674-30133-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.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).