qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt
@ 2012-05-08 12:06 Gerd Hoffmann
  2012-05-08 12:12 ` Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-05-08 12:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: erik.rull, Gerd Hoffmann

Most important here is to update our internal endpoint state so we know
the endpoint isn't in halted state any more.  Without this usb-host
tries to clear halt again with the next data transfer submitted.  Doing
this twice is (a) not correct and (b) confuses some usb devices,
rendering them non-functional in the guest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/host-linux.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index bb08542..9094120 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -1101,6 +1101,15 @@ static int usb_host_handle_control(USBDevice *dev, USBPacket *p,
         ret = usb_host_set_interface(s, index, value);
         trace_usb_host_req_emulated(s->bus_num, s->addr, p, ret);
         return ret;
+
+    case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
+        if (value == 0) { /* clear halt */
+            int pid = (index & USB_DIR_IN) ? USB_TOKEN_IN : USB_TOKEN_OUT;
+            ioctl(s->fd, USBDEVFS_CLEAR_HALT, &index);
+            clear_halt(s, pid, index & 0x0f);
+            trace_usb_host_req_emulated(s->bus_num, s->addr, p, 0);
+            return 0;
+        }
     }
 
     /* The rest are asynchronous */
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt
  2012-05-08 12:06 [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt Gerd Hoffmann
@ 2012-05-08 12:12 ` Hans de Goede
  2012-05-09 10:09 ` Erik Rull
  2012-05-11 14:59 ` Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2012-05-08 12:12 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: erik.rull, qemu-devel

Looks good, ACK.

On 05/08/2012 02:06 PM, Gerd Hoffmann wrote:
> Most important here is to update our internal endpoint state so we know
> the endpoint isn't in halted state any more.  Without this usb-host
> tries to clear halt again with the next data transfer submitted.  Doing
> this twice is (a) not correct and (b) confuses some usb devices,
> rendering them non-functional in the guest.
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
> ---
>   hw/usb/host-linux.c |    9 +++++++++
>   1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
> index bb08542..9094120 100644
> --- a/hw/usb/host-linux.c
> +++ b/hw/usb/host-linux.c
> @@ -1101,6 +1101,15 @@ static int usb_host_handle_control(USBDevice *dev, USBPacket *p,
>           ret = usb_host_set_interface(s, index, value);
>           trace_usb_host_req_emulated(s->bus_num, s->addr, p, ret);
>           return ret;
> +
> +    case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
> +        if (value == 0) { /* clear halt */
> +            int pid = (index&  USB_DIR_IN) ? USB_TOKEN_IN : USB_TOKEN_OUT;
> +            ioctl(s->fd, USBDEVFS_CLEAR_HALT,&index);
> +            clear_halt(s, pid, index&  0x0f);
> +            trace_usb_host_req_emulated(s->bus_num, s->addr, p, 0);
> +            return 0;
> +        }
>       }
>
>       /* The rest are asynchronous */

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

* Re: [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt
  2012-05-08 12:06 [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt Gerd Hoffmann
  2012-05-08 12:12 ` Hans de Goede
@ 2012-05-09 10:09 ` Erik Rull
  2012-05-11 14:59 ` Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Erik Rull @ 2012-05-09 10:09 UTC (permalink / raw)
  To: qemu-devel, Gerd Hoffmann

 Looks VERY good, ACK!
The DVD drive works now!


On May 8, 2012 at 2:06 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> Most important here is to update our internal endpoint state so we know
> the endpoint isn't in halted state any more.  Without this usb-host
> tries to clear halt again with the next data transfer submitted.  Doing
> this twice is (a) not correct and (b) confuses some usb devices,
> rendering them non-functional in the guest.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb/host-linux.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
> index bb08542..9094120 100644
> --- a/hw/usb/host-linux.c
> +++ b/hw/usb/host-linux.c
> @@ -1101,6 +1101,15 @@ static int usb_host_handle_control(USBDevice *dev,
USBPacket *p,
>          ret = usb_host_set_interface(s, index, value);
>          trace_usb_host_req_emulated(s->bus_num, s->addr, p, ret);
>          return ret;
> +
> +    case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
> +        if (value == 0) { /* clear halt */
> +            int pid = (index & USB_DIR_IN) ? USB_TOKEN_IN :
USB_TOKEN_OUT;
> +            ioctl(s->fd, USBDEVFS_CLEAR_HALT, &index);
> +            clear_halt(s, pid, index & 0x0f);
> +            trace_usb_host_req_emulated(s->bus_num, s->addr, p, 0);
> +            return 0;
> +        }
>      }
> 
>      /* The rest are asynchronous */
> --
> 1.7.1
>
>

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

* Re: [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt
  2012-05-08 12:06 [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt Gerd Hoffmann
  2012-05-08 12:12 ` Hans de Goede
  2012-05-09 10:09 ` Erik Rull
@ 2012-05-11 14:59 ` Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-05-11 14:59 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On 05/08/12 14:06, Gerd Hoffmann wrote:
> Most important here is to update our internal endpoint state so we know
> the endpoint isn't in halted state any more.  Without this usb-host
> tries to clear halt again with the next data transfer submitted.  Doing
> this twice is (a) not correct and (b) confuses some usb devices,
> rendering them non-functional in the guest.

Anthony, can you pick this directly?
It is the only 1.1 usb patch in the queue right now ...

cheers,
  Gerd

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

end of thread, other threads:[~2012-05-11 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-08 12:06 [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt Gerd Hoffmann
2012-05-08 12:12 ` Hans de Goede
2012-05-09 10:09 ` Erik Rull
2012-05-11 14:59 ` Gerd Hoffmann

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