aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-23 15:56:07 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:51 -0400
commit90231e7eaf752856a2c13f786f36ec7f641bad28 (patch)
treefd9056ecefeb52709c8ddca651428105552c2a84 /drivers/hid
parent78a849a682a1d5ee7b7187b08abdc48656326a4e (diff)
HID: move sunplus 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-input-quirks.c20
-rw-r--r--drivers/hid/hid-sunplus.c82
-rw-r--r--drivers/hid/usbhid/hid-quirks.c16
7 files changed, 94 insertions, 36 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 8067b653f8bf..147223993b86 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -112,6 +112,13 @@ config HID_MICROSOFT
112 Support for some Microsoft devices which breaks less or more 112 Support for some Microsoft devices which breaks less or more
113 HID specification. 113 HID specification.
114 114
115config HID_SUNPLUS
116 tristate "Sunplus"
117 default m
118 depends on USB_HID
119 ---help---
120 Support for Sunplus WDesktop input device.
121
115endmenu 122endmenu
116 123
117endif # HID_SUPPORT 124endif # HID_SUPPORT
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 3dc2828fb719..314d5b0c70d5 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -15,6 +15,7 @@ endif
15obj-$(CONFIG_HID_APPLE) += hid-apple.o 15obj-$(CONFIG_HID_APPLE) += hid-apple.o
16obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 16obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
17obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 17obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
18obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
18 19
19obj-$(CONFIG_USB_HID) += usbhid/ 20obj-$(CONFIG_USB_HID) += usbhid/
20obj-$(CONFIG_USB_MOUSE) += usbhid/ 21obj-$(CONFIG_USB_MOUSE) += usbhid/
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index db8fbd2f5028..e9e6dbbaaa83 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1181,6 +1181,7 @@ static const struct hid_device_id hid_blacklist[] = {
1181 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, 1181 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
1182 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1182 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
1183 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 1183 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
1184 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1184 1185
1185 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1186 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
1186 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 1187 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index fe64d60f9010..0c833d920c3d 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -13,6 +13,9 @@ static int __init hid_dummy_init(void)
13#ifdef CONFIG_HID_MICROSOFT_MODULE 13#ifdef CONFIG_HID_MICROSOFT_MODULE
14 HID_COMPAT_CALL_DRIVER(microsoft); 14 HID_COMPAT_CALL_DRIVER(microsoft);
15#endif 15#endif
16#ifdef CONFIG_HID_SUNPLUS_MODULE
17 HID_COMPAT_CALL_DRIVER(sunplus);
18#endif
16 19
17 return -EIO; 20 return -EIO;
18} 21}
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index d1b4f093dcb3..a5e7163158fb 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -170,21 +170,6 @@ static int quirk_btc_8193(struct hid_usage *usage, struct hid_input *hidinput,
170 return 1; 170 return 1;
171} 171}
172 172
173static int quirk_sunplus_wdesktop(struct hid_usage *usage,
174 struct hid_input *hidinput, unsigned long **bit, int *max)
175{
176 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
177 return 0;
178
179 switch (usage->hid & HID_USAGE) {
180 case 0x2003: map_key_clear(KEY_ZOOMIN); break;
181 case 0x2103: map_key_clear(KEY_ZOOMOUT); break;
182 default:
183 return 0;
184 }
185 return 1;
186}
187
188#define VENDOR_ID_BELKIN 0x1020 173#define VENDOR_ID_BELKIN 0x1020
189#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 174#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
190 175
@@ -206,9 +191,6 @@ static int quirk_sunplus_wdesktop(struct hid_usage *usage,
206#define VENDOR_ID_PETALYNX 0x18b1 191#define VENDOR_ID_PETALYNX 0x18b1
207#define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 192#define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
208 193
209#define VENDOR_ID_SUNPLUS 0x04fc
210#define DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
211
212static const struct hid_input_blacklist { 194static const struct hid_input_blacklist {
213 __u16 idVendor; 195 __u16 idVendor;
214 __u16 idProduct; 196 __u16 idProduct;
@@ -229,8 +211,6 @@ static const struct hid_input_blacklist {
229 211
230 { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote }, 212 { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote },
231 213
232 { VENDOR_ID_SUNPLUS, DEVICE_ID_SUNPLUS_WDESKTOP, quirk_sunplus_wdesktop },
233
234 { 0, 0, NULL } 214 { 0, 0, NULL }
235}; 215};
236 216
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
new file mode 100644
index 000000000000..5ba68f7dbb78
--- /dev/null
+++ b/drivers/hid/hid-sunplus.c
@@ -0,0 +1,82 @@
1/*
2 * HID driver for some sunplus "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 sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int rsize)
27{
28 if (rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
29 rdesc[106] == 0x03) {
30 dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop "
31 "report descriptor\n");
32 rdesc[105] = rdesc[110] = 0x03;
33 rdesc[106] = rdesc[111] = 0x21;
34 }
35}
36
37#define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
38 EV_KEY, (c))
39static int sp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
40 struct hid_field *field, struct hid_usage *usage,
41 unsigned long **bit, int *max)
42{
43 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
44 return 0;
45
46 switch (usage->hid & HID_USAGE) {
47 case 0x2003: sp_map_key_clear(KEY_ZOOMIN); break;
48 case 0x2103: sp_map_key_clear(KEY_ZOOMOUT); break;
49 default:
50 return 0;
51 }
52 return 1;
53}
54
55static const struct hid_device_id sp_devices[] = {
56 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
57 { }
58};
59MODULE_DEVICE_TABLE(hid, sp_devices);
60
61static struct hid_driver sp_driver = {
62 .name = "sunplus",
63 .id_table = sp_devices,
64 .report_fixup = sp_report_fixup,
65 .input_mapping = sp_input_mapping,
66};
67
68static int sp_init(void)
69{
70 return hid_register_driver(&sp_driver);
71}
72
73static void sp_exit(void)
74{
75 hid_unregister_driver(&sp_driver);
76}
77
78module_init(sp_init);
79module_exit(sp_exit);
80MODULE_LICENSE("GPL");
81
82HID_COMPAT_LOAD_DRIVER(sunplus);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 1614ed2efc15..7f38c21e146b 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -93,8 +93,6 @@ static const struct hid_rdesc_blacklist {
93 93
94 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, 94 { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE },
95 95
96 { USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP, HID_QUIRK_RDESC_SUNPLUS_WDESKTOP },
97
98 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, 96 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX },
99 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, 97 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX },
100 98
@@ -342,17 +340,6 @@ static void usbhid_fixup_cymotion_descriptor(char *rdesc, int rsize)
342 } 340 }
343} 341}
344 342
345static void usbhid_fixup_sunplus_wdesktop(unsigned char *rdesc, int rsize)
346{
347 if (rsize >= 107 && rdesc[104] == 0x26
348 && rdesc[105] == 0x80
349 && rdesc[106] == 0x03) {
350 printk(KERN_INFO "Fixing up Sunplus Wireless Desktop report descriptor\n");
351 rdesc[105] = rdesc[110] = 0x03;
352 rdesc[106] = rdesc[111] = 0x21;
353 }
354}
355
356/* 343/*
357 * Samsung IrDA remote controller (reports as Cypress USB Mouse). 344 * Samsung IrDA remote controller (reports as Cypress USB Mouse).
358 * 345 *
@@ -444,9 +431,6 @@ static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned
444 431
445 if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE) 432 if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE)
446 usbhid_fixup_samsung_irda_descriptor(rdesc, rsize); 433 usbhid_fixup_samsung_irda_descriptor(rdesc, rsize);
447
448 if (quirks & HID_QUIRK_RDESC_SUNPLUS_WDESKTOP)
449 usbhid_fixup_sunplus_wdesktop(rdesc, rsize);
450} 434}
451 435
452/** 436/**