Statistics
| Branch: | Revision:

root / hw / usb.c @ 079d0b7f

History | View | Annotate | Download (14.2 kB)

# Date Author Comment
98861f51 02/10/2012 12:31 pm Gerd Hoffmann

usb: handle dev == NULL in usb_handle_packet()

Allow passing in a NULL pointer, return USB_RET_NODEV in that case.
Removes the burden to to a NULL pointer check from the callers.

Signed-off-by: Gerd Hoffmann <>

7f74a56b 02/10/2012 12:31 pm Gerd Hoffmann

usb: kill handle_packet callback

All drivers except usb-hub use usb_generic_handle_packet. The only
reason the usb hub has its own function is that it used to be called
with packets which are intended for downstream devices. With the new,
separate device lookup step this doesn't happen any more, so the need...

1977f93d 02/10/2012 12:31 pm Gerd Hoffmann

usb: fold usb_generic_handle_packet into usb_handle_packet

There is no reason to have a separate usb_generic_handle_packet function
any more, fold it into usb_handle_packet(). Also call the do_token_*
functions which handle control transfer emulation for control pipe...

f53c398a 02/10/2012 12:31 pm Gerd Hoffmann

usb: USBPacket: add status, rename owner -> ep

Add enum to track the status of USBPackets, use that instead of the
owner pointer to figure whenever a usb packet is currently in flight
or not. Add some more packet status sanity checks. Also rename the
USBEndpoint pointer from "owner" to "ep"....

63095ab5 02/10/2012 12:31 pm Gerd Hoffmann

usb: add USBEndpoint->{nr,pid}

Add a "nr" and "pid" fields to USBEndpoint so you can easily figure the
endpoint number and direction of any given endpoint.

Signed-off-by: Gerd Hoffmann <>

079d0b7f 02/10/2012 12:31 pm Gerd Hoffmann

usb: Set USBEndpoint in usb_packet_setup().

With the separation of the device lookup (via usb_find_device) and
packet processing we can lookup device and endpoint before setting up
the usb packet. So we can initialize USBPacket->ep early and keep it
valid for the whole lifecycle of the USBPacket. Also the devaddr and...

73796fe6 02/10/2012 12:31 pm Gerd Hoffmann

usb: add usb_find_device()

Add usb_find_device(). This function will check whenever a device with
a specific address is connected to the specified port. Usually this
will just check state and address of the device hooked up to the port,
but in case of a hub it will ask the hub to check all hub ports for a...

d1f8b536 02/10/2012 12:12 pm Gerd Hoffmann

usb: kill USB_MSG_{ATTACH,DETACH}

The USB subsystem pipes internal attach/detach notifications through
usb_handle_packet() with a special magic PID. This indirection is a
pretty pointless excercise as it ends up being handled by
usb_generic_handle_packet anyway. Remove it....

d28f4e2d 02/10/2012 12:12 pm Gerd Hoffmann

usb: kill USB_MSG_RESET

The USB subsystem pipes internal reset notifications through
usb_handle_packet() with a special magic PID. This indirection
is a pretty pointless excercise as it ends up being handled by
usb_generic_handle_packet anyway.

Replace the USB_MSG_RESET with a usb_device_reset() function...

70fc20d4 02/10/2012 12:12 pm Gerd Hoffmann

usb: kill usb_send_msg

No users left. Zap it.

Signed-off-by: Gerd Hoffmann <>

62aed765 01/27/2012 06:50 pm Anthony Liguori

usb: convert to QEMU Object Model

Signed-off-by: Anthony Liguori <>

d8e17efd 01/17/2012 10:44 am Gerd Hoffmann

usb: add USBEndpoint

Start maintaining endpoint state at USBDevice level. Add USBEndpoint
struct and some helper functions to deal with it. For now it contains
the endpoint type only. Moved over some bits from usb-linux.c

Signed-off-by: Gerd Hoffmann <>

82f02fe9 01/17/2012 10:44 am Gerd Hoffmann

usb: add ifnum to USBEndpoint

Signed-off-by: Gerd Hoffmann <>

5b6780d0 01/17/2012 10:44 am Gerd Hoffmann

usb/debug: add usb_ep_dump

Add function to dump endpoint data, for debugging purposes.

Signed-off-by: Gerd Hoffmann <>

f003397c 01/17/2012 10:44 am Gerd Hoffmann

usb: add max_packet_size to USBEndpoint

Signed-off-by: Gerd Hoffmann <>

25d5de7d 01/17/2012 10:44 am Gerd Hoffmann

usb: link packets to endpoints not devices

Add USBEndpoint for the control endpoint to USBDevices. Link async
packets to the USBEndpoint instead of the USBDevice.

Signed-off-by: Gerd Hoffmann <>

e0b8e72d 10/13/2011 01:58 pm Gerd Hoffmann

usb: fix port reset

commit 891fb2cd4592b6fe76106a69e0ca40efbf82726a removed the implicit
detach before (re-)attaching in usb_attach(). Some usb host controllers
used that behavior though to do a port reset by a detach+attach
sequence.

This patch establishes old behavior by adding a new usb_reset() function...

4d8debba 09/07/2011 10:58 am Gerd Hoffmann

usb: fix use after free

The ->complete() callback might have released the USBPacket (uhci
actually does), so we must not touch it after the callback returns.

Signed-off-by: Gerd Hoffmann <>

891fb2cd 09/07/2011 10:58 am Gerd Hoffmann

usb: claim port at device initialization time.

This patch makes qemu assign a port when creating the device, not when
attaching it. For most usb devices this isn't a noticable difference
because they are in attached state all the time.

