aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-07-24 17:35:13 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:54 -0400
commit949f8fef77186c7361d22e1ea6f42c76ceda42b0 (patch)
treec9917cfecd321dd9347eba8bdc47727ef84efaa1 /drivers
parent3b8006e51038ef263a0404756d9e190c9a9f74d5 (diff)
HID: move gyration quirks
Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-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-gyration.c96
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-input-quirks.c46
7 files changed, 112 insertions, 46 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index d71507a5cccb..4dcb92ac887a 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -138,6 +138,13 @@ config HID_EZKEY
138 ---help--- 138 ---help---
139 Support for Ezkey mouse and barcodes. 139 Support for Ezkey mouse and barcodes.
140 140
141config HID_GYRATION
142 tristate "Gyration"
143 default m
144 depends on USB_HID
145 ---help---
146 Support for Gyration remote.
147
141config HID_LOGITECH 148config HID_LOGITECH
142 tristate "Logitech" 149 tristate "Logitech"
143 default m 150 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 48b5fb25d16a..50a06f71b48a 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
19obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 19obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
20obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 20obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
21obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 21obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
22obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
22obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 23obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
23obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 24obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
24obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o 25obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index fa2723100450..53f30560b930 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1171,6 +1171,7 @@ static const struct hid_device_id hid_blacklist[] = {
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_BARCODE_2) },
1172 { 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) },
1173 { 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_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1174 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1175 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1175 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 1176 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
1176 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 1177 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index 1dbb454c8112..1c9e7c2814a5 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -25,6 +25,9 @@ static int __init hid_dummy_init(void)
25#ifdef CONFIG_HID_EZKEY_MODULE 25#ifdef CONFIG_HID_EZKEY_MODULE
26 HID_COMPAT_CALL_DRIVER(ezkey); 26 HID_COMPAT_CALL_DRIVER(ezkey);
27#endif 27#endif
28#ifdef CONFIG_HID_EZKEY_MODULE
29 HID_COMPAT_CALL_DRIVER(gyration);
30#endif
28#ifdef CONFIG_HID_LOGITECH_MODULE 31#ifdef CONFIG_HID_LOGITECH_MODULE
29 HID_COMPAT_CALL_DRIVER(logitech); 32 HID_COMPAT_CALL_DRIVER(logitech);
30#endif 33#endif
diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c
new file mode 100644
index 000000000000..ac5120f542cc
--- /dev/null
+++ b/drivers/hid/hid-gyration.c
@@ -0,0 +1,96 @@
1/*
2 * HID driver for some gyration "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 gy_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
27 EV_KEY, (c))
28static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi,
29 struct hid_field *field, struct hid_usage *usage,
30 unsigned long **bit, int *max)
31{
32 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
33 return 0;
34
35 set_bit(EV_REP, hi->input->evbit);
36 switch (usage->hid & HID_USAGE) {
37 /* Reported on Gyration MCE Remote */
38 case 0x00d: gy_map_key_clear(KEY_HOME); break;
39 case 0x024: gy_map_key_clear(KEY_DVD); break;
40 case 0x025: gy_map_key_clear(KEY_PVR); break;
41 case 0x046: gy_map_key_clear(KEY_MEDIA); break;
42 case 0x047: gy_map_key_clear(KEY_MP3); break;
43 case 0x049: gy_map_key_clear(KEY_CAMERA); break;
44 case 0x04a: gy_map_key_clear(KEY_VIDEO); break;
45
46 default:
47 return 0;
48 }
49 return 1;
50}
51
52static int gyration_event(struct hid_device *hdev, struct hid_field *field,
53 struct hid_usage *usage, __s32 value)
54{
55 struct input_dev *input = field->hidinput->input;
56
57 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK &&
58 (usage->hid & 0xff) == 0x82) {
59 input_event(input, usage->type, usage->code, 1);
60 input_sync(input);
61 input_event(input, usage->type, usage->code, 0);
62 input_sync(input);
63 return 1;
64 }
65
66 return 0;
67}
68
69static const struct hid_device_id gyration_devices[] = {
70 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
71 { }
72};
73MODULE_DEVICE_TABLE(hid, gyration_devices);
74
75static struct hid_driver gyration_driver = {
76 .name = "gyration",
77 .id_table = gyration_devices,
78 .input_mapping = gyration_input_mapping,
79 .event = gyration_event,
80};
81
82static int gyration_init(void)
83{
84 return hid_register_driver(&gyration_driver);
85}
86
87static void gyration_exit(void)
88{
89 hid_unregister_driver(&gyration_driver);
90}
91
92module_init(gyration_init);
93module_exit(gyration_exit);
94MODULE_LICENSE("GPL");
95
96HID_COMPAT_LOAD_DRIVER(gyration);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ebe665206a72..678f7c3f341d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -223,6 +223,10 @@
223#define USB_DEVICE_ID_GTCO_1005 0x1005 223#define USB_DEVICE_ID_GTCO_1005 0x1005
224#define USB_DEVICE_ID_GTCO_1006 0x1006 224#define USB_DEVICE_ID_GTCO_1006 0x1006
225#define USB_DEVICE_ID_GTCO_1007 0x1007 225#define USB_DEVICE_ID_GTCO_1007 0x1007
226
227#define USB_VENDOR_ID_GYRATION 0x0c16
228#define USB_DEVICE_ID_GYRATION_REMOTE 0x0002
229
226#define USB_VENDOR_ID_HAPP 0x078b 230#define USB_VENDOR_ID_HAPP 0x078b
227#define USB_DEVICE_ID_UGCI_DRIVING 0x0010 231#define USB_DEVICE_ID_UGCI_DRIVING 0x0010
228#define USB_DEVICE_ID_UGCI_FLYING 0x0020 232#define USB_DEVICE_ID_UGCI_FLYING 0x0020
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 1a4ba0313030..980e7456e260 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -16,43 +16,12 @@
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_key_clear(c) hid_map_usage_clear(hidinput, usage, bit, \
20 max, EV_KEY, (c))
21
22static int quirk_gyration_remote(struct hid_usage *usage,
23 struct hid_input *hidinput, unsigned long **bit, int *max)
24{
25 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
26 return 0;
27
28 set_bit(EV_REP, hidinput->input->evbit);
29 switch(usage->hid & HID_USAGE) {
30 /* Reported on Gyration MCE Remote */
31 case 0x00d: map_key_clear(KEY_HOME); break;
32 case 0x024: map_key_clear(KEY_DVD); break;
33 case 0x025: map_key_clear(KEY_PVR); break;
34 case 0x046: map_key_clear(KEY_MEDIA); break;
35 case 0x047: map_key_clear(KEY_MP3); break;
36 case 0x049: map_key_clear(KEY_CAMERA); break;
37 case 0x04a: map_key_clear(KEY_VIDEO); break;
38
39 default:
40 return 0;
41 }
42 return 1;
43}
44
45#define VENDOR_ID_GYRATION 0x0c16
46#define DEVICE_ID_GYRATION_REMOTE 0x0002
47
48static const struct hid_input_blacklist { 19static const struct hid_input_blacklist {
49 __u16 idVendor; 20 __u16 idVendor;
50 __u16 idProduct; 21 __u16 idProduct;
51 int (*quirk)(struct hid_usage *, struct hid_input *, unsigned long **, 22 int (*quirk)(struct hid_usage *, struct hid_input *, unsigned long **,
52 int *); 23 int *);
53} hid_input_blacklist[] = { 24} hid_input_blacklist[] = {
54 { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote },
55
56 { 0, 0, NULL } 25 { 0, 0, NULL }
57}; 26};
58 27
@@ -74,21 +43,6 @@ int hidinput_mapping_quirks(struct hid_usage *usage,
74 43
75int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) 44int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
76{ 45{
77 struct input_dev *input;
78
79 input = field->hidinput->input;
80
81 /* Gyration MCE remote "Sleep" key */
82 if (hid->vendor == VENDOR_ID_GYRATION &&
83 hid->product == DEVICE_ID_GYRATION_REMOTE &&
84 (usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK &&
85 (usage->hid & 0xff) == 0x82) {
86 input_event(input, usage->type, usage->code, 1);
87 input_sync(input);
88 input_event(input, usage->type, usage->code, 0);
89 input_sync(input);
90 return 1;
91 }
92 return 0; 46 return 0;
93} 47}
94 48