diff options
author | Jiri Kosina <jkosina@suse.cz> | 2008-03-14 11:53:07 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-04-22 05:34:57 -0400 |
commit | 5f1ab74f650b392ebcaa7cf3283e56d8dc6c7e56 (patch) | |
tree | f53c417f6353cdb66ba9c81ef1a2ba9f2073f5ad | |
parent | 974faac46455076c709a745f546b348017ad18dc (diff) |
HID: Sunplus Wireless Desktop needs report descriptor fixup
This device has reports lower logical maximum compared to the real
usages for Zoom+ and Zoom- it emits.
This patch bumps the values in the report descriptor up, and also
adjusts HID_MAX_USAGE accordingly.
Reported-by: Khelben Blackstaff <eye.of.the.8eholder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-input-quirks.c | 22 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 19 | ||||
-rw-r--r-- | include/linux/hid.h | 3 |
3 files changed, 42 insertions, 2 deletions
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c index dceadd0c1419..845d31d08fa5 100644 --- a/drivers/hid/hid-input-quirks.c +++ b/drivers/hid/hid-input-quirks.c | |||
@@ -276,6 +276,21 @@ static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input, | |||
276 | return 1; | 276 | return 1; |
277 | } | 277 | } |
278 | 278 | ||
279 | static int quirk_sunplus_wdesktop(struct hid_usage *usage, struct input_dev *input, | ||
280 | unsigned long **bit, int *max) | ||
281 | { | ||
282 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
283 | return 0; | ||
284 | |||
285 | switch (usage->hid & HID_USAGE) { | ||
286 | case 0x2003: map_key_clear(KEY_ZOOMIN); break; | ||
287 | case 0x2103: map_key_clear(KEY_ZOOMOUT); break; | ||
288 | default: | ||
289 | return 0; | ||
290 | } | ||
291 | return 1; | ||
292 | } | ||
293 | |||
279 | #define VENDOR_ID_BELKIN 0x1020 | 294 | #define VENDOR_ID_BELKIN 0x1020 |
280 | #define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 | 295 | #define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 |
281 | 296 | ||
@@ -306,6 +321,9 @@ static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input, | |||
306 | #define VENDOR_ID_PETALYNX 0x18b1 | 321 | #define VENDOR_ID_PETALYNX 0x18b1 |
307 | #define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | 322 | #define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 |
308 | 323 | ||
324 | #define VENDOR_ID_SUNPLUS 0x04fc | ||
325 | #define DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | ||
326 | |||
309 | static const struct hid_input_blacklist { | 327 | static const struct hid_input_blacklist { |
310 | __u16 idVendor; | 328 | __u16 idVendor; |
311 | __u16 idProduct; | 329 | __u16 idProduct; |
@@ -332,7 +350,9 @@ static const struct hid_input_blacklist { | |||
332 | { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, | 350 | { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, |
333 | 351 | ||
334 | { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote }, | 352 | { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote }, |
335 | 353 | ||
354 | { VENDOR_ID_SUNPLUS, DEVICE_ID_SUNPLUS_WDESKTOP, quirk_sunplus_wdesktop }, | ||
355 | |||
336 | { 0, 0, 0 } | 356 | { 0, 0, 0 } |
337 | }; | 357 | }; |
338 | 358 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 81dc5e353dd8..f06356512067 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -381,6 +381,9 @@ | |||
381 | #define USB_VENDOR_ID_SUN 0x0430 | 381 | #define USB_VENDOR_ID_SUN 0x0430 |
382 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 382 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
383 | 383 | ||
384 | #define USB_VENDOR_ID_SUNPLUS 0x04fc | ||
385 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | ||
386 | |||
384 | #define USB_VENDOR_ID_TOPMAX 0x0663 | 387 | #define USB_VENDOR_ID_TOPMAX 0x0663 |
385 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 | 388 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 |
386 | 389 | ||
@@ -735,6 +738,8 @@ static const struct hid_rdesc_blacklist { | |||
735 | 738 | ||
736 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, | 739 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, |
737 | 740 | ||
741 | { USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP, HID_QUIRK_RDESC_SUNPLUS_WDESKTOP }, | ||
742 | |||
738 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, | 743 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, |
739 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, | 744 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, |
740 | 745 | ||
@@ -1009,6 +1014,17 @@ static void usbhid_fixup_logitech_descriptor(unsigned char *rdesc, int rsize) | |||
1009 | } | 1014 | } |
1010 | } | 1015 | } |
1011 | 1016 | ||
1017 | static void usbhid_fixup_sunplus_wdesktop(unsigned char *rdesc, int rsize) | ||
1018 | { | ||
1019 | if (rsize >= 107 && rdesc[104] == 0x26 | ||
1020 | && rdesc[105] == 0x80 | ||
1021 | && rdesc[106] == 0x03) { | ||
1022 | printk(KERN_INFO "Fixing up Sunplus Wireless Desktop report descriptor\n"); | ||
1023 | rdesc[105] = rdesc[110] = 0x03; | ||
1024 | rdesc[106] = rdesc[111] = 0x21; | ||
1025 | } | ||
1026 | } | ||
1027 | |||
1012 | /* | 1028 | /* |
1013 | * Samsung IrDA remote controller (reports as Cypress USB Mouse). | 1029 | * Samsung IrDA remote controller (reports as Cypress USB Mouse). |
1014 | * | 1030 | * |
@@ -1182,4 +1198,7 @@ void usbhid_fixup_report_descriptor(const u16 idVendor, const u16 idProduct, | |||
1182 | __usbhid_fixup_report_descriptor(quirks, rdesc, rsize); | 1198 | __usbhid_fixup_report_descriptor(quirks, rdesc, rsize); |
1183 | } | 1199 | } |
1184 | 1200 | ||
1201 | if (quirks & HID_QUIRK_RDESC_SUNPLUS_WDESKTOP) | ||
1202 | usbhid_fixup_sunplus_wdesktop(rdesc, rsize); | ||
1203 | |||
1185 | } | 1204 | } |
diff --git a/include/linux/hid.h b/include/linux/hid.h index e9701f22d423..5bf6282f1635 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -298,6 +298,7 @@ struct hid_item { | |||
298 | #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 | 298 | #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 |
299 | #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 | 299 | #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 |
300 | #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 | 300 | #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 |
301 | #define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100 | ||
301 | 302 | ||
302 | /* | 303 | /* |
303 | * This is the global environment of the parser. This information is | 304 | * This is the global environment of the parser. This information is |
@@ -322,7 +323,7 @@ struct hid_global { | |||
322 | * This is the local environment. It is persistent up the next main-item. | 323 | * This is the local environment. It is persistent up the next main-item. |
323 | */ | 324 | */ |
324 | 325 | ||
325 | #define HID_MAX_USAGES 8192 | 326 | #define HID_MAX_USAGES 12288 |
326 | #define HID_DEFAULT_NUM_COLLECTIONS 16 | 327 | #define HID_DEFAULT_NUM_COLLECTIONS 16 |
327 | 328 | ||
328 | struct hid_local { | 329 | struct hid_local { |