qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] usb-host quirks
@ 2010-02-02 13:42 Michael Buesch
  2010-02-03  0:36 ` David S. Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Buesch @ 2010-02-02 13:42 UTC (permalink / raw)
  To: qemu-devel

Hi,

I've got a buggy device that needs a special workaround to be usable under
host-usb access. The device really doesn't like being reset via USBDEVFS_RESET. It
immediatenly locks up the device firmware or whatever. It won't respond properly anymore.
With the following patch it works fine, though.

So I was wondering what the accepted way was to get these quirks upstream into the qemu
source tree. Is usb-linux.c the correct place, or should we put the quirk into
a different place?

---
 usb-linux.c |    4 ++++
 1 file changed, 4 insertions(+)

--- qemu.orig/usb-linux.c
+++ qemu/usb-linux.c
@@ -389,6 +389,10 @@ static void usb_host_handle_reset(USBDev
 
     dprintf("husb: reset device %u.%u\n", s->bus_num, s->addr);
 
+    if (((s->descr[8] << 8) | s->descr[9]) == 0x2471 &&
+        ((s->descr[10] << 8) | s->descr[11]) == 0x0853)
+        return;
+
     ioctl(s->fd, USBDEVFS_RESET);
 
     usb_host_claim_interfaces(s, s->configuration);

-- 
Greetings, Michael.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] usb-host quirks
  2010-02-02 13:42 [Qemu-devel] usb-host quirks Michael Buesch
@ 2010-02-03  0:36 ` David S. Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Ahern @ 2010-02-03  0:36 UTC (permalink / raw)
  To: Michael Buesch; +Cc: qemu-devel


On 02/02/2010 06:42 AM, Michael Buesch wrote:
> Hi,
> 
> I've got a buggy device that needs a special workaround to be usable under
> host-usb access. The device really doesn't like being reset via USBDEVFS_RESET. It
> immediatenly locks up the device firmware or whatever. It won't respond properly anymore.
> With the following patch it works fine, though.
> 

What about the USBDEVFS_RESET in usb_host_open? Does that have an impact?

For some USB keys I have had to add an additional reset prior to
claiming interfaces:

diff --git a/usb-linux.c b/usb-linux.c
index 1aaa595..092e75c 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -906,6 +906,9 @@ static int usb_host_open(USBHostDevice *dev, int
bus_num,
 #endif


+    /* some keys require a reset before the getconfig */
+    ioctl(fd, USBDEVFS_RESET);
+
     /*
      * Initial configuration is -1 which makes us claim first
      * available config. We used to start with 1, which does not


David Ahern


> So I was wondering what the accepted way was to get these quirks upstream into the qemu
> source tree. Is usb-linux.c the correct place, or should we put the quirk into
> a different place?
> 
> ---
>  usb-linux.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> --- qemu.orig/usb-linux.c
> +++ qemu/usb-linux.c
> @@ -389,6 +389,10 @@ static void usb_host_handle_reset(USBDev
>  
>      dprintf("husb: reset device %u.%u\n", s->bus_num, s->addr);
>  
> +    if (((s->descr[8] << 8) | s->descr[9]) == 0x2471 &&
> +        ((s->descr[10] << 8) | s->descr[11]) == 0x0853)
> +        return;
> +
>      ioctl(s->fd, USBDEVFS_RESET);
>  
>      usb_host_claim_interfaces(s, s->configuration);
> 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-03  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 13:42 [Qemu-devel] usb-host quirks Michael Buesch
2010-02-03  0:36 ` David S. Ahern

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).