diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-06-24 17:46:21 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-10-14 17:50:53 -0400 |
commit | 1e76253220dbe66e048e55680266dd1f4af0be85 (patch) | |
tree | e3b1a340de062603b0e5d1e65e5e37a58973f7c3 /drivers/hid | |
parent | b5635b129b3ca3a9c879a36f58f5b8c4903d267a (diff) |
HID: move petalynx quirks
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/Kconfig | 7 | ||||
-rw-r--r-- | drivers/hid/Makefile | 1 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 1 | ||||
-rw-r--r-- | drivers/hid/hid-dummy.c | 3 | ||||
-rw-r--r-- | drivers/hid/hid-input-quirks.c | 33 | ||||
-rw-r--r-- | drivers/hid/hid-petalynx.c | 122 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 21 |
7 files changed, 134 insertions, 54 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index b093f3c83e36..04f646a90d32 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -154,6 +154,13 @@ config HID_MICROSOFT | |||
154 | Support for some Microsoft devices which breaks less or more | 154 | Support for some Microsoft devices which breaks less or more |
155 | HID specification. | 155 | HID specification. |
156 | 156 | ||
157 | config HID_PETALYNX | ||
158 | tristate "Petalynx" | ||
159 | default m | ||
160 | depends on USB_HID | ||
161 | ---help--- | ||
162 | Support for Petalynx Maxter remote. | ||
163 | |||
157 | config HID_SUNPLUS | 164 | config HID_SUNPLUS |
158 | tristate "Sunplus" | 165 | tristate "Sunplus" |
159 | default m | 166 | default m |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index ffb58f8001b7..359a5bae4082 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -21,6 +21,7 @@ obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o | |||
21 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o | 21 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o |
22 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | 22 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o |
23 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o | 23 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o |
24 | obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o | ||
24 | obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o | 25 | obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o |
25 | 26 | ||
26 | obj-$(CONFIG_USB_HID) += usbhid/ | 27 | obj-$(CONFIG_USB_HID) += usbhid/ |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 81e7d70260a4..2b7a08fe1718 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1191,6 +1191,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1191 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | 1191 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, |
1192 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1192 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1193 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | 1193 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
1194 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | ||
1194 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1195 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1195 | 1196 | ||
1196 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, | 1197 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, |
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c index b95476c47449..c28422c9d2b5 100644 --- a/drivers/hid/hid-dummy.c +++ b/drivers/hid/hid-dummy.c | |||
@@ -31,6 +31,9 @@ static int __init hid_dummy_init(void) | |||
31 | #ifdef CONFIG_HID_MICROSOFT_MODULE | 31 | #ifdef CONFIG_HID_MICROSOFT_MODULE |
32 | HID_COMPAT_CALL_DRIVER(microsoft); | 32 | HID_COMPAT_CALL_DRIVER(microsoft); |
33 | #endif | 33 | #endif |
34 | #ifdef CONFIG_HID_PETALYNX_MODULE | ||
35 | HID_COMPAT_CALL_DRIVER(petalynx); | ||
36 | #endif | ||
34 | #ifdef CONFIG_HID_SUNPLUS_MODULE | 37 | #ifdef CONFIG_HID_SUNPLUS_MODULE |
35 | HID_COMPAT_CALL_DRIVER(sunplus); | 38 | HID_COMPAT_CALL_DRIVER(sunplus); |
36 | #endif | 39 | #endif |
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c index d10f47765553..903162a63c4f 100644 --- a/drivers/hid/hid-input-quirks.c +++ b/drivers/hid/hid-input-quirks.c | |||
@@ -42,34 +42,6 @@ static int quirk_gyration_remote(struct hid_usage *usage, | |||
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | static int quirk_petalynx_remote(struct hid_usage *usage, | ||
46 | struct hid_input *hidinput, unsigned long **bit, int *max) | ||
47 | { | ||
48 | if (((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) && | ||
49 | ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)) | ||
50 | return 0; | ||
51 | |||
52 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR) | ||
53 | switch(usage->hid & HID_USAGE) { | ||
54 | case 0x05a: map_key_clear(KEY_TEXT); break; | ||
55 | case 0x05b: map_key_clear(KEY_RED); break; | ||
56 | case 0x05c: map_key_clear(KEY_GREEN); break; | ||
57 | case 0x05d: map_key_clear(KEY_YELLOW); break; | ||
58 | case 0x05e: map_key_clear(KEY_BLUE); break; | ||
59 | default: | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) | ||
64 | switch(usage->hid & HID_USAGE) { | ||
65 | case 0x0f6: map_key_clear(KEY_NEXT); break; | ||
66 | case 0x0fa: map_key_clear(KEY_BACK); break; | ||
67 | default: | ||
68 | return 0; | ||
69 | } | ||
70 | return 1; | ||
71 | } | ||
72 | |||
73 | static int quirk_cherry_genius_29e(struct hid_usage *usage, | 45 | static int quirk_cherry_genius_29e(struct hid_usage *usage, |
74 | struct hid_input *hidinput, unsigned long **bit, int *max) | 46 | struct hid_input *hidinput, unsigned long **bit, int *max) |
75 | { | 47 | { |
@@ -94,9 +66,6 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage, | |||
94 | #define VENDOR_ID_MONTEREY 0x0566 | 66 | #define VENDOR_ID_MONTEREY 0x0566 |
95 | #define DEVICE_ID_GENIUS_KB29E 0x3004 | 67 | #define DEVICE_ID_GENIUS_KB29E 0x3004 |
96 | 68 | ||
97 | #define VENDOR_ID_PETALYNX 0x18b1 | ||
98 | #define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | ||
99 | |||
100 | static const struct hid_input_blacklist { | 69 | static const struct hid_input_blacklist { |
101 | __u16 idVendor; | 70 | __u16 idVendor; |
102 | __u16 idProduct; | 71 | __u16 idProduct; |
@@ -107,8 +76,6 @@ static const struct hid_input_blacklist { | |||
107 | 76 | ||
108 | { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, | 77 | { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, |
109 | 78 | ||
110 | { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote }, | ||
111 | |||
112 | { 0, 0, NULL } | 79 | { 0, 0, NULL } |
113 | }; | 80 | }; |
114 | 81 | ||
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c new file mode 100644 index 000000000000..4109244f1d72 --- /dev/null +++ b/drivers/hid/hid-petalynx.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * HID driver for some petalynx "special" devices | ||
3 | * | ||
4 | * Copyright (c) 1999 Andreas Gal | ||
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
8 | * Copyright (c) 2007 Paul Walmsley | ||
9 | * Copyright (c) 2008 Jiri Slaby | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the Free | ||
15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
16 | * any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/device.h> | ||
20 | #include <linux/hid.h> | ||
21 | #include <linux/module.h> | ||
22 | |||
23 | #include "hid-ids.h" | ||
24 | |||
25 | /* Petalynx Maxter Remote has maximum for consumer page set too low */ | ||
26 | static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
27 | unsigned int rsize) | ||
28 | { | ||
29 | if (rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && | ||
30 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && | ||
31 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { | ||
32 | dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " | ||
33 | "descriptor\n"); | ||
34 | rdesc[60] = 0xfa; | ||
35 | rdesc[40] = 0xfa; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | #define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
40 | EV_KEY, (c)) | ||
41 | static int pl_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
42 | struct hid_field *field, struct hid_usage *usage, | ||
43 | unsigned long **bit, int *max) | ||
44 | { | ||
45 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR) { | ||
46 | switch (usage->hid & HID_USAGE) { | ||
47 | case 0x05a: pl_map_key_clear(KEY_TEXT); break; | ||
48 | case 0x05b: pl_map_key_clear(KEY_RED); break; | ||
49 | case 0x05c: pl_map_key_clear(KEY_GREEN); break; | ||
50 | case 0x05d: pl_map_key_clear(KEY_YELLOW); break; | ||
51 | case 0x05e: pl_map_key_clear(KEY_BLUE); break; | ||
52 | default: | ||
53 | return 0; | ||
54 | } | ||
55 | return 1; | ||
56 | } | ||
57 | |||
58 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) { | ||
59 | switch (usage->hid & HID_USAGE) { | ||
60 | case 0x0f6: pl_map_key_clear(KEY_NEXT); break; | ||
61 | case 0x0fa: pl_map_key_clear(KEY_BACK); break; | ||
62 | default: | ||
63 | return 0; | ||
64 | } | ||
65 | return 1; | ||
66 | } | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
72 | { | ||
73 | int ret; | ||
74 | |||
75 | hdev->quirks |= HID_QUIRK_NOGET; | ||
76 | |||
77 | ret = hid_parse(hdev); | ||
78 | if (ret) { | ||
79 | dev_err(&hdev->dev, "parse failed\n"); | ||
80 | goto err_free; | ||
81 | } | ||
82 | |||
83 | ret = hid_hw_start(hdev); | ||
84 | if (ret) { | ||
85 | dev_err(&hdev->dev, "hw start failed\n"); | ||
86 | goto err_free; | ||
87 | } | ||
88 | |||
89 | return 0; | ||
90 | err_free: | ||
91 | return ret; | ||
92 | } | ||
93 | |||
94 | static const struct hid_device_id pl_devices[] = { | ||
95 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | ||
96 | { } | ||
97 | }; | ||
98 | MODULE_DEVICE_TABLE(hid, pl_devices); | ||
99 | |||
100 | static struct hid_driver pl_driver = { | ||
101 | .name = "petalynx", | ||
102 | .id_table = pl_devices, | ||
103 | .report_fixup = pl_report_fixup, | ||
104 | .input_mapping = pl_input_mapping, | ||
105 | .probe = pl_probe, | ||
106 | }; | ||
107 | |||
108 | static int pl_init(void) | ||
109 | { | ||
110 | return hid_register_driver(&pl_driver); | ||
111 | } | ||
112 | |||
113 | static void pl_exit(void) | ||
114 | { | ||
115 | hid_unregister_driver(&pl_driver); | ||
116 | } | ||
117 | |||
118 | module_init(pl_init); | ||
119 | module_exit(pl_exit); | ||
120 | MODULE_LICENSE("GPL"); | ||
121 | |||
122 | HID_COMPAT_LOAD_DRIVER(petalynx); | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index c344ec2fad5d..3f977abb62b1 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -57,7 +57,6 @@ static const struct hid_blacklist { | |||
57 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 57 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
58 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 58 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
59 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 59 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
60 | { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_NOGET }, | ||
61 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 60 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, |
63 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 62 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
@@ -78,8 +77,6 @@ static const struct hid_rdesc_blacklist { | |||
78 | } hid_rdesc_blacklist[] = { | 77 | } hid_rdesc_blacklist[] = { |
79 | { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER }, | 78 | { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER }, |
80 | 79 | ||
81 | { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX }, | ||
82 | |||
83 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, | 80 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, |
84 | 81 | ||
85 | { 0, 0 } | 82 | { 0, 0 } |
@@ -340,21 +337,6 @@ static void usbhid_fixup_samsung_irda_descriptor(unsigned char *rdesc, | |||
340 | } | 337 | } |
341 | } | 338 | } |
342 | 339 | ||
343 | /* Petalynx Maxter Remote has maximum for consumer page set too low */ | ||
344 | static void usbhid_fixup_petalynx_descriptor(unsigned char *rdesc, int rsize) | ||
345 | { | ||
346 | if (rsize >= 60 && rdesc[39] == 0x2a | ||
347 | && rdesc[40] == 0xf5 | ||
348 | && rdesc[41] == 0x00 | ||
349 | && rdesc[59] == 0x26 | ||
350 | && rdesc[60] == 0xf9 | ||
351 | && rdesc[61] == 0x00) { | ||
352 | printk(KERN_INFO "Fixing up Petalynx Maxter Remote report descriptor\n"); | ||
353 | rdesc[60] = 0xfa; | ||
354 | rdesc[40] = 0xfa; | ||
355 | } | ||
356 | } | ||
357 | |||
358 | static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rsize) | 340 | static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rsize) |
359 | { | 341 | { |
360 | if (rsize >= 30 && rdesc[29] == 0x05 | 342 | if (rsize >= 30 && rdesc[29] == 0x05 |
@@ -366,9 +348,6 @@ static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rs | |||
366 | 348 | ||
367 | static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) | 349 | static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) |
368 | { | 350 | { |
369 | if (quirks & HID_QUIRK_RDESC_PETALYNX) | ||
370 | usbhid_fixup_petalynx_descriptor(rdesc, rsize); | ||
371 | |||
372 | if (quirks & HID_QUIRK_RDESC_BUTTON_CONSUMER) | 351 | if (quirks & HID_QUIRK_RDESC_BUTTON_CONSUMER) |
373 | usbhid_fixup_button_consumer_descriptor(rdesc, rsize); | 352 | usbhid_fixup_button_consumer_descriptor(rdesc, rsize); |
374 | 353 | ||