summaryrefslogtreecommitdiff
path: root/hw/usb/hid-logitech-dj.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/hid-logitech-dj.c')
-rw-r--r--hw/usb/hid-logitech-dj.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/hw/usb/hid-logitech-dj.c b/hw/usb/hid-logitech-dj.c
index 6097f16822..91277b00fe 100644
--- a/hw/usb/hid-logitech-dj.c
+++ b/hw/usb/hid-logitech-dj.c
@@ -481,34 +481,27 @@ static void hidpp_handle_hid(USBDevice *dev, USBPacket *p)
int i;
msg.report_id = DJ_SHORT;
+ memset(hid_data, 0, sizeof(msg.payload));
/* TODO: be more fair, right now the first device always takes all events,
* causing delays for other devices. */
for (i = 0; i < MAX_DEVICES; i++) {
LHidDevice *hd = &s->devices[i];
- if (!hd->info.device_type) {
+ /* ignore empty slots and unreachable devices */
+ if (!hd->info.device_type || !hd->powered_on) {
continue;
}
- if (hd->hid->kind == HID_MOUSE) {
- /* start accepting pointer events if not already */
- hid_pointer_activate(hd->hid);
+ if (usb_ltunify_poll_hid(hd->hid, hid_data, sizeof(msg.payload)) <= 0) {
+ return;
}
- if (!hid_has_events(hd->hid)) {
- continue;
- }
-
- hid_set_next_idle(hd->hid);
-
msg.device_index = i + 1;
if (hd->hid->kind == HID_MOUSE) {
msg.report_type = 0x02;
- hid_pointer_poll(hd->hid, hid_data, sizeof(msg.payload));
} else if (hd->hid->kind == HID_KEYBOARD) {
msg.report_type = 0x01;
- hid_keyboard_poll(hd->hid, hid_data, sizeof(msg.payload));
}
usb_dump_complete_data(s->usb_dump_state, p, data, sizeof(msg));