mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 15:09:53 +00:00
HID: quirk for MS Wireless Desktop Receiver (model 1028)
Microsoft's wireless desktop receiver (Model 1028) has a bug in the report descriptor -- namely, in four seperate places it uses USAGE_MIN and _MAX when it quite obviously doesn't intend to. In other words, it reports that it has pretty much _everything_ in 'consumer' and 'generic desktop'. And then the X evdev driver believes I have a mouse with 36 absolute axes and a huge pile of keys and buttons, when I in fact, should have zero. 255/256 in three of the cases, and 0-1024 in another. This patch fixes the report descriptor of this device before it enters the HID parser. Signed-off-by: Jim Duchek <jim.duchek@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
f345c37c37
commit
974faac464
@ -335,6 +335,7 @@
|
||||
#define USB_VENDOR_ID_MICROSOFT 0x045e
|
||||
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
|
||||
#define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
|
||||
#define USB_DEVICE_ID_DESKTOP_RECV_1028 0x00f9
|
||||
#define USB_DEVICE_ID_MS_NE4K 0x00db
|
||||
#define USB_DEVICE_ID_MS_LK6K 0x00f9
|
||||
|
||||
@ -724,6 +725,7 @@ static const struct hid_rdesc_blacklist {
|
||||
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER, HID_QUIRK_RDESC_LOGITECH },
|
||||
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER, HID_QUIRK_RDESC_LOGITECH },
|
||||
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2, HID_QUIRK_RDESC_LOGITECH },
|
||||
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_DESKTOP_RECV_1028, HID_QUIRK_RDESC_MICROSOFT_RECV_1028 },
|
||||
|
||||
{ USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER },
|
||||
|
||||
@ -1094,6 +1096,28 @@ static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rs
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Microsoft Wireless Desktop Receiver (Model 1028) has several
|
||||
* 'Usage Min/Max' where it ought to have 'Physical Min/Max'
|
||||
*/
|
||||
static void usbhid_fixup_microsoft_descriptor(unsigned char *rdesc, int rsize)
|
||||
{
|
||||
if (rsize == 571 && rdesc[284] == 0x19
|
||||
&& rdesc[286] == 0x2a
|
||||
&& rdesc[304] == 0x19
|
||||
&& rdesc[306] == 0x29
|
||||
&& rdesc[352] == 0x1a
|
||||
&& rdesc[355] == 0x2a
|
||||
&& rdesc[557] == 0x19
|
||||
&& rdesc[559] == 0x29) {
|
||||
printk(KERN_INFO "Fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
|
||||
rdesc[284] = rdesc[304] = rdesc[558] = 0x35;
|
||||
rdesc[352] = 0x36;
|
||||
rdesc[286] = rdesc[355] = 0x46;
|
||||
rdesc[306] = rdesc[559] = 0x45;
|
||||
}
|
||||
}
|
||||
|
||||
static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize)
|
||||
{
|
||||
if ((quirks & HID_QUIRK_RDESC_CYMOTION))
|
||||
@ -1117,6 +1141,8 @@ static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned
|
||||
if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE)
|
||||
usbhid_fixup_samsung_irda_descriptor(rdesc, rsize);
|
||||
|
||||
if (quirks & HID_QUIRK_RDESC_MICROSOFT_RECV_1028)
|
||||
usbhid_fixup_microsoft_descriptor(rdesc, rsize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,6 +297,7 @@ struct hid_item {
|
||||
#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
|
||||
#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
|
||||
#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
|
||||
#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080
|
||||
|
||||
/*
|
||||
* This is the global environment of the parser. This information is
|
||||
|
Loading…
Reference in New Issue
Block a user