From de5c8d947b3e197e4f063134ae28c7d29118f95d Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 17 Mar 2014 19:11:18 +0100 Subject: unifying: support HID Get_Report and Set_Report Copied from dev-hid.c (order changed to match interfaces order). Signed-off-by: Peter Wu --- hw/usb/dev-unifying.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'hw/usb/dev-unifying.c') 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; } -- cgit v1.2.1