aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-24 15:11:21 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:52 -0400
commit1f243e302cea1561ac881eb5d27041c5342beba4 (patch)
tree34939277ecafcf4ebf36e12de1f6f5a75f931f78 /drivers/hid
parent3b239cd739a9499da08326356add3d9d992c7911 (diff)
HID: move ezkey 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/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-ezkey.c95
-rw-r--r--drivers/hid/hid-input-quirks.c37
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
7 files changed, 107 insertions, 39 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 85aabb5d9712..8098ad322b71 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -117,6 +117,13 @@ config HID_CYPRESS
117 ---help--- 117 ---help---
118 Support for Cypress mouse and barcodes. 118 Support for Cypress mouse and barcodes.
119 119
120config HID_EZKEY
121 tristate "Ezkey"
122 default m
123 depends on USB_HID
124 ---help---
125 Support for Ezkey mouse and barcodes.
126
120config HID_LOGITECH 127config HID_LOGITECH
121 tristate "Logitech" 128 tristate "Logitech"
122 default m 129 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index cd6bd024767c..4790777f8435 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -16,6 +16,7 @@ obj-$(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_CHERRY) += hid-cherry.o
18obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 18obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
19obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
19obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 20obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
20obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 21obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
21obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o 22obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5acdc3742851..84e478df057c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1168,6 +1168,7 @@ static const struct hid_device_id hid_blacklist[] = {
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_1) },
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_BARCODE_2) },
1170 { 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) },
1171 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1171 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 1172 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
1172 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 1173 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
1173 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, 1174 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index 178344ea651b..0dbdbb73b73c 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -16,6 +16,9 @@ static int __init hid_dummy_init(void)
16#ifdef CONFIG_HID_CYPRESS_MODULE 16#ifdef CONFIG_HID_CYPRESS_MODULE
17 HID_COMPAT_CALL_DRIVER(cypress); 17 HID_COMPAT_CALL_DRIVER(cypress);
18#endif 18#endif
19#ifdef CONFIG_HID_EZKEY_MODULE
20 HID_COMPAT_CALL_DRIVER(ezkey);
21#endif
19#ifdef CONFIG_HID_LOGITECH_MODULE 22#ifdef CONFIG_HID_LOGITECH_MODULE
20 HID_COMPAT_CALL_DRIVER(logitech); 23 HID_COMPAT_CALL_DRIVER(logitech);
21#endif 24#endif
diff --git a/drivers/hid/hid-ezkey.c b/drivers/hid/hid-ezkey.c
new file mode 100644
index 000000000000..deb42f931b7e
--- /dev/null
+++ b/drivers/hid/hid-ezkey.c
@@ -0,0 +1,95 @@
1/*
2 * HID driver for some ezkey "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/input.h>
21#include <linux/hid.h>
22#include <linux/module.h>
23
24#include "hid-ids.h"
25
26#define ez_map_rel(c) hid_map_usage(hi, usage, bit, max, EV_REL, (c))
27#define ez_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c))
28
29static int ez_input_mapping(struct hid_device *hdev, struct hid_input *hi,
30 struct hid_field *field, struct hid_usage *usage,
31 unsigned long **bit, int *max)
32{
33 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
34 return 0;
35
36 switch (usage->hid & HID_USAGE) {
37 case 0x230: ez_map_key(BTN_MOUSE); break;
38 case 0x231: ez_map_rel(REL_WHEEL); break;
39 /*
40 * this keyboard has a scrollwheel implemented in
41 * totally broken way. We map this usage temporarily
42 * to HWHEEL and handle it in the event quirk handler
43 */
44 case 0x232: ez_map_rel(REL_HWHEEL); break;
45 default:
46 return 0;
47 }
48 return 1;
49}
50
51static int ez_event(struct hid_device *hdev, struct hid_field *field,
52 struct hid_usage *usage, __s32 value)
53{
54 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
55 !usage->type)
56 return 0;
57
58 /* handle the temporary quirky mapping to HWHEEL */
59 if (usage->type == EV_REL && usage->code == REL_HWHEEL) {
60 struct input_dev *input = field->hidinput->input;
61 input_event(input, usage->type, REL_WHEEL, -value);
62 return 1;
63 }
64
65 return 0;
66}
67
68static const struct hid_device_id ez_devices[] = {
69 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
70 { }
71};
72MODULE_DEVICE_TABLE(hid, ez_devices);
73
74static struct hid_driver ez_driver = {
75 .name = "ezkey",
76 .id_table = ez_devices,
77 .input_mapping = ez_input_mapping,
78 .event = ez_event,
79};
80
81static int ez_init(void)
82{
83 return hid_register_driver(&ez_driver);
84}
85
86static void ez_exit(void)
87{
88 hid_unregister_driver(&ez_driver);
89}
90
91module_init(ez_init);
92module_exit(ez_exit);
93MODULE_LICENSE("GPL");
94
95HID_COMPAT_LOAD_DRIVER(ezkey);
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 97ee75064a0e..4cd585b64ae0 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -16,9 +16,6 @@
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/hid.h> 17#include <linux/hid.h>
18 18
19#define map_rel(c) hid_map_usage(hidinput, usage, bit, max, EV_REL, (c))
20#define map_key(c) hid_map_usage(hidinput, usage, bit, max, EV_KEY, (c))
21
22#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, bit, \ 19#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, bit, \
23 max, EV_KEY, (c)) 20 max, EV_KEY, (c))
24 21
@@ -132,37 +129,12 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage,
132 return 1; 129 return 1;
133} 130}
134 131
135static int quirk_btc_8193(struct hid_usage *usage, struct hid_input *hidinput,
136 unsigned long **bit, int *max)
137{
138 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
139 return 0;
140
141 switch (usage->hid & HID_USAGE) {
142 case 0x230: map_key(BTN_MOUSE); break;
143 case 0x231: map_rel(REL_WHEEL); break;
144 /*
145 * this keyboard has a scrollwheel implemented in
146 * totally broken way. We map this usage temporarily
147 * to HWHEEL and handle it in the event quirk handler
148 */
149 case 0x232: map_rel(REL_HWHEEL); break;
150
151 default:
152 return 0;
153 }
154 return 1;
155}
156
157#define VENDOR_ID_BELKIN 0x1020 132#define VENDOR_ID_BELKIN 0x1020
158#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 133#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
159 134
160#define VENDOR_ID_CHICONY 0x04f2 135#define VENDOR_ID_CHICONY 0x04f2
161#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 136#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
162 137
163#define VENDOR_ID_EZKEY 0x0518
164#define DEVICE_ID_BTC_8193 0x0002
165
166#define VENDOR_ID_GYRATION 0x0c16 138#define VENDOR_ID_GYRATION 0x0c16
167#define DEVICE_ID_GYRATION_REMOTE 0x0002 139#define DEVICE_ID_GYRATION_REMOTE 0x0002
168 140
@@ -182,8 +154,6 @@ static const struct hid_input_blacklist {
182 154
183 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad }, 155 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad },
184 156
185 { VENDOR_ID_EZKEY, DEVICE_ID_BTC_8193, quirk_btc_8193 },
186
187 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote }, 157 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote },
188 158
189 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, 159 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e },
@@ -215,13 +185,6 @@ int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struc
215 185
216 input = field->hidinput->input; 186 input = field->hidinput->input;
217 187
218 /* handle the temporary quirky mapping to HWHEEL */
219 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT &&
220 usage->type == EV_REL && usage->code == REL_HWHEEL) {
221 input_event(input, usage->type, REL_WHEEL, -value);
222 return 1;
223 }
224
225 /* Gyration MCE remote "Sleep" key */ 188 /* Gyration MCE remote "Sleep" key */
226 if (hid->vendor == VENDOR_ID_GYRATION && 189 if (hid->vendor == VENDOR_ID_GYRATION &&
227 hid->product == DEVICE_ID_GYRATION_REMOTE && 190 hid->product == DEVICE_ID_GYRATION_REMOTE &&
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 0cc6e4223cd1..ddc16ea159a3 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -46,8 +46,6 @@ static const struct hid_blacklist {
46 { USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM, HID_QUIRK_HIDDEV }, 46 { USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM, HID_QUIRK_HIDDEV },
47 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT }, 47 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT },
48 48
49 { USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193, HID_QUIRK_HWHEEL_WHEEL_INVERT },
50
51 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 49 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
52 { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, 50 { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
53 51