]> git.proxmox.com Git - qemu.git/commit - hw/usb/dev-uas.c
usb: split packet result into actual_length + status
authorHans de Goede <hdegoede@redhat.com>
Thu, 1 Nov 2012 16:15:01 +0000 (17:15 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 8 Nov 2012 17:41:46 +0000 (18:41 +0100)
commit9a77a0f58923443913e1071ffb47b74c54566e70
treeaaaccedbff716bc9a22151d14b39e0bf378b646d
parent2592c59a66d456fe98fe96cb5787b356c40ee66f
usb: split packet result into actual_length + status

Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.

An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.

While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.

This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.

This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.

Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
24 files changed:
hw/usb.h
hw/usb/bus.c
hw/usb/combined-packet.c
hw/usb/core.c
hw/usb/desc.c
hw/usb/desc.h
hw/usb/dev-audio.c
hw/usb/dev-bluetooth.c
hw/usb/dev-hid.c
hw/usb/dev-hub.c
hw/usb/dev-network.c
hw/usb/dev-serial.c
hw/usb/dev-smartcard-reader.c
hw/usb/dev-storage.c
hw/usb/dev-uas.c
hw/usb/dev-wacom.c
hw/usb/hcd-ehci.c
hw/usb/hcd-musb.c
hw/usb/hcd-ohci.c
hw/usb/hcd-uhci.c
hw/usb/hcd-xhci.c
hw/usb/host-bsd.c
hw/usb/host-linux.c
hw/usb/redirect.c