aboutsummaryrefslogtreecommitdiff
path: root/hw/usb.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-05-12 13:20:39 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-05-26 11:55:03 +0200
commit53aa8c0e2af473050fa765533a8d69f3450788ab (patch)
tree74cdb5f5490f5c05cc4ceb1dd5caf617e165197f /hw/usb.c
parentebd669a19f00d0ff8370e1edfb6232f50e42110d (diff)
downloadqemu-53aa8c0e2af473050fa765533a8d69f3450788ab.zip
qemu-53aa8c0e2af473050fa765533a8d69f3450788ab.tar.gz
qemu-53aa8c0e2af473050fa765533a8d69f3450788ab.tar.bz2
usb: add usb_handle_packet
Add a usb_handle_packet function, put it into use everywhere. Right now it just calls dev->info->handle_packet(), that will change in future patches though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/hw/usb.c b/hw/usb.c
index 60027c6..966cb0f 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -297,9 +297,22 @@ int set_usb_string(uint8_t *buf, const char *str)
void usb_send_msg(USBDevice *dev, int msg)
{
USBPacket p;
+ int ret;
+
memset(&p, 0, sizeof(p));
p.pid = msg;
- dev->info->handle_packet(dev, &p);
-
+ ret = usb_handle_packet(dev, &p);
/* This _must_ be synchronous */
+ assert(ret != USB_RET_ASYNC);
+}
+
+/* Hand over a packet to a device for processing. Return value
+ USB_RET_ASYNC indicates the processing isn't finished yet, the
+ driver will call usb_packet_complete() when done processing it. */
+int usb_handle_packet(USBDevice *dev, USBPacket *p)
+{
+ int ret;
+
+ ret = dev->info->handle_packet(dev, p);
+ return ret;
}