Commit Graph

7 Commits

Author SHA1 Message Date
Gerd Hoffmann 25620cba94 usb: add device qualifier support
Add support for device_qualifier and other_speed_config descriptors.
These are used to query the "other speed" configuration of usb 2.0
devices, i.e. in high-speed mode they return the full-speed
configuration and visa versa.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 17:15:24 +01:00
Gerd Hoffmann 32d4191978 usb: add usb_desc_attach
Add usb_desc_attach() which sets up the device according to the speed
the usb port is able to handle.  This function can be hooked into the
handle_attach callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 17:15:24 +01:00
Gerd Hoffmann ed5a83ddd8 usb: move remote wakeup handling to common code
This patch moves setting and clearing the remote_wakeup feature
bit (via USB_REQ_{SET,CLEAR}_FEATURE) to common code.  Also
USB_REQ_GET_STATUS handling is moved to common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann a980a065fb usb: move USB_REQ_{GET,SET}_CONFIGURATION handling to common code
This patch adds fields to the USBDevice struct for the current
speed (hard-wired to full speed for now) and current device
configuration.  Also a init function is added which inializes
these fields.  This allows USB_REQ_{GET,SET}_CONFIGURATION
handling to be moved to common code.

For most drivers the conversion is trivial ad they support a single
configuration only anyway.  One exception is bluetooth where some
device-specific setup code runs after get/set configuration.  The
other is usb-net which actually has two configurations so the
the code to check for the active configuration has been adapted.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann 41c6abbdeb usb: move USB_REQ_SET_ADDRESS handling to common code
USB_REQ_SET_ADDRESS handling is identical in *all* emulated devices.
Move it to common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann 132a3f55f0 usb descriptors: add settable strings.
This patch allows to set usb descriptor strings per device instance.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 37fb59d303 usb: data structs and helpers for usb descriptors.
This patch adds hw/usb-desc.[ch] files.  They carry data structures
for various usb descriptors and helper functions to generate usb
packets from the structures.

The intention is to have a internal representation of the device
desription which is more usable than the current char array blobs,
so we can have common code handle common usb device emulation using
the device description.

The usage of this infrastructure is optional for usb drivers as there
are cases such as pass-through where it probably isn't very useful.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:00 +01:00