aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-24 17:24:57 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:53 -0400
commitb5635b129b3ca3a9c879a36f58f5b8c4903d267a (patch)
tree03aa23076ad126e27972b559928ee91dbf6aa5a1
parentfcfacfd3594d5d2fa99fb5e7d33dee3904b1a156 (diff)
HID: move belkin 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-belkin.c107
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-dummy.c3
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/hid-input-quirks.c21
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
8 files changed, 123 insertions, 22 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 1e6a5a044591..b093f3c83e36 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_BELKIN
107 tristate "Belkin"
108 default m
109 depends on USB_HID
110 ---help---
111 Support for Belkin Flip KVM and Wireless keyboard.
112
106config HID_CHERRY 113config HID_CHERRY
107 tristate "Cherry" 114 tristate "Cherry"
108 default m 115 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index a5eaa3e078be..ffb58f8001b7 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_BELKIN) += hid-belkin.o
17obj-$(CONFIG_HID_CHERRY) += hid-cherry.o 18obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
18obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 19obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
19obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 20obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
diff --git a/drivers/hid/hid-belkin.c b/drivers/hid/hid-belkin.c
new file mode 100644
index 000000000000..050b9892d7ef
--- /dev/null
+++ b/drivers/hid/hid-belkin.c
@@ -0,0 +1,107 @@
1/*
2 * HID driver for some belkin "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#define BELKIN_HIDDEV 0x01
26#define BELKIN_WKBD 0x02
27
28#define belkin_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
29 EV_KEY, (c))
30static int belkin_input_mapping(struct hid_device *hdev, struct hid_input *hi,
31 struct hid_field *field, struct hid_usage *usage,
32 unsigned long **bit, int *max)
33{
34 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
35
36 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER ||
37 !(quirks & BELKIN_WKBD))
38 return 0;
39
40 switch (usage->hid & HID_USAGE) {
41 case 0x03a: belkin_map_key_clear(KEY_SOUND); break;
42 case 0x03b: belkin_map_key_clear(KEY_CAMERA); break;
43 case 0x03c: belkin_map_key_clear(KEY_DOCUMENTS); break;
44 default:
45 return 0;
46 }
47 return 1;
48}
49
50static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id)
51{
52 unsigned long quirks = id->driver_data;
53 int ret;
54
55 hid_set_drvdata(hdev, (void *)quirks);
56
57 if (quirks & BELKIN_HIDDEV)
58 hdev->quirks |= HID_QUIRK_HIDDEV;
59
60 ret = hid_parse(hdev);
61 if (ret) {
62 dev_err(&hdev->dev, "parse failed\n");
63 goto err_free;
64 }
65
66 ret = hid_hw_start(hdev);
67 if (ret) {
68 dev_err(&hdev->dev, "hw start failed\n");
69 goto err_free;
70 }
71
72 return 0;
73err_free:
74 return ret;
75}
76
77static const struct hid_device_id belkin_devices[] = {
78 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM),
79 .driver_data = BELKIN_HIDDEV },
80 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD),
81 .driver_data = BELKIN_WKBD },
82 { }
83};
84MODULE_DEVICE_TABLE(hid, belkin_devices);
85
86static struct hid_driver belkin_driver = {
87 .name = "belkin",
88 .id_table = belkin_devices,
89 .input_mapping = belkin_input_mapping,
90 .probe = belkin_probe,
91};
92
93static int belkin_init(void)
94{
95 return hid_register_driver(&belkin_driver);
96}
97
98static void belkin_exit(void)
99{
100 hid_unregister_driver(&belkin_driver);
101}
102
103module_init(belkin_init);
104module_exit(belkin_exit);
105MODULE_LICENSE("GPL");
106
107HID_COMPAT_LOAD_DRIVER(belkin);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 0c4e78828005..81e7d70260a4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1164,12 +1164,14 @@ 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_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1167 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1168 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1168 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1169 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1169 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1170 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1170 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1171 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1171 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1172 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1172 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1173 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1174 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1173 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 1175 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
1174 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 1176 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
1175 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, 1177 { 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 0b683af41b24..b95476c47449 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_BELKIN_MODULE
14 HID_COMPAT_CALL_DRIVER(belkin);
15#endif
13#ifdef CONFIG_HID_CHERRY_MODULE 16#ifdef CONFIG_HID_CHERRY_MODULE
14 HID_COMPAT_CALL_DRIVER(cherry); 17 HID_COMPAT_CALL_DRIVER(cherry);
15#endif 18#endif
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 11472d96e2ad..ebe665206a72 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -234,6 +234,9 @@
234#define USB_VENDOR_ID_KBGEAR 0x084e 234#define USB_VENDOR_ID_KBGEAR 0x084e
235#define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 235#define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001
236 236
237#define USB_VENDOR_ID_LABTEC 0x1020
238#define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006
239
237#define USB_VENDOR_ID_LD 0x0f11 240#define USB_VENDOR_ID_LD 0x0f11
238#define USB_DEVICE_ID_LD_CASSY 0x1000 241#define USB_DEVICE_ID_LD_CASSY 0x1000
239#define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 242#define USB_DEVICE_ID_LD_POCKETCASSY 0x1010
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 5f84568b9bd0..d10f47765553 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -19,22 +19,6 @@
19#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, \
20 max, EV_KEY, (c)) 20 max, EV_KEY, (c))
21 21
22static int quirk_belkin_wkbd(struct hid_usage *usage,
23 struct hid_input *hidinput, unsigned long **bit, int *max)
24{
25 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
26 return 0;
27
28 switch (usage->hid & HID_USAGE) {
29 case 0x03a: map_key_clear(KEY_SOUND); break;
30 case 0x03b: map_key_clear(KEY_CAMERA); break;
31 case 0x03c: map_key_clear(KEY_DOCUMENTS); break;
32 default:
33 return 0;
34 }
35 return 1;
36}
37
38static int quirk_gyration_remote(struct hid_usage *usage, 22static int quirk_gyration_remote(struct hid_usage *usage,
39 struct hid_input *hidinput, unsigned long **bit, int *max) 23 struct hid_input *hidinput, unsigned long **bit, int *max)
40{ 24{
@@ -104,9 +88,6 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage,
104 return 1; 88 return 1;
105} 89}
106 90
107#define VENDOR_ID_BELKIN 0x1020
108#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
109
110#define VENDOR_ID_GYRATION 0x0c16 91#define VENDOR_ID_GYRATION 0x0c16
111#define DEVICE_ID_GYRATION_REMOTE 0x0002 92#define DEVICE_ID_GYRATION_REMOTE 0x0002
112 93
@@ -122,8 +103,6 @@ static const struct hid_input_blacklist {
122 int (*quirk)(struct hid_usage *, struct hid_input *, unsigned long **, 103 int (*quirk)(struct hid_usage *, struct hid_input *, unsigned long **,
123 int *); 104 int *);
124} hid_input_blacklist[] = { 105} hid_input_blacklist[] = {
125 { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd },
126
127 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote }, 106 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote },
128 107
129 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, 108 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index ddc16ea159a3..c344ec2fad5d 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -43,7 +43,6 @@ static const struct hid_blacklist {
43 43
44 { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, 44 { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL },
45 45
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 }, 46 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT },
48 47
49 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 48 { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },