aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-10-23 16:49:32 -0400
committerJiri Kosina <jkosina@suse.cz>2010-10-23 16:49:32 -0400
commit8b66a16f25f819bb1f132f075c5c01a288776cf8 (patch)
treeff6e16818194aca66d8ea34f9765067b2a82020a /drivers/hid
parentbbd128b5acae85b2ef346e95cc5a729ac5252f19 (diff)
parent41fa92302be7fa37c5c38e17e2097d3e5e9da13a (diff)
Merge branch 'uc-logic' into for-linus
Conflicts: drivers/hid/hid-ids.h drivers/hid/hid-lg.c drivers/hid/usbhid/hid-quirks.c
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig6
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-apple.c7
-rw-r--r--drivers/hid/hid-cherry.c7
-rw-r--r--drivers/hid/hid-core.c6
-rw-r--r--drivers/hid/hid-cypress.c9
-rw-r--r--drivers/hid/hid-elecom.c7
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-input.c4
-rw-r--r--drivers/hid/hid-kye.c7
-rw-r--r--drivers/hid/hid-lg.c10
-rw-r--r--drivers/hid/hid-microsoft.c7
-rw-r--r--drivers/hid/hid-monterey.c7
-rw-r--r--drivers/hid/hid-ortek.c7
-rw-r--r--drivers/hid/hid-petalynx.c7
-rw-r--r--drivers/hid/hid-prodikeys.c7
-rw-r--r--drivers/hid/hid-samsung.c20
-rw-r--r--drivers/hid/hid-sony.c7
-rw-r--r--drivers/hid/hid-sunplus.c7
-rw-r--r--drivers/hid/hid-uclogic.c623
-rw-r--r--drivers/hid/hid-zydacron.c7
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
22 files changed, 713 insertions, 56 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 68a7e862068e..2685beebc8dc 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -176,6 +176,12 @@ config HID_KYE
176 ---help--- 176 ---help---
177 Support for Kye/Genius Ergo Mouse. 177 Support for Kye/Genius Ergo Mouse.
178 178
179config HID_UCLOGIC
180 tristate "UC-Logic"
181 depends on USB_HID
182 ---help---
183 Support for UC-Logic tablets.
184
179config HID_GYRATION 185config HID_GYRATION
180 tristate "Gyration remote control" 186 tristate "Gyration remote control"
181 depends on USB_HID 187 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index ad74abcc73d5..62ab1383a99b 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -65,6 +65,7 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
65obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o 65obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
66obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o 66obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
67obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o 67obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o
68obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o
68obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o 69obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o
69obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o 70obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o
70obj-$(CONFIG_HID_WACOM) += hid-wacom.o 71obj-$(CONFIG_HID_WACOM) += hid-wacom.o
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index bba05d0a8980..eaeca564a8d3 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -246,17 +246,18 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field,
246/* 246/*
247 * MacBook JIS keyboard has wrong logical maximum 247 * MacBook JIS keyboard has wrong logical maximum
248 */ 248 */
249static void apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, 249static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
250 unsigned int rsize) 250 unsigned int *rsize)
251{ 251{
252 struct apple_sc *asc = hid_get_drvdata(hdev); 252 struct apple_sc *asc = hid_get_drvdata(hdev);
253 253
254 if ((asc->quirks & APPLE_RDESC_JIS) && rsize >= 60 && 254 if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
255 rdesc[53] == 0x65 && rdesc[59] == 0x65) { 255 rdesc[53] == 0x65 && rdesc[59] == 0x65) {
256 dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " 256 dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report "
257 "descriptor\n"); 257 "descriptor\n");
258 rdesc[53] = rdesc[59] = 0xe7; 258 rdesc[53] = rdesc[59] = 0xe7;
259 } 259 }
260 return rdesc;
260} 261}
261 262
262static void apple_setup_input(struct input_dev *input) 263static void apple_setup_input(struct input_dev *input)
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
index 24663a8717b1..e880086c2311 100644
--- a/drivers/hid/hid-cherry.c
+++ b/drivers/hid/hid-cherry.c
@@ -26,15 +26,16 @@
26 * Cherry Cymotion keyboard have an invalid HID report descriptor, 26 * Cherry Cymotion keyboard have an invalid HID report descriptor,
27 * that needs fixing before we can parse it. 27 * that needs fixing before we can parse it.
28 */ 28 */
29static void ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, 29static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
30 unsigned int rsize) 30 unsigned int *rsize)
31{ 31{
32 if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { 32 if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
33 dev_info(&hdev->dev, "fixing up Cherry Cymotion report " 33 dev_info(&hdev->dev, "fixing up Cherry Cymotion report "
34 "descriptor\n"); 34 "descriptor\n");
35 rdesc[11] = rdesc[16] = 0xff; 35 rdesc[11] = rdesc[16] = 0xff;
36 rdesc[12] = rdesc[17] = 0x03; 36 rdesc[12] = rdesc[17] = 0x03;
37 } 37 }
38 return rdesc;
38} 39}
39 40
40#define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 41#define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index cb7dc99d8b29..9eb5c0226ea4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -651,7 +651,7 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
651 }; 651 };
652 652
653 if (device->driver->report_fixup) 653 if (device->driver->report_fixup)
654 device->driver->report_fixup(device, start, size); 654 start = device->driver->report_fixup(device, start, &size);
655 655
656 device->rdesc = kmemdup(start, size, GFP_KERNEL); 656 device->rdesc = kmemdup(start, size, GFP_KERNEL);
657 if (device->rdesc == NULL) 657 if (device->rdesc == NULL)
@@ -1395,6 +1395,10 @@ static const struct hid_device_id hid_blacklist[] = {
1395 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1395 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1396 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 1396 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
1397 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1397 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
1398 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
1399 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
1400 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
1401 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) },
1398 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 1402 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
1399 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 1403 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
1400 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1404 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index 998b6f443d7d..4cd0e2345991 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -31,16 +31,16 @@
31 * Some USB barcode readers from cypress have usage min and usage max in 31 * Some USB barcode readers from cypress have usage min and usage max in
32 * the wrong order 32 * the wrong order
33 */ 33 */
34static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, 34static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
35 unsigned int rsize) 35 unsigned int *rsize)
36{ 36{
37 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); 37 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
38 unsigned int i; 38 unsigned int i;
39 39
40 if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) 40 if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
41 return; 41 return rdesc;
42 42
43 for (i = 0; i < rsize - 4; i++) 43 for (i = 0; i < *rsize - 4; i++)
44 if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) { 44 if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
45 __u8 tmp; 45 __u8 tmp;
46 46
@@ -50,6 +50,7 @@ static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
50 rdesc[i + 3] = rdesc[i + 1]; 50 rdesc[i + 3] = rdesc[i + 1];
51 rdesc[i + 1] = tmp; 51 rdesc[i + 1] = tmp;
52 } 52 }
53 return rdesc;
53} 54}
54 55
55static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, 56static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c
index 7a40878f46b4..6e31f305397d 100644
--- a/drivers/hid/hid-elecom.c
+++ b/drivers/hid/hid-elecom.c
@@ -20,14 +20,15 @@
20 20
21#include "hid-ids.h" 21#include "hid-ids.h"
22 22
23static void elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, 23static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
24 unsigned int rsize) 24 unsigned int *rsize)
25{ 25{
26 if (rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 26 if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
27 dev_info(&hdev->dev, "Fixing up Elecom BM084 " 27 dev_info(&hdev->dev, "Fixing up Elecom BM084 "
28 "report descriptor.\n"); 28 "report descriptor.\n");
29 rdesc[47] = 0x00; 29 rdesc[47] = 0x00;
30 } 30 }
31 return rdesc;
31} 32}
32 33
33static const struct hid_device_id elecom_devices[] = { 34static const struct hid_device_id elecom_devices[] = {
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ae8f74431d92..afbd82075f96 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -527,8 +527,10 @@
527 527
528#define USB_VENDOR_ID_UCLOGIC 0x5543 528#define USB_VENDOR_ID_UCLOGIC 0x5543
529#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 529#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042
530#define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003
531#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 530#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001
531#define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003
532#define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004
533#define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005
532 534
533#define USB_VENDOR_ID_VERNIER 0x08f7 535#define USB_VENDOR_ID_VERNIER 0x08f7
534#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 536#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index b9877a86eca7..834ef47b76d6 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -413,6 +413,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
413 map_key_clear(BTN_STYLUS); 413 map_key_clear(BTN_STYLUS);
414 break; 414 break;
415 415
416 case 0x46: /* TabletPick */
417 map_key_clear(BTN_STYLUS2);
418 break;
419
416 default: goto unknown; 420 default: goto unknown;
417 } 421 }
418 break; 422 break;
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
index f8871712b7b5..817247ee006c 100644
--- a/drivers/hid/hid-kye.c
+++ b/drivers/hid/hid-kye.c
@@ -23,10 +23,10 @@
23 * - report size 8 count 1 must be size 1 count 8 for button bitfield 23 * - report size 8 count 1 must be size 1 count 8 for button bitfield
24 * - change the button usage range to 4-7 for the extra buttons 24 * - change the button usage range to 4-7 for the extra buttons
25 */ 25 */
26static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, 26static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27 unsigned int rsize) 27 unsigned int *rsize)
28{ 28{
29 if (rsize >= 74 && 29 if (*rsize >= 74 &&
30 rdesc[61] == 0x05 && rdesc[62] == 0x08 && 30 rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
31 rdesc[63] == 0x19 && rdesc[64] == 0x08 && 31 rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
32 rdesc[65] == 0x29 && rdesc[66] == 0x0f && 32 rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
@@ -40,6 +40,7 @@ static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 rdesc[72] = 0x01; 40 rdesc[72] = 0x01;
41 rdesc[74] = 0x08; 41 rdesc[74] = 0x08;
42 } 42 }
43 return rdesc;
43} 44}
44 45
45static const struct hid_device_id kye_devices[] = { 46static const struct hid_device_id kye_devices[] = {
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 9e92c27002ca..6d3cd7e5fa91 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -46,26 +46,25 @@
46 * above the logical maximum described in descriptor. This extends 46 * above the logical maximum described in descriptor. This extends
47 * the original value of 0x28c of logical maximum to 0x104d 47 * the original value of 0x28c of logical maximum to 0x104d
48 */ 48 */
49static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, 49static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
50 unsigned int rsize) 50 unsigned int *rsize)
51{ 51{
52 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); 52 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
53 53
54 if ((quirks & LG_RDESC) && rsize >= 90 && rdesc[83] == 0x26 && 54 if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
55 rdesc[84] == 0x8c && rdesc[85] == 0x02) { 55 rdesc[84] == 0x8c && rdesc[85] == 0x02) {
56 dev_info(&hdev->dev, "fixing up Logitech keyboard report " 56 dev_info(&hdev->dev, "fixing up Logitech keyboard report "
57 "descriptor\n"); 57 "descriptor\n");
58 rdesc[84] = rdesc[89] = 0x4d; 58 rdesc[84] = rdesc[89] = 0x4d;
59 rdesc[85] = rdesc[90] = 0x10; 59 rdesc[85] = rdesc[90] = 0x10;
60 } 60 }
61 if ((quirks & LG_RDESC_REL_ABS) && rsize >= 50 && 61 if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
62 rdesc[32] == 0x81 && rdesc[33] == 0x06 && 62 rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
63 rdesc[49] == 0x81 && rdesc[50] == 0x06) { 63 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
64 dev_info(&hdev->dev, "fixing up rel/abs in Logitech " 64 dev_info(&hdev->dev, "fixing up rel/abs in Logitech "
65 "report descriptor\n"); 65 "report descriptor\n");
66 rdesc[33] = rdesc[50] = 0x02; 66 rdesc[33] = rdesc[50] = 0x02;
67 } 67 }
68
69 if ((quirks & LG_FF4) && rsize >= 101 && 68 if ((quirks & LG_FF4) && rsize >= 101 &&
70 rdesc[41] == 0x95 && rdesc[42] == 0x0B && 69 rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
71 rdesc[47] == 0x05 && rdesc[48] == 0x09) { 70 rdesc[47] == 0x05 && rdesc[48] == 0x09) {
@@ -76,6 +75,7 @@ static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
76 rdesc[47] = 0x95; 75 rdesc[47] = 0x95;
77 rdesc[48] = 0x0B; 76 rdesc[48] = 0x0B;
78 } 77 }
78 return rdesc;
79} 79}
80 80
81#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 81#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 359cc447c6c6..dc618c33d0a2 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -33,18 +33,19 @@
33 * Microsoft Wireless Desktop Receiver (Model 1028) has 33 * Microsoft Wireless Desktop Receiver (Model 1028) has
34 * 'Usage Min/Max' where it ought to have 'Physical Min/Max' 34 * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
35 */ 35 */
36static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, 36static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
37 unsigned int rsize) 37 unsigned int *rsize)
38{ 38{
39 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); 39 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
40 40
41 if ((quirks & MS_RDESC) && rsize == 571 && rdesc[557] == 0x19 && 41 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
42 rdesc[559] == 0x29) { 42 rdesc[559] == 0x29) {
43 dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " 43 dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver "
44 "Model 1028 report descriptor\n"); 44 "Model 1028 report descriptor\n");
45 rdesc[557] = 0x35; 45 rdesc[557] = 0x35;
46 rdesc[559] = 0x45; 46 rdesc[559] = 0x45;
47 } 47 }
48 return rdesc;
48} 49}
49 50
50#define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 51#define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
index 2cd05aa244b9..c95c31e2d869 100644
--- a/drivers/hid/hid-monterey.c
+++ b/drivers/hid/hid-monterey.c
@@ -22,14 +22,15 @@
22 22
23#include "hid-ids.h" 23#include "hid-ids.h"
24 24
25static void mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, 25static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int rsize) 26 unsigned int *rsize)
27{ 27{
28 if (rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { 28 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
29 dev_info(&hdev->dev, "fixing up button/consumer in HID report " 29 dev_info(&hdev->dev, "fixing up button/consumer in HID report "
30 "descriptor\n"); 30 "descriptor\n");
31 rdesc[30] = 0x0c; 31 rdesc[30] = 0x0c;
32 } 32 }
33 return rdesc;
33} 34}
34 35
35#define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 36#define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index aa9a960f73a4..2e79716dca31 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -19,14 +19,15 @@
19 19
20#include "hid-ids.h" 20#include "hid-ids.h"
21 21
22static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, 22static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
23 unsigned int rsize) 23 unsigned int *rsize)
24{ 24{
25 if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 25 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
26 dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " 26 dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
27 "report descriptor.\n"); 27 "report descriptor.\n");
28 rdesc[55] = 0x92; 28 rdesc[55] = 0x92;
29 } 29 }
30 return rdesc;
30} 31}
31 32
32static const struct hid_device_id ortek_devices[] = { 33static const struct hid_device_id ortek_devices[] = {
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c
index 500fbd0652dc..308d6ae48a3e 100644
--- a/drivers/hid/hid-petalynx.c
+++ b/drivers/hid/hid-petalynx.c
@@ -23,10 +23,10 @@
23#include "hid-ids.h" 23#include "hid-ids.h"
24 24
25/* Petalynx Maxter Remote has maximum for consumer page set too low */ 25/* Petalynx Maxter Remote has maximum for consumer page set too low */
26static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, 26static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27 unsigned int rsize) 27 unsigned int *rsize)
28{ 28{
29 if (rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && 29 if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
30 rdesc[41] == 0x00 && rdesc[59] == 0x26 && 30 rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) { 31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
32 dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " 32 dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report "
@@ -34,6 +34,7 @@ static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
34 rdesc[60] = 0xfa; 34 rdesc[60] = 0xfa;
35 rdesc[40] = 0xfa; 35 rdesc[40] = 0xfa;
36 } 36 }
37 return rdesc;
37} 38}
38 39
39#define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 40#define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 845f428b8090..48eab84f53b5 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -740,10 +740,10 @@ int pcmidi_snd_terminate(struct pcmidi_snd *pm)
740/* 740/*
741 * PC-MIDI report descriptor for report id is wrong. 741 * PC-MIDI report descriptor for report id is wrong.
742 */ 742 */
743static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, 743static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
744 unsigned int rsize) 744 unsigned int *rsize)
745{ 745{
746 if (rsize == 178 && 746 if (*rsize == 178 &&
747 rdesc[111] == 0x06 && rdesc[112] == 0x00 && 747 rdesc[111] == 0x06 && rdesc[112] == 0x00 &&
748 rdesc[113] == 0xff) { 748 rdesc[113] == 0xff) {
749 dev_info(&hdev->dev, "fixing up pc-midi keyboard report " 749 dev_info(&hdev->dev, "fixing up pc-midi keyboard report "
@@ -751,6 +751,7 @@ static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
751 751
752 rdesc[144] = 0x18; /* report 4: was 0x10 report count */ 752 rdesc[144] = 0x18; /* report 4: was 0x10 report count */
753 } 753 }
754 return rdesc;
754} 755}
755 756
756static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, 757static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi,
diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
index bda0fd60c98d..35894444e000 100644
--- a/drivers/hid/hid-samsung.c
+++ b/drivers/hid/hid-samsung.c
@@ -61,10 +61,10 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev,
61 "descriptor\n", rsize); 61 "descriptor\n", rsize);
62} 62}
63 63
64static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, 64static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
65 unsigned int rsize) 65 unsigned int *rsize)
66{ 66{
67 if (rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && 67 if (*rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 &&
68 rdesc[177] == 0x75 && rdesc[178] == 0x30 && 68 rdesc[177] == 0x75 && rdesc[178] == 0x30 &&
69 rdesc[179] == 0x95 && rdesc[180] == 0x01 && 69 rdesc[179] == 0x95 && rdesc[180] == 0x01 &&
70 rdesc[182] == 0x40) { 70 rdesc[182] == 0x40) {
@@ -74,24 +74,25 @@ static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
74 rdesc[180] = 0x06; 74 rdesc[180] = 0x06;
75 rdesc[182] = 0x42; 75 rdesc[182] = 0x42;
76 } else 76 } else
77 if (rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 && 77 if (*rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 &&
78 rdesc[194] == 0x25 && rdesc[195] == 0x12) { 78 rdesc[194] == 0x25 && rdesc[195] == 0x12) {
79 samsung_irda_dev_trace(hdev, 203); 79 samsung_irda_dev_trace(hdev, 203);
80 rdesc[193] = 0x1; 80 rdesc[193] = 0x1;
81 rdesc[195] = 0xf; 81 rdesc[195] = 0xf;
82 } else 82 } else
83 if (rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 && 83 if (*rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 &&
84 rdesc[126] == 0x25 && rdesc[127] == 0x11) { 84 rdesc[126] == 0x25 && rdesc[127] == 0x11) {
85 samsung_irda_dev_trace(hdev, 135); 85 samsung_irda_dev_trace(hdev, 135);
86 rdesc[125] = 0x1; 86 rdesc[125] = 0x1;
87 rdesc[127] = 0xe; 87 rdesc[127] = 0xe;
88 } else 88 } else
89 if (rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 && 89 if (*rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 &&
90 rdesc[162] == 0x25 && rdesc[163] == 0x01) { 90 rdesc[162] == 0x25 && rdesc[163] == 0x01) {
91 samsung_irda_dev_trace(hdev, 171); 91 samsung_irda_dev_trace(hdev, 171);
92 rdesc[161] = 0x1; 92 rdesc[161] = 0x1;
93 rdesc[163] = 0x3; 93 rdesc[163] = 0x3;
94 } 94 }
95 return rdesc;
95} 96}
96 97
97#define samsung_kbd_mouse_map_key_clear(c) \ 98#define samsung_kbd_mouse_map_key_clear(c) \
@@ -130,11 +131,12 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
130 return 1; 131 return 1;
131} 132}
132 133
133static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, 134static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
134 unsigned int rsize) 135 unsigned int *rsize)
135{ 136{
136 if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) 137 if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product)
137 samsung_irda_report_fixup(hdev, rdesc, rsize); 138 rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize);
139 return rdesc;
138} 140}
139 141
140static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi, 142static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 0c164b3dce3a..677bb3da10e8 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -33,17 +33,18 @@ struct sony_sc {
33}; 33};
34 34
35/* Sony Vaio VGX has wrongly mouse pointer declared as constant */ 35/* Sony Vaio VGX has wrongly mouse pointer declared as constant */
36static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, 36static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
37 unsigned int rsize) 37 unsigned int *rsize)
38{ 38{
39 struct sony_sc *sc = hid_get_drvdata(hdev); 39 struct sony_sc *sc = hid_get_drvdata(hdev);
40 40
41 if ((sc->quirks & VAIO_RDESC_CONSTANT) && 41 if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
42 rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { 42 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
43 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " 43 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report "
44 "descriptor\n"); 44 "descriptor\n");
45 rdesc[55] = 0x06; 45 rdesc[55] = 0x06;
46 } 46 }
47 return rdesc;
47} 48}
48 49
49static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf, 50static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
index 438107d9f1b2..164ed568f6cf 100644
--- a/drivers/hid/hid-sunplus.c
+++ b/drivers/hid/hid-sunplus.c
@@ -22,16 +22,17 @@
22 22
23#include "hid-ids.h" 23#include "hid-ids.h"
24 24
25static void sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, 25static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int rsize) 26 unsigned int *rsize)
27{ 27{
28 if (rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && 28 if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
29 rdesc[106] == 0x03) { 29 rdesc[106] == 0x03) {
30 dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " 30 dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop "
31 "report descriptor\n"); 31 "report descriptor\n");
32 rdesc[105] = rdesc[110] = 0x03; 32 rdesc[105] = rdesc[110] = 0x03;
33 rdesc[106] = rdesc[111] = 0x21; 33 rdesc[106] = rdesc[111] = 0x21;
34 } 34 }
35 return rdesc;
35} 36}
36 37
37#define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 38#define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
new file mode 100644
index 000000000000..05fdc85a76e5
--- /dev/null
+++ b/drivers/hid/hid-uclogic.c
@@ -0,0 +1,623 @@
1/*
2 * HID driver for UC-Logic devices not fully compliant with HID standard
3 *
4 * Copyright (c) 2010 Nikolai Kondrashov
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 */
13
14#include <linux/device.h>
15#include <linux/hid.h>
16#include <linux/module.h>
17
18#include "hid-ids.h"
19
20/*
21 * The original descriptors of WPXXXXU tablets have three report IDs, of
22 * which only two are used (8 and 9), and the remaining (7) seems to have
23 * the originally intended pen description which was abandoned for some
24 * reason. From this unused description it is possible to extract the
25 * actual physical extents and resolution. All the models use the same
26 * descriptor with different extents for the unused report ID.
27 *
28 * Here it is:
29 *
30 * Usage Page (Digitizer), ; Digitizer (0Dh)
31 * Usage (Pen), ; Pen (02h, application collection)
32 * Collection (Application),
33 * Report ID (7),
34 * Usage (Stylus), ; Stylus (20h, logical collection)
35 * Collection (Physical),
36 * Usage (Tip Switch), ; Tip switch (42h, momentary control)
37 * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
38 * Usage (Eraser), ; Eraser (45h, momentary control)
39 * Logical Minimum (0),
40 * Logical Maximum (1),
41 * Report Size (1),
42 * Report Count (3),
43 * Input (Variable),
44 * Report Count (3),
45 * Input (Constant, Variable),
46 * Usage (In Range), ; In range (32h, momentary control)
47 * Report Count (1),
48 * Input (Variable),
49 * Report Count (1),
50 * Input (Constant, Variable),
51 * Usage Page (Desktop), ; Generic desktop controls (01h)
52 * Usage (X), ; X (30h, dynamic value)
53 * Report Size (16),
54 * Report Count (1),
55 * Push,
56 * Unit Exponent (13),
57 * Unit (Inch^3),
58 * Physical Minimum (0),
59 * Physical Maximum (Xpm),
60 * Logical Maximum (Xlm),
61 * Input (Variable),
62 * Usage (Y), ; Y (31h, dynamic value)
63 * Physical Maximum (Ypm),
64 * Logical Maximum (Ylm),
65 * Input (Variable),
66 * Pop,
67 * Usage Page (Digitizer), ; Digitizer (0Dh)
68 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
69 * Logical Maximum (1023),
70 * Input (Variable),
71 * Report Size (16),
72 * End Collection,
73 * End Collection,
74 * Usage Page (Desktop), ; Generic desktop controls (01h)
75 * Usage (Mouse), ; Mouse (02h, application collection)
76 * Collection (Application),
77 * Report ID (8),
78 * Usage (Pointer), ; Pointer (01h, physical collection)
79 * Collection (Physical),
80 * Usage Page (Button), ; Button (09h)
81 * Usage Minimum (01h),
82 * Usage Maximum (03h),
83 * Logical Minimum (0),
84 * Logical Maximum (1),
85 * Report Count (3),
86 * Report Size (1),
87 * Input (Variable),
88 * Report Count (5),
89 * Input (Constant),
90 * Usage Page (Desktop), ; Generic desktop controls (01h)
91 * Usage (X), ; X (30h, dynamic value)
92 * Usage (Y), ; Y (31h, dynamic value)
93 * Usage (Wheel), ; Wheel (38h, dynamic value)
94 * Usage (00h),
95 * Logical Minimum (-127),
96 * Logical Maximum (127),
97 * Report Size (8),
98 * Report Count (4),
99 * Input (Variable, Relative),
100 * End Collection,
101 * End Collection,
102 * Usage Page (Desktop), ; Generic desktop controls (01h)
103 * Usage (Mouse), ; Mouse (02h, application collection)
104 * Collection (Application),
105 * Report ID (9),
106 * Usage (Pointer), ; Pointer (01h, physical collection)
107 * Collection (Physical),
108 * Usage Page (Button), ; Button (09h)
109 * Usage Minimum (01h),
110 * Usage Maximum (03h),
111 * Logical Minimum (0),
112 * Logical Maximum (1),
113 * Report Count (3),
114 * Report Size (1),
115 * Input (Variable),
116 * Report Count (5),
117 * Input (Constant),
118 * Usage Page (Desktop), ; Generic desktop controls (01h)
119 * Usage (X), ; X (30h, dynamic value)
120 * Usage (Y), ; Y (31h, dynamic value)
121 * Logical Minimum (0),
122 * Logical Maximum (32767),
123 * Physical Minimum (0),
124 * Physical Maximum (32767),
125 * Report Count (2),
126 * Report Size (16),
127 * Input (Variable),
128 * Usage Page (Digitizer), ; Digitizer (0Dh)
129 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
130 * Logical Maximum (1023),
131 * Report Count (1),
132 * Report Size (16),
133 * Input (Variable),
134 * End Collection,
135 * End Collection
136 *
137 * Here are the extents values for the WPXXXXU models:
138 *
139 * Xpm Xlm Ypm Ylm
140 * WP4030U 4000 8000 3000 6000
141 * WP5540U 5500 11000 4000 8000
142 * WP8060U 8000 16000 6000 12000
143 *
144 * This suggests that all of them have 2000 LPI resolution, as advertised.
145 */
146
147/* Size of the original descriptor of WPXXXXU tablets */
148#define WPXXXXU_RDESC_ORIG_SIZE 212
149
150/*
151 * Fixed WP4030U report descriptor.
152 * Although the hardware might actually support it, the mouse description
153 * has been removed, since there seems to be no devices having one and it
154 * wouldn't make much sense because of the working area size.
155 */
156static __u8 wp4030u_rdesc_fixed[] = {
157 0x05, 0x0D, /* Usage Page (Digitizer), */
158 0x09, 0x02, /* Usage (Pen), */
159 0xA1, 0x01, /* Collection (Application), */
160 0x85, 0x09, /* Report ID (9), */
161 0x09, 0x20, /* Usage (Stylus), */
162 0xA0, /* Collection (Physical), */
163 0x75, 0x01, /* Report Size (1), */
164 0x09, 0x42, /* Usage (Tip Switch), */
165 0x09, 0x44, /* Usage (Barrel Switch), */
166 0x09, 0x46, /* Usage (Tablet Pick), */
167 0x14, /* Logical Minimum (0), */
168 0x25, 0x01, /* Logical Maximum (1), */
169 0x95, 0x03, /* Report Count (3), */
170 0x81, 0x02, /* Input (Variable), */
171 0x95, 0x05, /* Report Count (5), */
172 0x81, 0x01, /* Input (Constant), */
173 0x75, 0x10, /* Report Size (16), */
174 0x95, 0x01, /* Report Count (1), */
175 0x14, /* Logical Minimum (0), */
176 0xA4, /* Push, */
177 0x05, 0x01, /* Usage Page (Desktop), */
178 0x55, 0xFD, /* Unit Exponent (-3), */
179 0x65, 0x13, /* Unit (Inch), */
180 0x34, /* Physical Minimum (0), */
181 0x09, 0x30, /* Usage (X), */
182 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */
183 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
184 0x81, 0x02, /* Input (Variable), */
185 0x09, 0x31, /* Usage (Y), */
186 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */
187 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
188 0x81, 0x02, /* Input (Variable), */
189 0xB4, /* Pop, */
190 0x09, 0x30, /* Usage (Tip Pressure), */
191 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
192 0x81, 0x02, /* Input (Variable), */
193 0xC0, /* End Collection, */
194 0xC0 /* End Collection */
195};
196
197/* Fixed WP5540U report descriptor */
198static __u8 wp5540u_rdesc_fixed[] = {
199 0x05, 0x0D, /* Usage Page (Digitizer), */
200 0x09, 0x02, /* Usage (Pen), */
201 0xA1, 0x01, /* Collection (Application), */
202 0x85, 0x09, /* Report ID (9), */
203 0x09, 0x20, /* Usage (Stylus), */
204 0xA0, /* Collection (Physical), */
205 0x75, 0x01, /* Report Size (1), */
206 0x09, 0x42, /* Usage (Tip Switch), */
207 0x09, 0x44, /* Usage (Barrel Switch), */
208 0x09, 0x46, /* Usage (Tablet Pick), */
209 0x14, /* Logical Minimum (0), */
210 0x25, 0x01, /* Logical Maximum (1), */
211 0x95, 0x03, /* Report Count (3), */
212 0x81, 0x02, /* Input (Variable), */
213 0x95, 0x05, /* Report Count (5), */
214 0x81, 0x01, /* Input (Constant), */
215 0x75, 0x10, /* Report Size (16), */
216 0x95, 0x01, /* Report Count (1), */
217 0x14, /* Logical Minimum (0), */
218 0xA4, /* Push, */
219 0x05, 0x01, /* Usage Page (Desktop), */
220 0x55, 0xFD, /* Unit Exponent (-3), */
221 0x65, 0x13, /* Unit (Inch), */
222 0x34, /* Physical Minimum (0), */
223 0x09, 0x30, /* Usage (X), */
224 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */
225 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
226 0x81, 0x02, /* Input (Variable), */
227 0x09, 0x31, /* Usage (Y), */
228 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */
229 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
230 0x81, 0x02, /* Input (Variable), */
231 0xB4, /* Pop, */
232 0x09, 0x30, /* Usage (Tip Pressure), */
233 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
234 0x81, 0x02, /* Input (Variable), */
235 0xC0, /* End Collection, */
236 0xC0, /* End Collection, */
237 0x05, 0x01, /* Usage Page (Desktop), */
238 0x09, 0x02, /* Usage (Mouse), */
239 0xA1, 0x01, /* Collection (Application), */
240 0x85, 0x08, /* Report ID (8), */
241 0x09, 0x01, /* Usage (Pointer), */
242 0xA0, /* Collection (Physical), */
243 0x75, 0x01, /* Report Size (1), */
244 0x05, 0x09, /* Usage Page (Button), */
245 0x19, 0x01, /* Usage Minimum (01h), */
246 0x29, 0x03, /* Usage Maximum (03h), */
247 0x14, /* Logical Minimum (0), */
248 0x25, 0x01, /* Logical Maximum (1), */
249 0x95, 0x03, /* Report Count (3), */
250 0x81, 0x02, /* Input (Variable), */
251 0x95, 0x05, /* Report Count (5), */
252 0x81, 0x01, /* Input (Constant), */
253 0x05, 0x01, /* Usage Page (Desktop), */
254 0x75, 0x08, /* Report Size (8), */
255 0x09, 0x30, /* Usage (X), */
256 0x09, 0x31, /* Usage (Y), */
257 0x15, 0x81, /* Logical Minimum (-127), */
258 0x25, 0x7F, /* Logical Maximum (127), */
259 0x95, 0x02, /* Report Count (2), */
260 0x81, 0x06, /* Input (Variable, Relative), */
261 0x09, 0x38, /* Usage (Wheel), */
262 0x15, 0xFF, /* Logical Minimum (-1), */
263 0x25, 0x01, /* Logical Maximum (1), */
264 0x95, 0x01, /* Report Count (1), */
265 0x81, 0x06, /* Input (Variable, Relative), */
266 0x81, 0x01, /* Input (Constant), */
267 0xC0, /* End Collection, */
268 0xC0 /* End Collection */
269};
270
271/* Fixed WP8060U report descriptor */
272static __u8 wp8060u_rdesc_fixed[] = {
273 0x05, 0x0D, /* Usage Page (Digitizer), */
274 0x09, 0x02, /* Usage (Pen), */
275 0xA1, 0x01, /* Collection (Application), */
276 0x85, 0x09, /* Report ID (9), */
277 0x09, 0x20, /* Usage (Stylus), */
278 0xA0, /* Collection (Physical), */
279 0x75, 0x01, /* Report Size (1), */
280 0x09, 0x42, /* Usage (Tip Switch), */
281 0x09, 0x44, /* Usage (Barrel Switch), */
282 0x09, 0x46, /* Usage (Tablet Pick), */
283 0x14, /* Logical Minimum (0), */
284 0x25, 0x01, /* Logical Maximum (1), */
285 0x95, 0x03, /* Report Count (3), */
286 0x81, 0x02, /* Input (Variable), */
287 0x95, 0x05, /* Report Count (5), */
288 0x81, 0x01, /* Input (Constant), */
289 0x75, 0x10, /* Report Size (16), */
290 0x95, 0x01, /* Report Count (1), */
291 0x14, /* Logical Minimum (0), */
292 0xA4, /* Push, */
293 0x05, 0x01, /* Usage Page (Desktop), */
294 0x55, 0xFD, /* Unit Exponent (-3), */
295 0x65, 0x13, /* Unit (Inch), */
296 0x34, /* Physical Minimum (0), */
297 0x09, 0x30, /* Usage (X), */
298 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */
299 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
300 0x81, 0x02, /* Input (Variable), */
301 0x09, 0x31, /* Usage (Y), */
302 0x46, 0x70, 0x17, /* Physical Maximum (6000), */
303 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
304 0x81, 0x02, /* Input (Variable), */
305 0xB4, /* Pop, */
306 0x09, 0x30, /* Usage (Tip Pressure), */
307 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
308 0x81, 0x02, /* Input (Variable), */
309 0xC0, /* End Collection, */
310 0xC0, /* End Collection, */
311 0x05, 0x01, /* Usage Page (Desktop), */
312 0x09, 0x02, /* Usage (Mouse), */
313 0xA1, 0x01, /* Collection (Application), */
314 0x85, 0x08, /* Report ID (8), */
315 0x09, 0x01, /* Usage (Pointer), */
316 0xA0, /* Collection (Physical), */
317 0x75, 0x01, /* Report Size (1), */
318 0x05, 0x09, /* Usage Page (Button), */
319 0x19, 0x01, /* Usage Minimum (01h), */
320 0x29, 0x03, /* Usage Maximum (03h), */
321 0x14, /* Logical Minimum (0), */
322 0x25, 0x01, /* Logical Maximum (1), */
323 0x95, 0x03, /* Report Count (3), */
324 0x81, 0x02, /* Input (Variable), */
325 0x95, 0x05, /* Report Count (5), */
326 0x81, 0x01, /* Input (Constant), */
327 0x05, 0x01, /* Usage Page (Desktop), */
328 0x75, 0x08, /* Report Size (8), */
329 0x09, 0x30, /* Usage (X), */
330 0x09, 0x31, /* Usage (Y), */
331 0x15, 0x81, /* Logical Minimum (-127), */
332 0x25, 0x7F, /* Logical Maximum (127), */
333 0x95, 0x02, /* Report Count (2), */
334 0x81, 0x06, /* Input (Variable, Relative), */
335 0x09, 0x38, /* Usage (Wheel), */
336 0x15, 0xFF, /* Logical Minimum (-1), */
337 0x25, 0x01, /* Logical Maximum (1), */
338 0x95, 0x01, /* Report Count (1), */
339 0x81, 0x06, /* Input (Variable, Relative), */
340 0x81, 0x01, /* Input (Constant), */
341 0xC0, /* End Collection, */
342 0xC0 /* End Collection */
343};
344
345/*
346 * Original PF1209 report descriptor.
347 *
348 * The descriptor is similar to WPXXXXU descriptors, with an addition of a
349 * feature report (ID 4) of unknown purpose.
350 *
351 * Although the advertised resolution is 4000 LPI the unused report ID
352 * (taken from WPXXXXU, it seems) states 2000 LPI, but it is probably
353 * incorrect and is a result of blind copying without understanding. Anyway
354 * the real logical extents are always scaled to 0..32767, which IMHO spoils
355 * the precision.
356 *
357 * Usage Page (Digitizer), ; Digitizer (0Dh)
358 * Usage (Pen), ; Pen (02h, application collection)
359 * Collection (Application),
360 * Report ID (7),
361 * Usage (Stylus), ; Stylus (20h, logical collection)
362 * Collection (Physical),
363 * Usage (Tip Switch), ; Tip switch (42h, momentary control)
364 * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
365 * Usage (Eraser), ; Eraser (45h, momentary control)
366 * Logical Minimum (0),
367 * Logical Maximum (1),
368 * Report Size (1),
369 * Report Count (3),
370 * Input (Variable),
371 * Report Count (3),
372 * Input (Constant, Variable),
373 * Usage (In Range), ; In range (32h, momentary control)
374 * Report Count (1),
375 * Input (Variable),
376 * Report Count (1),
377 * Input (Constant, Variable),
378 * Usage Page (Desktop), ; Generic desktop controls (01h)
379 * Usage (X), ; X (30h, dynamic value)
380 * Report Size (16),
381 * Report Count (1),
382 * Push,
383 * Unit Exponent (13),
384 * Unit (Inch^3),
385 * Physical Minimum (0),
386 * Physical Maximum (12000),
387 * Logical Maximum (24000),
388 * Input (Variable),
389 * Usage (Y), ; Y (31h, dynamic value)
390 * Physical Maximum (9000),
391 * Logical Maximum (18000),
392 * Input (Variable),
393 * Pop,
394 * Usage Page (Digitizer), ; Digitizer (0Dh)
395 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
396 * Logical Maximum (1023),
397 * Input (Variable),
398 * Report Size (16),
399 * End Collection,
400 * End Collection,
401 * Usage Page (Desktop), ; Generic desktop controls (01h)
402 * Usage (Mouse), ; Mouse (02h, application collection)
403 * Collection (Application),
404 * Report ID (8),
405 * Usage (Pointer), ; Pointer (01h, physical collection)
406 * Collection (Physical),
407 * Usage Page (Button), ; Button (09h)
408 * Usage Minimum (01h),
409 * Usage Maximum (03h),
410 * Logical Minimum (0),
411 * Logical Maximum (1),
412 * Report Count (3),
413 * Report Size (1),
414 * Input (Variable),
415 * Report Count (5),
416 * Input (Constant),
417 * Usage Page (Desktop), ; Generic desktop controls (01h)
418 * Usage (X), ; X (30h, dynamic value)
419 * Usage (Y), ; Y (31h, dynamic value)
420 * Usage (Wheel), ; Wheel (38h, dynamic value)
421 * Usage (00h),
422 * Logical Minimum (-127),
423 * Logical Maximum (127),
424 * Report Size (8),
425 * Report Count (4),
426 * Input (Variable, Relative),
427 * End Collection,
428 * End Collection,
429 * Usage Page (Desktop), ; Generic desktop controls (01h)
430 * Usage (Mouse), ; Mouse (02h, application collection)
431 * Collection (Application),
432 * Report ID (9),
433 * Usage (Pointer), ; Pointer (01h, physical collection)
434 * Collection (Physical),
435 * Usage Page (Button), ; Button (09h)
436 * Usage Minimum (01h),
437 * Usage Maximum (03h),
438 * Logical Minimum (0),
439 * Logical Maximum (1),
440 * Report Count (3),
441 * Report Size (1),
442 * Input (Variable),
443 * Report Count (5),
444 * Input (Constant),
445 * Usage Page (Desktop), ; Generic desktop controls (01h)
446 * Usage (X), ; X (30h, dynamic value)
447 * Usage (Y), ; Y (31h, dynamic value)
448 * Logical Minimum (0),
449 * Logical Maximum (32767),
450 * Physical Minimum (0),
451 * Physical Maximum (32767),
452 * Report Count (2),
453 * Report Size (16),
454 * Input (Variable),
455 * Usage Page (Digitizer), ; Digitizer (0Dh)
456 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
457 * Logical Maximum (1023),
458 * Report Count (1),
459 * Report Size (16),
460 * Input (Variable),
461 * End Collection,
462 * End Collection,
463 * Usage Page (Desktop), ; Generic desktop controls (01h)
464 * Usage (00h),
465 * Collection (Application),
466 * Report ID (4),
467 * Logical Minimum (0),
468 * Logical Maximum (255),
469 * Usage (00h),
470 * Report Size (8),
471 * Report Count (3),
472 * Feature (Variable),
473 * End Collection
474 */
475
476/* Size of the original descriptor of PF1209 tablet */
477#define PF1209_RDESC_ORIG_SIZE 234
478
479/*
480 * Fixed PF1209 report descriptor
481 *
482 * The descriptor is fixed similarly to WP5540U and WP8060U, plus the
483 * feature report is removed, because its purpose is unknown and it is of no
484 * use to the generic HID driver anyway for now.
485 */
486static __u8 pf1209_rdesc_fixed[] = {
487 0x05, 0x0D, /* Usage Page (Digitizer), */
488 0x09, 0x02, /* Usage (Pen), */
489 0xA1, 0x01, /* Collection (Application), */
490 0x85, 0x09, /* Report ID (9), */
491 0x09, 0x20, /* Usage (Stylus), */
492 0xA0, /* Collection (Physical), */
493 0x75, 0x01, /* Report Size (1), */
494 0x09, 0x42, /* Usage (Tip Switch), */
495 0x09, 0x44, /* Usage (Barrel Switch), */
496 0x09, 0x46, /* Usage (Tablet Pick), */
497 0x14, /* Logical Minimum (0), */
498 0x25, 0x01, /* Logical Maximum (1), */
499 0x95, 0x03, /* Report Count (3), */
500 0x81, 0x02, /* Input (Variable), */
501 0x95, 0x05, /* Report Count (5), */
502 0x81, 0x01, /* Input (Constant), */
503 0x75, 0x10, /* Report Size (16), */
504 0x95, 0x01, /* Report Count (1), */
505 0x14, /* Logical Minimum (0), */
506 0xA4, /* Push, */
507 0x05, 0x01, /* Usage Page (Desktop), */
508 0x55, 0xFD, /* Unit Exponent (-3), */
509 0x65, 0x13, /* Unit (Inch), */
510 0x34, /* Physical Minimum (0), */
511 0x09, 0x30, /* Usage (X), */
512 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
513 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
514 0x81, 0x02, /* Input (Variable), */
515 0x09, 0x31, /* Usage (Y), */
516 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
517 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
518 0x81, 0x02, /* Input (Variable), */
519 0xB4, /* Pop, */
520 0x09, 0x30, /* Usage (Tip Pressure), */
521 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
522 0x81, 0x02, /* Input (Variable), */
523 0xC0, /* End Collection, */
524 0xC0, /* End Collection, */
525 0x05, 0x01, /* Usage Page (Desktop), */
526 0x09, 0x02, /* Usage (Mouse), */
527 0xA1, 0x01, /* Collection (Application), */
528 0x85, 0x08, /* Report ID (8), */
529 0x09, 0x01, /* Usage (Pointer), */
530 0xA0, /* Collection (Physical), */
531 0x75, 0x01, /* Report Size (1), */
532 0x05, 0x09, /* Usage Page (Button), */
533 0x19, 0x01, /* Usage Minimum (01h), */
534 0x29, 0x03, /* Usage Maximum (03h), */
535 0x14, /* Logical Minimum (0), */
536 0x25, 0x01, /* Logical Maximum (1), */
537 0x95, 0x03, /* Report Count (3), */
538 0x81, 0x02, /* Input (Variable), */
539 0x95, 0x05, /* Report Count (5), */
540 0x81, 0x01, /* Input (Constant), */
541 0x05, 0x01, /* Usage Page (Desktop), */
542 0x75, 0x08, /* Report Size (8), */
543 0x09, 0x30, /* Usage (X), */
544 0x09, 0x31, /* Usage (Y), */
545 0x15, 0x81, /* Logical Minimum (-127), */
546 0x25, 0x7F, /* Logical Maximum (127), */
547 0x95, 0x02, /* Report Count (2), */
548 0x81, 0x06, /* Input (Variable, Relative), */
549 0x09, 0x38, /* Usage (Wheel), */
550 0x15, 0xFF, /* Logical Minimum (-1), */
551 0x25, 0x01, /* Logical Maximum (1), */
552 0x95, 0x01, /* Report Count (1), */
553 0x81, 0x06, /* Input (Variable, Relative), */
554 0x81, 0x01, /* Input (Constant), */
555 0xC0, /* End Collection, */
556 0xC0 /* End Collection */
557};
558
559static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
560 unsigned int *rsize)
561{
562 switch (hdev->product) {
563 case USB_DEVICE_ID_UCLOGIC_TABLET_PF1209:
564 if (*rsize == PF1209_RDESC_ORIG_SIZE) {
565 rdesc = pf1209_rdesc_fixed;
566 *rsize = sizeof(pf1209_rdesc_fixed);
567 }
568 break;
569 case USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U:
570 if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) {
571 rdesc = wp4030u_rdesc_fixed;
572 *rsize = sizeof(wp4030u_rdesc_fixed);
573 }
574 break;
575 case USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U:
576 if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) {
577 rdesc = wp5540u_rdesc_fixed;
578 *rsize = sizeof(wp5540u_rdesc_fixed);
579 }
580 break;
581 case USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U:
582 if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) {
583 rdesc = wp8060u_rdesc_fixed;
584 *rsize = sizeof(wp8060u_rdesc_fixed);
585 }
586 break;
587 }
588
589 return rdesc;
590}
591
592static const struct hid_device_id uclogic_devices[] = {
593 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
594 USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
595 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
596 USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
597 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
598 USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
599 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
600 USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) },
601 { }
602};
603MODULE_DEVICE_TABLE(hid, uclogic_devices);
604
605static struct hid_driver uclogic_driver = {
606 .name = "uclogic",
607 .id_table = uclogic_devices,
608 .report_fixup = uclogic_report_fixup,
609};
610
611static int __init uclogic_init(void)
612{
613 return hid_register_driver(&uclogic_driver);
614}
615
616static void __exit uclogic_exit(void)
617{
618 hid_unregister_driver(&uclogic_driver);
619}
620
621module_init(uclogic_init);
622module_exit(uclogic_exit);
623MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-zydacron.c b/drivers/hid/hid-zydacron.c
index 9e8d35a203e4..aac1f9273149 100644
--- a/drivers/hid/hid-zydacron.c
+++ b/drivers/hid/hid-zydacron.c
@@ -27,10 +27,10 @@ struct zc_device {
27* Zydacron remote control has an invalid HID report descriptor, 27* Zydacron remote control has an invalid HID report descriptor,
28* that needs fixing before we can parse it. 28* that needs fixing before we can parse it.
29*/ 29*/
30static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, 30static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
31 unsigned int rsize) 31 unsigned int *rsize)
32{ 32{
33 if (rsize >= 253 && 33 if (*rsize >= 253 &&
34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff && 34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff &&
35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff && 35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff &&
36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) { 36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) {
@@ -40,6 +40,7 @@ static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c; 40 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c;
41 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00; 41 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00;
42 } 42 }
43 return rdesc;
43} 44}
44 45
45#define zc_map_key_clear(c) \ 46#define zc_map_key_clear(c) \
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 836a87473c58..5457135d8ae3 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -72,6 +72,8 @@ static const struct hid_blacklist {
72 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, 72 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
73 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, 73 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT },
74 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, 74 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT },
75 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT },
76 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT },
75 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 77 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
76 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 78 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
77 79