aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig60
-rw-r--r--drivers/hid/hid-a4tech.c2
-rw-r--r--drivers/hid/hid-core.c3
-rw-r--r--drivers/hid/hid-debug.c2
-rw-r--r--drivers/hid/hid-ids.h8
-rw-r--r--drivers/hid/hid-input.c80
-rw-r--r--drivers/hid/hid-sony.c49
-rw-r--r--drivers/hid/hid-stantum.c2
-rw-r--r--drivers/hid/hidraw.c14
-rw-r--r--drivers/hid/usbhid/hid-core.c7
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hid/usbhid/hiddev.c40
12 files changed, 174 insertions, 94 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 6369ba7f96f..2072e0138e9 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -56,20 +56,20 @@ menu "Special HID drivers"
56 depends on HID 56 depends on HID
57 57
58config HID_3M_PCT 58config HID_3M_PCT
59 tristate "3M PCT" 59 tristate "3M PCT touchscreen"
60 depends on USB_HID 60 depends on USB_HID
61 ---help--- 61 ---help---
62 Support for 3M PCT touch screens. 62 Support for 3M PCT touch screens.
63 63
64config HID_A4TECH 64config HID_A4TECH
65 tristate "A4 tech" if EMBEDDED 65 tristate "A4 tech mice" if EMBEDDED
66 depends on USB_HID 66 depends on USB_HID
67 default !EMBEDDED 67 default !EMBEDDED
68 ---help--- 68 ---help---
69 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 69 Support for A4 tech X5 and WOP-35 / Trust 450L mice.
70 70
71config HID_ACRUX_FF 71config HID_ACRUX_FF
72 tristate "ACRUX force feedback support" 72 tristate "ACRUX force feedback"
73 depends on USB_HID 73 depends on USB_HID
74 select INPUT_FF_MEMLESS 74 select INPUT_FF_MEMLESS
75 ---help--- 75 ---help---
@@ -77,7 +77,7 @@ config HID_ACRUX_FF
77 game controllers. 77 game controllers.
78 78
79config HID_APPLE 79config HID_APPLE
80 tristate "Apple" if EMBEDDED 80 tristate "Apple {i,Power,Mac}Books" if EMBEDDED
81 depends on (USB_HID || BT_HIDP) 81 depends on (USB_HID || BT_HIDP)
82 default !EMBEDDED 82 default !EMBEDDED
83 ---help--- 83 ---help---
@@ -88,7 +88,7 @@ config HID_APPLE
88 MacBooks, MacBook Pros and Apple Aluminum. 88 MacBooks, MacBook Pros and Apple Aluminum.
89 89
90config HID_BELKIN 90config HID_BELKIN
91 tristate "Belkin" if EMBEDDED 91 tristate "Belkin Flip KVM and Wireless keyboard" if EMBEDDED
92 depends on USB_HID 92 depends on USB_HID
93 default !EMBEDDED 93 default !EMBEDDED
94 ---help--- 94 ---help---
@@ -101,14 +101,14 @@ config HID_CANDO
101 Support for Cando dual touch panel. 101 Support for Cando dual touch panel.
102 102
103config HID_CHERRY 103config HID_CHERRY
104 tristate "Cherry" if EMBEDDED 104 tristate "Cherry Cymotion keyboard" if EMBEDDED
105 depends on USB_HID 105 depends on USB_HID
106 default !EMBEDDED 106 default !EMBEDDED
107 ---help--- 107 ---help---
108 Support for Cherry Cymotion keyboard. 108 Support for Cherry Cymotion keyboard.
109 109
110config HID_CHICONY 110config HID_CHICONY
111 tristate "Chicony" if EMBEDDED 111 tristate "Chicony Tactical pad" if EMBEDDED
112 depends on USB_HID 112 depends on USB_HID
113 default !EMBEDDED 113 default !EMBEDDED
114 ---help--- 114 ---help---
@@ -130,20 +130,20 @@ config HID_PRODIKEYS
130 and some additional multimedia keys. 130 and some additional multimedia keys.
131 131
132config HID_CYPRESS 132config HID_CYPRESS
133 tristate "Cypress" if EMBEDDED 133 tristate "Cypress mouse and barcode readers" if EMBEDDED
134 depends on USB_HID 134 depends on USB_HID
135 default !EMBEDDED 135 default !EMBEDDED
136 ---help--- 136 ---help---
137 Support for cypress mouse and barcode readers. 137 Support for cypress mouse and barcode readers.
138 138
139config HID_DRAGONRISE 139config HID_DRAGONRISE
140 tristate "DragonRise Inc. support" 140 tristate "DragonRise Inc. game controller"
141 depends on USB_HID 141 depends on USB_HID
142 ---help--- 142 ---help---
143 Say Y here if you have DragonRise Inc.game controllers. 143 Say Y here if you have DragonRise Inc.game controllers.
144 144
145config DRAGONRISE_FF 145config DRAGONRISE_FF
146 bool "DragonRise Inc. force feedback support" 146 bool "DragonRise Inc. force feedback"
147 depends on HID_DRAGONRISE 147 depends on HID_DRAGONRISE
148 select INPUT_FF_MEMLESS 148 select INPUT_FF_MEMLESS
149 ---help--- 149 ---help---
@@ -157,46 +157,46 @@ config HID_EGALAX
157 Support for the eGalax dual-touch panel. 157 Support for the eGalax dual-touch panel.
158 158
159config HID_ELECOM 159config HID_ELECOM
160 tristate "ELECOM" 160 tristate "ELECOM BM084 bluetooth mouse"
161 depends on BT_HIDP 161 depends on BT_HIDP
162 ---help--- 162 ---help---
163 Support for the ELECOM BM084 (bluetooth mouse). 163 Support for the ELECOM BM084 (bluetooth mouse).
164 164
165config HID_EZKEY 165config HID_EZKEY
166 tristate "Ezkey" if EMBEDDED 166 tristate "Ezkey BTC 8193 keyboard" if EMBEDDED
167 depends on USB_HID 167 depends on USB_HID
168 default !EMBEDDED 168 default !EMBEDDED
169 ---help--- 169 ---help---
170 Support for Ezkey BTC 8193 keyboard. 170 Support for Ezkey BTC 8193 keyboard.
171 171
172config HID_KYE 172config HID_KYE
173 tristate "Kye" if EMBEDDED 173 tristate "Kye/Genius Ergo Mouse" if EMBEDDED
174 depends on USB_HID 174 depends on USB_HID
175 default !EMBEDDED 175 default !EMBEDDED
176 ---help--- 176 ---help---
177 Support for Kye/Genius Ergo Mouse. 177 Support for Kye/Genius Ergo Mouse.
178 178
179config HID_GYRATION 179config HID_GYRATION
180 tristate "Gyration" 180 tristate "Gyration remote control"
181 depends on USB_HID 181 depends on USB_HID
182 ---help--- 182 ---help---
183 Support for Gyration remote control. 183 Support for Gyration remote control.
184 184
185config HID_TWINHAN 185config HID_TWINHAN
186 tristate "Twinhan" 186 tristate "Twinhan IR remote control"
187 depends on USB_HID 187 depends on USB_HID
188 ---help--- 188 ---help---
189 Support for Twinhan IR remote control. 189 Support for Twinhan IR remote control.
190 190
191config HID_KENSINGTON 191config HID_KENSINGTON
192 tristate "Kensington" if EMBEDDED 192 tristate "Kensington Slimblade Trackball" if EMBEDDED
193 depends on USB_HID 193 depends on USB_HID
194 default !EMBEDDED 194 default !EMBEDDED
195 ---help--- 195 ---help---
196 Support for Kensington Slimblade Trackball. 196 Support for Kensington Slimblade Trackball.
197 197
198config HID_LOGITECH 198config HID_LOGITECH
199 tristate "Logitech" if EMBEDDED 199 tristate "Logitech devices" if EMBEDDED
200 depends on USB_HID 200 depends on USB_HID
201 default !EMBEDDED 201 default !EMBEDDED
202 ---help--- 202 ---help---
@@ -245,39 +245,39 @@ config HID_MAGICMOUSE
245 Apple Wireless "Magic" Mouse. 245 Apple Wireless "Magic" Mouse.
246 246
247config HID_MICROSOFT 247config HID_MICROSOFT
248 tristate "Microsoft" if EMBEDDED 248 tristate "Microsoft non-fully HID-compliant devices" if EMBEDDED
249 depends on USB_HID 249 depends on USB_HID
250 default !EMBEDDED 250 default !EMBEDDED
251 ---help--- 251 ---help---
252 Support for Microsoft devices that are not fully compliant with HID standard. 252 Support for Microsoft devices that are not fully compliant with HID standard.
253 253
254config HID_MOSART 254config HID_MOSART
255 tristate "MosArt" 255 tristate "MosArt dual-touch panels"
256 depends on USB_HID 256 depends on USB_HID
257 ---help--- 257 ---help---
258 Support for MosArt dual-touch panels. 258 Support for MosArt dual-touch panels.
259 259
260config HID_MONTEREY 260config HID_MONTEREY
261 tristate "Monterey" if EMBEDDED 261 tristate "Monterey Genius KB29E keyboard" if EMBEDDED
262 depends on USB_HID 262 depends on USB_HID
263 default !EMBEDDED 263 default !EMBEDDED
264 ---help--- 264 ---help---
265 Support for Monterey Genius KB29E. 265 Support for Monterey Genius KB29E.
266 266
267config HID_NTRIG 267config HID_NTRIG
268 tristate "NTrig" 268 tristate "N-Trig touch screen"
269 depends on USB_HID 269 depends on USB_HID
270 ---help--- 270 ---help---
271 Support for N-Trig touch screen. 271 Support for N-Trig touch screen.
272 272
273config HID_ORTEK 273config HID_ORTEK
274 tristate "Ortek" 274 tristate "Ortek WKB-2000 wireless keyboard and mouse trackpad"
275 depends on USB_HID 275 depends on USB_HID
276 ---help--- 276 ---help---
277 Support for Ortek WKB-2000 wireless keyboard + mouse trackpad. 277 Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.
278 278
279config HID_PANTHERLORD 279config HID_PANTHERLORD
280 tristate "Pantherlord support" 280 tristate "Pantherlord/GreenAsia game controller"
281 depends on USB_HID 281 depends on USB_HID
282 ---help--- 282 ---help---
283 Say Y here if you have a PantherLord/GreenAsia based game controller 283 Say Y here if you have a PantherLord/GreenAsia based game controller
@@ -292,7 +292,7 @@ config PANTHERLORD_FF
292 or adapter and want to enable force feedback support for it. 292 or adapter and want to enable force feedback support for it.
293 293
294config HID_PETALYNX 294config HID_PETALYNX
295 tristate "Petalynx" 295 tristate "Petalynx Maxter remote control"
296 depends on USB_HID 296 depends on USB_HID
297 ---help--- 297 ---help---
298 Support for Petalynx Maxter remote control. 298 Support for Petalynx Maxter remote control.
@@ -356,7 +356,7 @@ config HID_PICOLCD_LEDS
356 Provide access to PicoLCD's GPO pins via leds class. 356 Provide access to PicoLCD's GPO pins via leds class.
357 357
358config HID_QUANTA 358config HID_QUANTA
359 tristate "Quanta Optical Touch" 359 tristate "Quanta Optical Touch panels"
360 depends on USB_HID 360 depends on USB_HID
361 ---help--- 361 ---help---
362 Support for Quanta Optical Touch dual-touch panels. 362 Support for Quanta Optical Touch dual-touch panels.
@@ -377,31 +377,31 @@ config HID_ROCCAT_KONE
377 Support for Roccat Kone mouse. 377 Support for Roccat Kone mouse.
378 378
379config HID_SAMSUNG 379config HID_SAMSUNG
380 tristate "Samsung" 380 tristate "Samsung InfraRed remote control or keyboards"
381 depends on USB_HID 381 depends on USB_HID
382 ---help--- 382 ---help---
383 Support for Samsung InfraRed remote control or keyboards. 383 Support for Samsung InfraRed remote control or keyboards.
384 384
385config HID_SONY 385config HID_SONY
386 tristate "Sony" 386 tristate "Sony PS3 controller"
387 depends on USB_HID 387 depends on USB_HID
388 ---help--- 388 ---help---
389 Support for Sony PS3 controller. 389 Support for Sony PS3 controller.
390 390
391config HID_STANTUM 391config HID_STANTUM
392 tristate "Stantum" 392 tristate "Stantum multitouch panel"
393 depends on USB_HID 393 depends on USB_HID
394 ---help--- 394 ---help---
395 Support for Stantum multitouch panel. 395 Support for Stantum multitouch panel.
396 396
397config HID_SUNPLUS 397config HID_SUNPLUS
398 tristate "Sunplus" 398 tristate "Sunplus wireless desktop"
399 depends on USB_HID 399 depends on USB_HID
400 ---help--- 400 ---help---
401 Support for Sunplus wireless desktop. 401 Support for Sunplus wireless desktop.
402 402
403config HID_GREENASIA 403config HID_GREENASIA
404 tristate "GreenAsia (Product ID 0x12) support" 404 tristate "GreenAsia (Product ID 0x12) game controller support"
405 depends on USB_HID 405 depends on USB_HID
406 ---help--- 406 ---help---
407 Say Y here if you have a GreenAsia (Product ID 0x12) based game 407 Say Y here if you have a GreenAsia (Product ID 0x12) based game
diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c
index 3a2b223c1da..1666c1684e7 100644
--- a/drivers/hid/hid-a4tech.c
+++ b/drivers/hid/hid-a4tech.c
@@ -133,6 +133,8 @@ static const struct hid_device_id a4_devices[] = {
133 .driver_data = A4_2WHEEL_MOUSE_HACK_7 }, 133 .driver_data = A4_2WHEEL_MOUSE_HACK_7 },
134 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D), 134 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D),
135 .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, 135 .driver_data = A4_2WHEEL_MOUSE_HACK_B8 },
136 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649),
137 .driver_data = A4_2WHEEL_MOUSE_HACK_B8 },
136 { } 138 { }
137}; 139};
138MODULE_DEVICE_TABLE(hid, a4_devices); 140MODULE_DEVICE_TABLE(hid, a4_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3cb6632d451..5ac2be978c9 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1241,6 +1241,7 @@ static const struct hid_device_id hid_blacklist[] = {
1241 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1241 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) },
1242 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1242 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
1243 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1243 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
1244 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
1244#if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE) 1245#if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE)
1245 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, 1246 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) },
1246#endif 1247#endif
@@ -1377,6 +1378,8 @@ static const struct hid_device_id hid_blacklist[] = {
1377 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1378 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1378 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1379 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1379 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, 1380 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
1381 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) },
1382 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) },
1380 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1383 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1381 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 1384 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1382 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 1385 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 61a3e572224..75c5e23d09d 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -570,6 +570,8 @@ void hid_debug_event(struct hid_device *hdev, char *buf)
570 buf[i]; 570 buf[i];
571 list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; 571 list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
572 } 572 }
573
574 wake_up_interruptible(&hdev->debug_wait);
573} 575}
574EXPORT_SYMBOL_GPL(hid_debug_event); 576EXPORT_SYMBOL_GPL(hid_debug_event);
575 577
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 855aa8e355f..5247f5bdb49 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -25,6 +25,7 @@
25#define USB_VENDOR_ID_A4TECH 0x09da 25#define USB_VENDOR_ID_A4TECH 0x09da
26#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 26#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
27#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a 27#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
28#define USB_DEVICE_ID_A4TECH_RP_649 0x001a
28 29
29#define USB_VENDOR_ID_AASHIMA 0x06d6 30#define USB_VENDOR_ID_AASHIMA 0x06d6
30#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 31#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
@@ -142,6 +143,7 @@
142#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 143#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051
143#define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff 144#define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff
144#define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3 145#define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3
146#define USB_DEVICE_ID_CH_AXIS_295 0x001c
145 147
146#define USB_VENDOR_ID_CHERRY 0x046a 148#define USB_VENDOR_ID_CHERRY 0x046a
147#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 149#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
@@ -485,6 +487,12 @@
485#define USB_VENDOR_ID_STANTUM 0x1f87 487#define USB_VENDOR_ID_STANTUM 0x1f87
486#define USB_DEVICE_ID_MTP 0x0002 488#define USB_DEVICE_ID_MTP 0x0002
487 489
490#define USB_VENDOR_ID_STANTUM_STM 0x0483
491#define USB_DEVICE_ID_MTP_STM 0x3261
492
493#define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403
494#define USB_DEVICE_ID_MTP_SITRONIX 0x5001
495
488#define USB_VENDOR_ID_SUN 0x0430 496#define USB_VENDOR_ID_SUN 0x0430
489#define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab 497#define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab
490 498
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 6c03dcc5760..8e733b6eae2 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -149,6 +149,83 @@ static int hidinput_setkeycode(struct input_dev *dev,
149} 149}
150 150
151 151
152/**
153 * hidinput_calc_abs_res - calculate an absolute axis resolution
154 * @field: the HID report field to calculate resolution for
155 * @code: axis code
156 *
157 * The formula is:
158 * (logical_maximum - logical_minimum)
159 * resolution = ----------------------------------------------------------
160 * (physical_maximum - physical_minimum) * 10 ^ unit_exponent
161 *
162 * as seen in the HID specification v1.11 6.2.2.7 Global Items.
163 *
164 * Only exponent 1 length units are processed. Centimeters are converted to
165 * inches. Degrees are converted to radians.
166 */
167static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
168{
169 __s32 unit_exponent = field->unit_exponent;
170 __s32 logical_extents = field->logical_maximum -
171 field->logical_minimum;
172 __s32 physical_extents = field->physical_maximum -
173 field->physical_minimum;
174 __s32 prev;
175
176 /* Check if the extents are sane */
177 if (logical_extents <= 0 || physical_extents <= 0)
178 return 0;
179
180 /*
181 * Verify and convert units.
182 * See HID specification v1.11 6.2.2.7 Global Items for unit decoding
183 */
184 if (code == ABS_X || code == ABS_Y || code == ABS_Z) {
185 if (field->unit == 0x11) { /* If centimeters */
186 /* Convert to inches */
187 prev = logical_extents;
188 logical_extents *= 254;
189 if (logical_extents < prev)
190 return 0;
191 unit_exponent += 2;
192 } else if (field->unit != 0x13) { /* If not inches */
193 return 0;
194 }
195 } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) {
196 if (field->unit == 0x14) { /* If degrees */
197 /* Convert to radians */
198 prev = logical_extents;
199 logical_extents *= 573;
200 if (logical_extents < prev)
201 return 0;
202 unit_exponent += 1;
203 } else if (field->unit != 0x12) { /* If not radians */
204 return 0;
205 }
206 } else {
207 return 0;
208 }
209
210 /* Apply negative unit exponent */
211 for (; unit_exponent < 0; unit_exponent++) {
212 prev = logical_extents;
213 logical_extents *= 10;
214 if (logical_extents < prev)
215 return 0;
216 }
217 /* Apply positive unit exponent */
218 for (; unit_exponent > 0; unit_exponent--) {
219 prev = physical_extents;
220 physical_extents *= 10;
221 if (physical_extents < prev)
222 return 0;
223 }
224
225 /* Calculate resolution */
226 return logical_extents / physical_extents;
227}
228
152static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, 229static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
153 struct hid_usage *usage) 230 struct hid_usage *usage)
154{ 231{
@@ -537,6 +614,9 @@ mapped:
537 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); 614 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);
538 else input_set_abs_params(input, usage->code, a, b, 0, 0); 615 else input_set_abs_params(input, usage->code, a, b, 0, 0);
539 616
617 input_abs_set_res(input, usage->code,
618 hidinput_calc_abs_res(field, usage->code));
619
540 /* use a larger default input buffer for MT devices */ 620 /* use a larger default input buffer for MT devices */
541 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) 621 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0)
542 input_set_events_per_packet(input, 60); 622 input_set_events_per_packet(input, 60);
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 402d5574b57..0c164b3dce3 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -24,7 +24,9 @@
24 24
25#include "hid-ids.h" 25#include "hid-ids.h"
26 26
27#define VAIO_RDESC_CONSTANT 0x0001 27#define VAIO_RDESC_CONSTANT (1 << 0)
28#define SIXAXIS_CONTROLLER_USB (1 << 1)
29#define SIXAXIS_CONTROLLER_BT (1 << 2)
28 30
29struct sony_sc { 31struct sony_sc {
30 unsigned long quirks; 32 unsigned long quirks;
@@ -44,12 +46,31 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
44 } 46 }
45} 47}
46 48
49static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
50 size_t count, unsigned char report_type)
51{
52 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
53 struct usb_device *dev = interface_to_usbdev(intf);
54 struct usb_host_interface *interface = intf->cur_altsetting;
55 int report_id = buf[0];
56 int ret;
57
58 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
59 HID_REQ_SET_REPORT,
60 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
61 ((report_type + 1) << 8) | report_id,
62 interface->desc.bInterfaceNumber, buf, count,
63 USB_CTRL_SET_TIMEOUT);
64
65 return ret;
66}
67
47/* 68/*
48 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller 69 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
49 * to "operational". Without this, the ps3 controller will not report any 70 * to "operational". Without this, the ps3 controller will not report any
50 * events. 71 * events.
51 */ 72 */
52static int sony_set_operational_usb(struct hid_device *hdev) 73static int sixaxis_set_operational_usb(struct hid_device *hdev)
53{ 74{
54 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 75 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
55 struct usb_device *dev = interface_to_usbdev(intf); 76 struct usb_device *dev = interface_to_usbdev(intf);
@@ -74,7 +95,7 @@ static int sony_set_operational_usb(struct hid_device *hdev)
74 return ret; 95 return ret;
75} 96}
76 97
77static int sony_set_operational_bt(struct hid_device *hdev) 98static int sixaxis_set_operational_bt(struct hid_device *hdev)
78{ 99{
79 unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; 100 unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
80 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); 101 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
@@ -108,16 +129,14 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
108 goto err_free; 129 goto err_free;
109 } 130 }
110 131
111 switch (hdev->bus) { 132 if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
112 case BUS_USB: 133 hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
113 ret = sony_set_operational_usb(hdev); 134 ret = sixaxis_set_operational_usb(hdev);
114 break;
115 case BUS_BLUETOOTH:
116 ret = sony_set_operational_bt(hdev);
117 break;
118 default:
119 ret = 0;
120 } 135 }
136 else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
137 ret = sixaxis_set_operational_bt(hdev);
138 else
139 ret = 0;
121 140
122 if (ret < 0) 141 if (ret < 0)
123 goto err_stop; 142 goto err_stop;
@@ -137,8 +156,10 @@ static void sony_remove(struct hid_device *hdev)
137} 156}
138 157
139static const struct hid_device_id sony_devices[] = { 158static const struct hid_device_id sony_devices[] = {
140 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 159 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
141 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 160 .driver_data = SIXAXIS_CONTROLLER_USB },
161 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
162 .driver_data = SIXAXIS_CONTROLLER_BT },
142 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), 163 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
143 .driver_data = VAIO_RDESC_CONSTANT }, 164 .driver_data = VAIO_RDESC_CONSTANT },
144 { } 165 { }
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
index 90df886c5e0..3171be28c3d 100644
--- a/drivers/hid/hid-stantum.c
+++ b/drivers/hid/hid-stantum.c
@@ -249,6 +249,8 @@ static void stantum_remove(struct hid_device *hdev)
249 249
250static const struct hid_device_id stantum_devices[] = { 250static const struct hid_device_id stantum_devices[] = {
251 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, 251 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
252 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) },
253 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) },
252 { } 254 { }
253}; 255};
254MODULE_DEVICE_TABLE(hid, stantum_devices); 256MODULE_DEVICE_TABLE(hid, stantum_devices);
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 925992f549f..8a4b32dca9f 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -218,9 +218,13 @@ static int hidraw_release(struct inode * inode, struct file * file)
218 unsigned int minor = iminor(inode); 218 unsigned int minor = iminor(inode);
219 struct hidraw *dev; 219 struct hidraw *dev;
220 struct hidraw_list *list = file->private_data; 220 struct hidraw_list *list = file->private_data;
221 int ret;
221 222
222 if (!hidraw_table[minor]) 223 mutex_lock(&minors_lock);
223 return -ENODEV; 224 if (!hidraw_table[minor]) {
225 ret = -ENODEV;
226 goto unlock;
227 }
224 228
225 list_del(&list->node); 229 list_del(&list->node);
226 dev = hidraw_table[minor]; 230 dev = hidraw_table[minor];
@@ -233,10 +237,12 @@ static int hidraw_release(struct inode * inode, struct file * file)
233 kfree(list->hidraw); 237 kfree(list->hidraw);
234 } 238 }
235 } 239 }
236
237 kfree(list); 240 kfree(list);
241 ret = 0;
242unlock:
243 mutex_unlock(&minors_lock);
238 244
239 return 0; 245 return ret;
240} 246}
241 247
242static long hidraw_ioctl(struct file *file, unsigned int cmd, 248static long hidraw_ioctl(struct file *file, unsigned int cmd,
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 599041a7f67..7a778ac4c5c 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -810,6 +810,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co
810 if (usbhid->urbout) { 810 if (usbhid->urbout) {
811 int actual_length; 811 int actual_length;
812 int skipped_report_id = 0; 812 int skipped_report_id = 0;
813
813 if (buf[0] == 0x0) { 814 if (buf[0] == 0x0) {
814 /* Don't send the Report ID */ 815 /* Don't send the Report ID */
815 buf++; 816 buf++;
@@ -1469,9 +1470,6 @@ static int __init hid_init(void)
1469 retval = usbhid_quirks_init(quirks_param); 1470 retval = usbhid_quirks_init(quirks_param);
1470 if (retval) 1471 if (retval)
1471 goto usbhid_quirks_init_fail; 1472 goto usbhid_quirks_init_fail;
1472 retval = hiddev_init();
1473 if (retval)
1474 goto hiddev_init_fail;
1475 retval = usb_register(&hid_driver); 1473 retval = usb_register(&hid_driver);
1476 if (retval) 1474 if (retval)
1477 goto usb_register_fail; 1475 goto usb_register_fail;
@@ -1479,8 +1477,6 @@ static int __init hid_init(void)
1479 1477
1480 return 0; 1478 return 0;
1481usb_register_fail: 1479usb_register_fail:
1482 hiddev_exit();
1483hiddev_init_fail:
1484 usbhid_quirks_exit(); 1480 usbhid_quirks_exit();
1485usbhid_quirks_init_fail: 1481usbhid_quirks_init_fail:
1486 hid_unregister_driver(&hid_usb_driver); 1482 hid_unregister_driver(&hid_usb_driver);
@@ -1493,7 +1489,6 @@ no_queue:
1493static void __exit hid_exit(void) 1489static void __exit hid_exit(void)
1494{ 1490{
1495 usb_deregister(&hid_driver); 1491 usb_deregister(&hid_driver);
1496 hiddev_exit();
1497 usbhid_quirks_exit(); 1492 usbhid_quirks_exit();
1498 hid_unregister_driver(&hid_usb_driver); 1493 hid_unregister_driver(&hid_usb_driver);
1499 destroy_workqueue(resumption_waker); 1494 destroy_workqueue(resumption_waker);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index f0260c699ad..f90e937b577 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -63,6 +63,7 @@ static const struct hid_blacklist {
63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, 63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET },
64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, 64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET },
65 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, 65 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
66 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
66 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 67 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
67 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 68 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
68 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, 69 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index dfcb27613ec..fedd88df9a1 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -67,8 +67,6 @@ struct hiddev_list {
67 struct mutex thread_lock; 67 struct mutex thread_lock;
68}; 68};
69 69
70static struct usb_driver hiddev_driver;
71
72/* 70/*
73 * Find a report, given the report's type and ID. The ID can be specified 71 * Find a report, given the report's type and ID. The ID can be specified
74 * indirectly by REPORT_ID_FIRST (which returns the first report of the given 72 * indirectly by REPORT_ID_FIRST (which returns the first report of the given
@@ -926,41 +924,3 @@ void hiddev_disconnect(struct hid_device *hid)
926 kfree(hiddev); 924 kfree(hiddev);
927 } 925 }
928} 926}
929
930/* Currently this driver is a USB driver. It's not a conventional one in
931 * the sense that it doesn't probe at the USB level. Instead it waits to
932 * be connected by HID through the hiddev_connect / hiddev_disconnect
933 * routines. The reason to register as a USB device is to gain part of the
934 * minor number space from the USB major.
935 *
936 * In theory, should the HID code be generalized to more than one physical
937 * medium (say, IEEE 1384), this driver will probably need to register its
938 * own major number, and in doing so, no longer need to register with USB.
939 * At that point the probe routine and hiddev_driver struct below will no
940 * longer be useful.
941 */
942
943
944/* We never attach in this manner, and rely on HID to connect us. This
945 * is why there is no disconnect routine defined in the usb_driver either.
946 */
947static int hiddev_usbd_probe(struct usb_interface *intf,
948 const struct usb_device_id *hiddev_info)
949{
950 return -ENODEV;
951}
952
953static /* const */ struct usb_driver hiddev_driver = {
954 .name = "hiddev",
955 .probe = hiddev_usbd_probe,
956};
957
958int __init hiddev_init(void)
959{
960 return usb_register(&hiddev_driver);
961}
962
963void hiddev_exit(void)
964{
965 usb_deregister(&hiddev_driver);
966}