summaryrefslogtreecommitdiff
path: root/hw/usb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-02-02 16:33:13 +0100
committerGerd Hoffmann <kraxel@redhat.com>2011-05-26 11:55:02 +0200
commit007fd62f4d3959f2a61abe61a34a54c9f99560b0 (patch)
treeb5f3ffe9b4683aa60061047e3dbbde0ca6298364 /hw/usb.c
parent8656954aedbd9995e68e998df734a849f8e63ade (diff)
downloadqemu-007fd62f4d3959f2a61abe61a34a54c9f99560b0.zip
usb: Pass the packet to the device's handle_control callback
This allows using the generic usb_generic_handle_packet function from device code which does ASYNC control requests (such as the linux host pass through code). Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/usb.c b/hw/usb.c
index d8c0a75c3a..f503b7a442 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -82,9 +82,9 @@ static int do_token_setup(USBDevice *s, USBPacket *p)
request = (s->setup_buf[0] << 8) | s->setup_buf[1];
value = (s->setup_buf[3] << 8) | s->setup_buf[2];
index = (s->setup_buf[5] << 8) | s->setup_buf[4];
-
+
if (s->setup_buf[0] & USB_DIR_IN) {
- ret = s->info->handle_control(s, request, value, index,
+ ret = s->info->handle_control(s, p, request, value, index,
s->setup_len, s->data_buf);
if (ret < 0)
return ret;
@@ -123,9 +123,12 @@ static int do_token_in(USBDevice *s, USBPacket *p)
switch(s->setup_state) {
case SETUP_STATE_ACK:
if (!(s->setup_buf[0] & USB_DIR_IN)) {
- s->setup_state = SETUP_STATE_IDLE;
- ret = s->info->handle_control(s, request, value, index,
+ ret = s->info->handle_control(s, p, request, value, index,
s->setup_len, s->data_buf);
+ if (ret == USB_RET_ASYNC) {
+ return USB_RET_ASYNC;
+ }
+ s->setup_state = SETUP_STATE_IDLE;
if (ret > 0)
return 0;
return ret;