summaryrefslogtreecommitdiff
path: root/hw/usb/dev-unifying.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-17 19:11:18 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-03-17 19:11:18 +0100
commitde5c8d947b3e197e4f063134ae28c7d29118f95d (patch)
tree152f5b6ecba201d5a5c5c67f258113ed6e186ba6 /hw/usb/dev-unifying.c
parent22397d6ee5f5fb1e60f28120fcb18c431741f974 (diff)
downloadqemu-de5c8d947b3e197e4f063134ae28c7d29118f95d.tar.gz
unifying: support HID Get_Report and Set_Report
Copied from dev-hid.c (order changed to match interfaces order). Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw/usb/dev-unifying.c')
-rw-r--r--hw/usb/dev-unifying.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/hw/usb/dev-unifying.c b/hw/usb/dev-unifying.c
index c525ddb29c..8c3e7335fd 100644
--- a/hw/usb/dev-unifying.c
+++ b/hw/usb/dev-unifying.c
@@ -401,16 +401,20 @@ static void usb_ltunify_handle_control_hid(USBDevice *dev, USBPacket *p,
switch (request) {
case HID_GET_REPORT:
- // report_type = (uint8_t) (value >> 8);
- // report_id = (uint8_t) value;
- // length
- // data
+ if (hs->kind == HID_KEYBOARD) {
+ p->actual_length = hid_keyboard_poll(hs, data, length);
+ } else if (hs->kind == HID_MOUSE) {
+ p->actual_length = hid_pointer_poll(hs, data, length);
+ }
break;
case HID_SET_REPORT:
- // report_type = (uint8_t) (value >> 8);
- // report_id = (uint8_t) value;
- // length
- // data
+ if (hs->kind == HID_KEYBOARD) {
+ /* for toggling LEDs */
+ p->actual_length = hid_keyboard_write(hs, data, length);
+ } else {
+ /* not applicable for mice */
+ goto fail;
+ }
break;
case HID_GET_IDLE:
/* Idle rates for specific Report IDs should be implemented by checking
@@ -435,6 +439,7 @@ static void usb_ltunify_handle_control_hid(USBDevice *dev, USBPacket *p,
hs->protocol = data[0];
break;
default:
+ fail:
p->status = USB_RET_STALL;
break;
}