qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt


From: Hans de Goede
Subject: Re: [Qemu-devel] [PATCH] usb-host: handle guest-issued clear halt
Date: Tue, 08 May 2012 14:12:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120425 Thunderbird/12.0

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<address@hidden>
---
  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 */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]