From 7c530e39d3f61761f4f5b97b4f61c83773151413 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 23 Mar 2014 17:00:54 +0100 Subject: unifying: interface with HID++ 2.0 features Prepare for adding more HID++ 2.0 features. --- hw/usb/hid-logitech-dj.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'hw/usb/hid-logitech-dj.c') diff --git a/hw/usb/hid-logitech-dj.c b/hw/usb/hid-logitech-dj.c index caa0383bc9..6de5fa4ba1 100644 --- a/hw/usb/hid-logitech-dj.c +++ b/hw/usb/hid-logitech-dj.c @@ -400,6 +400,7 @@ static void hidpp_process_device_hidpp20(USBLtunifyState *s, HidppMsg *msg) LHidDevice *hd = &s->devices[msg->device_index - 1]; Hidpp20Msg *func = (Hidpp20Msg *) msg; uint8_t fn = func->func >> 4; + int r; if (func->feat_index == 0) { /* IRoot */ if (fn == 1) { /* GetProtocolVersion */ @@ -411,7 +412,14 @@ static void hidpp_process_device_hidpp20(USBLtunifyState *s, HidppMsg *msg) } return; } - /* TODO: implement features and more functions */ + + r = hidpp20_feature_call(hd, func); + /* note: if r == 0, then the function is void and there is no output */ + if (r > 0) { + hidpp_queue_output_report(s, msg); + } else if (r < 0) { + hidpp20_queue_error(s, func, -r); + } } @@ -622,6 +630,7 @@ static void hidpp_init_device(USBLtunifyState *s, int device_index, int devtype) hd->report_interval = 8; break; } + hidpp20_init_features(hd); hd->info.protocol_version = 0x0200; /* HID++ 2.0 */ hd->mode = LTUNIFY_MODE_HID; hd->powered_on = true; -- cgit v1.2.1