The change affects usb-host devices which live in detached state while...

4f4321c1 08/04/2011 04:51 pm Gerd Hoffmann

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...

d47e59b8 07/05/2011 04:09 pm Hans de Goede

usb: Make port wakeup and complete ops take a USBPort instead of a Device

This makes them consistent with the attach and detach ops, and in general
it makes sense to make portops take a port as argument. This also makes
adding support for a companion controller easier / cleaner....

45b9fd34 07/05/2011 04:09 pm Hans de Goede

usb: assert on calling usb_attach(port, NULL) on a port without a dev

with the "usb-ehci: cleanup port reset handling" patch in place no callers
are calling usb_attach(port, NULL) for a port where port->dev is NULL.

Doing that makes no sense as that causes the port detach op to get called...

53aa8c0e 05/26/2011 12:55 pm Gerd Hoffmann

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 <>

4ff658fb 05/26/2011 12:55 pm Gerd Hoffmann

usb: keep track of packet owner.

Keep track of the device which owns the usb packet for async processing.

Signed-off-by: Gerd Hoffmann <>

eb5e680a 05/26/2011 12:55 pm Gerd Hoffmann

usb: move cancel callback to USBDeviceInfo

Remove the cancel callback from the USBPacket struct, move it over
to USBDeviceInfo. Zap usb_defer_packet() which is obsolete now.

Signed-off-by: Gerd Hoffmann <>

007fd62f 05/26/2011 12:55 pm Hans de Goede

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 <>

50b7963e 05/26/2011 12:55 pm Hans de Goede

usb-linux: use usb_generic_handle_packet()

Make the linux usb host passthrough code use the usb_generic_handle_packet()
function, rather then the curent DYI code. This removes 200 lines of almost
identical code.

Signed-off-by: Hans de Goede <>

19f33223 05/04/2011 01:25 pm Hans de Goede

usb: control buffer fixes

Windows allows control transfers to pass up to 4k of data, so raise our
control buffer size to 4k. For control out transfers the usb core code copies
the control request data to a buffer before calling the device's handle_control...

b6f77fbe 01/11/2011 06:15 pm Gerd Hoffmann

usb: add attach callback

Add handle_attach() callback to USBDeviceInfo which is called by the
generic package handler when the device is attached to the usb bus
(i.e. plugged into a port).

Signed-off-by: Gerd Hoffmann <>

0d86d2be 01/11/2011 06:01 pm Gerd Hoffmann

usb: create USBPortOps, move attach there.

Create USBPortOps struct, move the attach function to that struct.

Signed-off-by: Gerd Hoffmann <>

618c169b 01/11/2011 06:01 pm Gerd Hoffmann

usb: rework attach/detach workflow

Add separate detach callback to USBPortOps, split
uhci/ohci/musb/usbhub attach functions into two.

Move common code to the usb_attach() function, only
the hardware-specific bits remain in the attach/detach
callbacks.

Keep track of the port it is attached to for each usb device....

01eacab6 01/11/2011 06:01 pm Gerd Hoffmann

usb: add usb_wakeup() + wakeup callback to port ops

Add wakeup callback to port ops for remote wakeup handling.
Also add a usb_wakeup() function for devices which want
trigger a remote wakeup.

Signed-off-by: Gerd Hoffmann <>

806b6024 09/09/2009 10:55 pm Gerd Hoffmann

qdev/usb: add usb bus support to qdev, convert drivers.

  • Add USBBus. * Add USBDeviceInfo, move device callbacks here. * Add usb-qdev helper functions. * Switch drivers to qdev.

TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs
added by this patch....

89b9b79f 08/21/2008 10:29 pm aliguori

usb: generic packet handler cleanup and documentation (Max Krasnyansky)

A bit better documentation of the USB device API, namely
return codes.
Rewrite of usb_generic_handle_packet() to make it more
reable and easier to follow.

Signed-off-by: Max Krasnyansky <>...

87ecb68b 11/17/2007 07:14 pm pbrook

Break up vl.h.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162

aa1f17c1 07/12/2007 01:48 am ths

Spelling fixes, by Stefan Weil.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3066 c046a42c-6fe2-441c-8c8c-71466251a162

4d611c9a 08/12/2006 04:04 am pbrook

SCSI and USB async IO support.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2107 c046a42c-6fe2-441c-8c8c-71466251a162

059809e4 07/19/2006 09:06 pm bellard

usb destroy API change (Lonnie Mendez)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2066 c046a42c-6fe2-441c-8c8c-71466251a162

2e5d83bb 05/26/2006 02:58 am pbrook

Rearrange SCSI disk emulation code.
Add USB mass storage device emulation.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1940 c046a42c-6fe2-441c-8c8c-71466251a162

72899afc 04/25/2006 12:18 am bellard

separate file for usb hub device

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1848 c046a42c-6fe2-441c-8c8c-71466251a162

56bebe70 04/25/2006 12:10 am bellard

usb setup state machine fix when driver reads or writes too many bytes

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1847 c046a42c-6fe2-441c-8c8c-71466251a162

ce5c37c2 03/11/2006 10:37 pm pbrook

Fix off by one length calciulation.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1781 c046a42c-6fe2-441c-8c8c-71466251a162

a594cfbf 11/06/2005 06:13 pm bellard

USB user interface

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1603 c046a42c-6fe2-441c-8c8c-71466251a162

92414fdc 11/05/2005 06:55 pm bellard

cosmetics

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1598 c046a42c-6fe2-441c-8c8c-71466251a162

bb36d470 11/05/2005 04:22 pm bellard

initial USB support

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1597 c046a42c-6fe2-441c-8c8c-71466251a162