diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2011-07-12 15:22:25 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-08-04 15:51:22 +0200 |
commit | 4f4321c11ff6e98583846bfd6f0e81954924b003 (patch) | |
tree | 5b4c7f185539ed6a91b1c63c0841de7cff6a3ac5 /hw/milkymist-softusb.c | |
parent | d35bf9ade5293171f13bc5fd1460920a258e3e39 (diff) |
usb: use iovecs in USBPacket
Zap data pointer from USBPacket, add a QEMUIOVector instead.
Add a bunch of helper functions to manage USBPacket data.
Switch over users to the new interface.
Note that USBPacket->len was used for two purposes: First to
pass in the buffer size and second to return the number of
transfered bytes or the status code on async transfers. There
is a new result variable for the latter. A new status code
was added to catch uninitialized result.
Nobody creates iovecs with more than one element (yet).
Some users are (temporarely) limited to iovecs with a single
element to keep the patch size as small as possible.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/milkymist-softusb.c')
-rw-r--r-- | hw/milkymist-softusb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c index abf7b59acd..75c85aeb6f 100644 --- a/hw/milkymist-softusb.c +++ b/hw/milkymist-softusb.c @@ -234,11 +234,11 @@ static void softusb_usbdev_datain(void *opaque) USBPacket p; - p.pid = USB_TOKEN_IN; - p.devep = 1; - p.data = s->kbd_usb_buffer; - p.len = sizeof(s->kbd_usb_buffer); + usb_packet_init(&p); + usb_packet_setup(&p, USB_TOKEN_IN, 0, 1); + usb_packet_addbuf(&p, s->kbd_usb_buffer, sizeof(s->kbd_usb_buffer)); s->usbdev->info->handle_data(s->usbdev, &p); + usb_packet_cleanup(&p); softusb_kbd_changed(s); } |