aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-24 14:42:25 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:52 -0400
commit3b239cd739a9499da08326356add3d9d992c7911 (patch)
tree859cbb6d09d381edcc8e0e9f12437e66bf00c7c5
parent14a21cd459f97e3b3cc4fcde48fc5bcdb81d097e (diff)
HID: move cherry quirks
Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/Kconfig7
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-cherry.c87
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-dummy.c3
-rw-r--r--drivers/hid/hid-input-quirks.c21
-rw-r--r--drivers/hid/usbhid/hid-quirks.c19
-rw-r--r--include/linux/hid.h1
8 files changed, 99 insertions, 41 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 01456b1d3833..85aabb5d9712 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -103,6 +103,13 @@ config HID_APPLE
103 103
104 If unsure, say M. 104 If unsure, say M.
105 105
106config HID_CHERRY
107 tristate "Cherry"
108 default m
109 depends on USB_HID
110 ---help---
111 Support for Cherry Cymotion.
112
106config HID_CYPRESS 113config HID_CYPRESS
107 tristate "Cypress" 114 tristate "Cypress"
108 default m 115 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index ceede11eed7c..cd6bd024767c 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -14,6 +14,7 @@ endif
14 14
15obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 15obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
16obj-$(CONFIG_HID_APPLE) += hid-apple.o 16obj-$(CONFIG_HID_APPLE) += hid-apple.o
17obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
17obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 18obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
18obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 19obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
19obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 20obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
new file mode 100644
index 000000000000..b833b9769aba
--- /dev/null
+++ b/drivers/hid/hid-cherry.c
@@ -0,0 +1,87 @@
1/*
2 * HID driver for some cherry "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/*
26 * Cherry Cymotion keyboard have an invalid HID report descriptor,
27 * that needs fixing before we can parse it.
28 */
29static void ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
30 unsigned int rsize)
31{
32 if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
33 dev_info(&hdev->dev, "fixing up Cherry Cymotion report "
34 "descriptor\n");
35 rdesc[11] = rdesc[16] = 0xff;
36 rdesc[12] = rdesc[17] = 0x03;
37 }
38}
39
40#define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
41 EV_KEY, (c))
42static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
43 struct hid_field *field, struct hid_usage *usage,
44 unsigned long **bit, int *max)
45{
46 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
47 return 0;
48
49 switch (usage->hid & HID_USAGE) {
50 case 0x301: ch_map_key_clear(KEY_PROG1); break;
51 case 0x302: ch_map_key_clear(KEY_PROG2); break;
52 case 0x303: ch_map_key_clear(KEY_PROG3); break;
53 default:
54 return 0;
55 }
56
57 return 1;
58}
59
60static const struct hid_device_id ch_devices[] = {
61 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
62 { }
63};
64MODULE_DEVICE_TABLE(hid, ch_devices);
65
66static struct hid_driver ch_driver = {
67 .name = "cherry",
68 .id_table = ch_devices,
69 .report_fixup = ch_report_fixup,
70 .input_mapping = ch_input_mapping,
71};
72
73static int ch_init(void)
74{
75 return hid_register_driver(&ch_driver);
76}
77
78static void ch_exit(void)
79{
80 hid_unregister_driver(&ch_driver);
81}
82
83module_init(ch_init);
84module_exit(ch_exit);
85MODULE_LICENSE("GPL");
86
87HID_COMPAT_LOAD_DRIVER(cherry);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index be582976db2c..5acdc3742851 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1164,6 +1164,7 @@ static const struct hid_device_id hid_blacklist[] = {
1164 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1164 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
1165 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1165 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1166 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1166 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1167 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1167 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1168 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1168 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1169 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1169 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1170 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index 123f1c71cdf2..178344ea651b 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -10,6 +10,9 @@ static int __init hid_dummy_init(void)
10#ifdef CONFIG_HID_APPLE_MODULE 10#ifdef CONFIG_HID_APPLE_MODULE
11 HID_COMPAT_CALL_DRIVER(apple); 11 HID_COMPAT_CALL_DRIVER(apple);
12#endif 12#endif
13#ifdef CONFIG_HID_CHERRY_MODULE
14 HID_COMPAT_CALL_DRIVER(cherry);
15#endif
13#ifdef CONFIG_HID_CYPRESS_MODULE 16#ifdef CONFIG_HID_CYPRESS_MODULE
14 HID_COMPAT_CALL_DRIVER(cypress); 17 HID_COMPAT_CALL_DRIVER(cypress);
15#endif 18#endif
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 5bacf181a8ca..97ee75064a0e 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -38,22 +38,6 @@ static int quirk_belkin_wkbd(struct hid_usage *usage,
38 return 1; 38 return 1;
39} 39}
40 40
41static int quirk_cherry_cymotion(struct hid_usage *usage,
42 struct hid_input *hidinput, unsigned long **bit, int *max)
43{
44 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
45 return 0;
46
47 switch (usage->hid & HID_USAGE) {
48 case 0x301: map_key_clear(KEY_PROG1); break;
49 case 0x302: map_key_clear(KEY_PROG2); break;
50 case 0x303: map_key_clear(KEY_PROG3); break;
51 default:
52 return 0;
53 }
54 return 1;
55}
56
57static int quirk_gyration_remote(struct hid_usage *usage, 41static int quirk_gyration_remote(struct hid_usage *usage,
58 struct hid_input *hidinput, unsigned long **bit, int *max) 42 struct hid_input *hidinput, unsigned long **bit, int *max)
59{ 43{
@@ -173,9 +157,6 @@ static int quirk_btc_8193(struct hid_usage *usage, struct hid_input *hidinput,
173#define VENDOR_ID_BELKIN 0x1020 157#define VENDOR_ID_BELKIN 0x1020
174#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 158#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
175 159
176#define VENDOR_ID_CHERRY 0x046a
177#define DEVICE_ID_CHERRY_CYMOTION 0x0023
178
179#define VENDOR_ID_CHICONY 0x04f2 160#define VENDOR_ID_CHICONY 0x04f2
180#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 161#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
181 162
@@ -199,8 +180,6 @@ static const struct hid_input_blacklist {
199} hid_input_blacklist[] = { 180} hid_input_blacklist[] = {
200 { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd }, 181 { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd },
201 182
202 { VENDOR_ID_CHERRY, DEVICE_ID_CHERRY_CYMOTION, quirk_cherry_cymotion },
203
204 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad }, 183 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad },
205 184
206 { VENDOR_ID_EZKEY, DEVICE_ID_BTC_8193, quirk_btc_8193 }, 185 { VENDOR_ID_EZKEY, DEVICE_ID_BTC_8193, quirk_btc_8193 },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 1d12fb24829c..0cc6e4223cd1 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -79,9 +79,6 @@ static const struct hid_rdesc_blacklist {
79 __u16 idProduct; 79 __u16 idProduct;
80 __u32 quirks; 80 __u32 quirks;
81} hid_rdesc_blacklist[] = { 81} hid_rdesc_blacklist[] = {
82
83 { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_RDESC_CYMOTION },
84
85 { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER }, 82 { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER },
86 83
87 { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX }, 84 { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX },
@@ -320,19 +317,6 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct)
320EXPORT_SYMBOL_GPL(usbhid_lookup_quirk); 317EXPORT_SYMBOL_GPL(usbhid_lookup_quirk);
321 318
322/* 319/*
323 * Cherry Cymotion keyboard have an invalid HID report descriptor,
324 * that needs fixing before we can parse it.
325 */
326static void usbhid_fixup_cymotion_descriptor(char *rdesc, int rsize)
327{
328 if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
329 printk(KERN_INFO "Fixing up Cherry Cymotion report descriptor\n");
330 rdesc[11] = rdesc[16] = 0xff;
331 rdesc[12] = rdesc[17] = 0x03;
332 }
333}
334
335/*
336 * Samsung IrDA remote controller (reports as Cypress USB Mouse). 320 * Samsung IrDA remote controller (reports as Cypress USB Mouse).
337 * 321 *
338 * Vendor specific report #4 has a size of 48 bit, 322 * Vendor specific report #4 has a size of 48 bit,
@@ -385,9 +369,6 @@ static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rs
385 369
386static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) 370static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize)
387{ 371{
388 if ((quirks & HID_QUIRK_RDESC_CYMOTION))
389 usbhid_fixup_cymotion_descriptor(rdesc, rsize);
390
391 if (quirks & HID_QUIRK_RDESC_PETALYNX) 372 if (quirks & HID_QUIRK_RDESC_PETALYNX)
392 usbhid_fixup_petalynx_descriptor(rdesc, rsize); 373 usbhid_fixup_petalynx_descriptor(rdesc, rsize);
393 374
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a7cc4af2e467..d9ab4a3af431 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -273,7 +273,6 @@ struct hid_item {
273 * Separate quirks for runtime report descriptor fixup 273 * Separate quirks for runtime report descriptor fixup
274 */ 274 */
275 275
276#define HID_QUIRK_RDESC_CYMOTION 0x00000001
277#define HID_QUIRK_RDESC_PETALYNX 0x00000008 276#define HID_QUIRK_RDESC_PETALYNX 0x00000008
278#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 277#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
279#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 278#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040