diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-03-31 12:41:55 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-03-31 12:41:55 +0200 |
commit | 7beab627e87ee378969fd46b7c799de696fc500a (patch) | |
tree | 51446b14a9de7c1bf7f65007a8d867ddbc1af759 /hw/usb | |
parent | 086f6beea02ecf42afb2fcfe0ccef91a5709dfc6 (diff) | |
download | qemu-7beab627e87ee378969fd46b7c799de696fc500a.tar.gz |
unifying: fix Pairing info register
Fix LSB/MSB mix-up, fix incorrect matching against request type.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/hid-logitech-dj.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/hw/usb/hid-logitech-dj.c b/hw/usb/hid-logitech-dj.c index 58d4aecc59..0728be47f6 100644 --- a/hw/usb/hid-logitech-dj.c +++ b/hw/usb/hid-logitech-dj.c @@ -259,28 +259,29 @@ static void hidpp_process_receiver_report(USBLtunifyState *s, HidppMsg *msg) if ((parms[0] >> 4) >= 2 && (parms[0] >> 4) <= 4 && hidpp_device_available(s, 1 + (parms[0] & 0xF))) { LHidDevice *hd = &s->devices[parms[0] & 0xF]; + uint8_t nn = parms[0] & 0xf0; ml->report_id = HIDPP_LONG; memset(parms + 1, 0, sizeof(ml->value) - 1); - if (parms[0] & 0x20) { + if (nn == 0x20) { /* Unifying Device pairing information */ parms[1] = 0x42; /* Destination ID (???) */ parms[2] = hd->report_interval; - parms[3] = (uint8_t) hd->info.wireless_pid; - parms[4] = (uint8_t) (hd->info.wireless_pid >> 8); + parms[3] = hd->info.wireless_pid >> 8; + parms[4] = (uint8_t) hd->info.wireless_pid; parms[7] = hd->info.device_type; - } else if (parms[0] & 0x30) { + } else if (nn == 0x30) { /* Unifying Device extended pairing info */ - parms[1] = (uint8_t) hd->info.serial; - parms[2] = (uint8_t) (hd->info.serial >> 8); - parms[3] = (uint8_t) (hd->info.serial >> 16); - parms[4] = (uint8_t) (hd->info.serial >> 24); - parms[5] = (uint8_t) hd->info.report_types; - parms[6] = (uint8_t) (hd->info.report_types >> 8); - parms[7] = (uint8_t) (hd->info.report_types >> 16); - parms[8] = (uint8_t) (hd->info.report_types >> 24); + parms[1] = hd->info.serial >> 24; + parms[2] = (uint8_t) (hd->info.serial >> 16); + parms[3] = (uint8_t) (hd->info.serial >> 8); + parms[4] = (uint8_t) hd->info.serial; + parms[5] = hd->info.report_types >> 24; + parms[6] = (uint8_t) (hd->info.report_types >> 16); + parms[7] = (uint8_t) (hd->info.report_types >> 8); + parms[8] = (uint8_t) hd->info.report_types; parms[9] = hd->info.usability_info; - } else if (parms[0] & 0x40) { + } else if (nn == 0x40) { /* Unifying Device name */ parms[1] = strlen(hd->info.name); memcpy(parms + 2, hd->info.name, parms[1]); |