aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-24 18:07:50 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:53 -0400
commit3b8006e51038ef263a0404756d9e190c9a9f74d5 (patch)
tree903b947416afbac962f754e0ea57edad75574969
parent1e76253220dbe66e048e55680266dd1f4af0be85 (diff)
HID: move monterey 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-core.c1
-rw-r--r--drivers/hid/hid-dummy.c3
-rw-r--r--drivers/hid/hid-input-quirks.c23
-rw-r--r--drivers/hid/hid-monterey.c82
-rw-r--r--drivers/hid/usbhid/hid-quirks.c14
-rw-r--r--include/linux/hid.h1
8 files changed, 94 insertions, 38 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 04f646a90d32..d71507a5cccb 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
157config HID_MONTEREY
158 tristate "Monterey"
159 default m
160 depends on USB_HID
161 ---help---
162 Support for Monterey Genius KB29E.
163
157config HID_PETALYNX 164config HID_PETALYNX
158 tristate "Petalynx" 165 tristate "Petalynx"
159 default m 166 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 359a5bae4082..48b5fb25d16a 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
21obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 21obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
22obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 22obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
23obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 23obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
24obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
24obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o 25obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
25obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o 26obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
26 27
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2b7a08fe1718..fa2723100450 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_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
1194 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1195 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
1195 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1196 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1196 1197
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index c28422c9d2b5..1dbb454c8112 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_MONTEREY_MODULE
35 HID_COMPAT_CALL_DRIVER(monterey);
36#endif
34#ifdef CONFIG_HID_PETALYNX_MODULE 37#ifdef CONFIG_HID_PETALYNX_MODULE
35 HID_COMPAT_CALL_DRIVER(petalynx); 38 HID_COMPAT_CALL_DRIVER(petalynx);
36#endif 39#endif
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 903162a63c4f..1a4ba0313030 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -42,30 +42,9 @@ static int quirk_gyration_remote(struct hid_usage *usage,
42 return 1; 42 return 1;
43} 43}
44 44
45static int quirk_cherry_genius_29e(struct hid_usage *usage,
46 struct hid_input *hidinput, unsigned long **bit, int *max)
47{
48 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
49 return 0;
50
51 switch (usage->hid & HID_USAGE) {
52 case 0x156: map_key_clear(KEY_WORDPROCESSOR); break;
53 case 0x157: map_key_clear(KEY_SPREADSHEET); break;
54 case 0x158: map_key_clear(KEY_PRESENTATION); break;
55 case 0x15c: map_key_clear(KEY_STOP); break;
56
57 default:
58 return 0;
59 }
60 return 1;
61}
62
63#define VENDOR_ID_GYRATION 0x0c16 45#define VENDOR_ID_GYRATION 0x0c16
64#define DEVICE_ID_GYRATION_REMOTE 0x0002 46#define DEVICE_ID_GYRATION_REMOTE 0x0002
65 47
66#define VENDOR_ID_MONTEREY 0x0566
67#define DEVICE_ID_GENIUS_KB29E 0x3004
68
69static const struct hid_input_blacklist { 48static const struct hid_input_blacklist {
70 __u16 idVendor; 49 __u16 idVendor;
71 __u16 idProduct; 50 __u16 idProduct;
@@ -74,8 +53,6 @@ static const struct hid_input_blacklist {
74} hid_input_blacklist[] = { 53} hid_input_blacklist[] = {
75 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote }, 54 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote },
76 55
77 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e },
78
79 { 0, 0, NULL } 56 { 0, 0, NULL }
80}; 57};
81 58
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
new file mode 100644
index 000000000000..f3a85a065f18
--- /dev/null
+++ b/drivers/hid/hid-monterey.c
@@ -0,0 +1,82 @@
1/*
2 * HID driver for some monterey "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
25static void mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int rsize)
27{
28 if (rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
29 dev_info(&hdev->dev, "fixing up button/consumer in HID report "
30 "descriptor\n");
31 rdesc[30] = 0x0c;
32 }
33}
34
35#define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
36 EV_KEY, (c))
37static int mr_input_mapping(struct hid_device *hdev, struct hid_input *hi,
38 struct hid_field *field, struct hid_usage *usage,
39 unsigned long **bit, int *max)
40{
41 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
42 return 0;
43
44 switch (usage->hid & HID_USAGE) {
45 case 0x156: mr_map_key_clear(KEY_WORDPROCESSOR); break;
46 case 0x157: mr_map_key_clear(KEY_SPREADSHEET); break;
47 case 0x158: mr_map_key_clear(KEY_PRESENTATION); break;
48 case 0x15c: mr_map_key_clear(KEY_STOP); break;
49 default:
50 return 0;
51 }
52 return 1;
53}
54
55static const struct hid_device_id mr_devices[] = {
56 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
57 { }
58};
59MODULE_DEVICE_TABLE(hid, mr_devices);
60
61static struct hid_driver mr_driver = {
62 .name = "monterey",
63 .id_table = mr_devices,
64 .report_fixup = mr_report_fixup,
65 .input_mapping = mr_input_mapping,
66};
67
68static int mr_init(void)
69{
70 return hid_register_driver(&mr_driver);
71}
72
73static void mr_exit(void)
74{
75 hid_unregister_driver(&mr_driver);
76}
77
78module_init(mr_init);
79module_exit(mr_exit);
80MODULE_LICENSE("GPL");
81
82HID_COMPAT_LOAD_DRIVER(monterey);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 3f977abb62b1..cc1927b1b88a 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -75,8 +75,6 @@ static const struct hid_rdesc_blacklist {
75 __u16 idProduct; 75 __u16 idProduct;
76 __u32 quirks; 76 __u32 quirks;
77} hid_rdesc_blacklist[] = { 77} hid_rdesc_blacklist[] = {
78 { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER },
79
80 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, 78 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE },
81 79
82 { 0, 0 } 80 { 0, 0 }
@@ -337,20 +335,8 @@ static void usbhid_fixup_samsung_irda_descriptor(unsigned char *rdesc,
337 } 335 }
338} 336}
339 337
340static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rsize)
341{
342 if (rsize >= 30 && rdesc[29] == 0x05
343 && rdesc[30] == 0x09) {
344 printk(KERN_INFO "Fixing up button/consumer in HID report descriptor\n");
345 rdesc[30] = 0x0c;
346 }
347}
348
349static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) 338static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize)
350{ 339{
351 if (quirks & HID_QUIRK_RDESC_BUTTON_CONSUMER)
352 usbhid_fixup_button_consumer_descriptor(rdesc, rsize);
353
354 if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE) 340 if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE)
355 usbhid_fixup_samsung_irda_descriptor(rdesc, rsize); 341 usbhid_fixup_samsung_irda_descriptor(rdesc, rsize);
356} 342}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7f4c94ffa617..3a639bff4ab2 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -272,7 +272,6 @@ struct hid_item {
272 * Separate quirks for runtime report descriptor fixup 272 * Separate quirks for runtime report descriptor fixup
273 */ 273 */
274 274
275#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
276#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 275#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
277 276
278/* 277/*