mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
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>
This commit is contained in:
parent
41c6abbdeb
commit
a980a065fb
11 changed files with 66 additions and 93 deletions
10
hw/usb-hid.c
10
hw/usb-hid.c
|
@ -695,13 +695,6 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
|
|||
}
|
||||
ret = 0;
|
||||
break;
|
||||
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
|
||||
data[0] = 1;
|
||||
ret = 1;
|
||||
break;
|
||||
case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:
|
||||
ret = 0;
|
||||
break;
|
||||
case DeviceRequest | USB_REQ_GET_INTERFACE:
|
||||
data[0] = 0;
|
||||
ret = 1;
|
||||
|
@ -822,7 +815,8 @@ static void usb_hid_handle_destroy(USBDevice *dev)
|
|||
static int usb_hid_initfn(USBDevice *dev, int kind)
|
||||
{
|
||||
USBHIDState *s = DO_UPCAST(USBHIDState, dev, dev);
|
||||
s->dev.speed = USB_SPEED_FULL;
|
||||
|
||||
usb_desc_init(dev);
|
||||
s->kind = kind;
|
||||
|
||||
if (s->kind == USB_MOUSE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue