mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
a980a065fb
commit
ed5a83ddd8
9 changed files with 31 additions and 155 deletions
23
hw/usb-msd.c
23
hw/usb-msd.c
|
@ -239,28 +239,6 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
|
|||
|
||||
ret = 0;
|
||||
switch (request) {
|
||||
case DeviceRequest | USB_REQ_GET_STATUS:
|
||||
data[0] = (1 << USB_DEVICE_SELF_POWERED) |
|
||||
(dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP);
|
||||
data[1] = 0x00;
|
||||
ret = 2;
|
||||
break;
|
||||
case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
|
||||
if (value == USB_DEVICE_REMOTE_WAKEUP) {
|
||||
dev->remote_wakeup = 0;
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
case DeviceOutRequest | USB_REQ_SET_FEATURE:
|
||||
if (value == USB_DEVICE_REMOTE_WAKEUP) {
|
||||
dev->remote_wakeup = 1;
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
case DeviceRequest | USB_REQ_GET_INTERFACE:
|
||||
data[0] = 0;
|
||||
ret = 1;
|
||||
|
@ -285,7 +263,6 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
|
|||
ret = 1;
|
||||
break;
|
||||
default:
|
||||
fail:
|
||||
ret = USB_RET_STALL;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue