aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-12 06:39:21 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-12 06:39:21 -0500
commit708b8eae0fd532af73ea8350e6dcc10255ff7376 (patch)
treef336436934fd79bc91aff7112a9beb10bc4e839f /drivers/hid
parentd98d38f2014ab79f28c126ff175d034891f7aefc (diff)
parentf21f237cf55494c3a4209de323281a3b0528da10 (diff)
Merge branch 'linus' into core/locking
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-apple.c63
-rw-r--r--drivers/hid/hid-core.c45
-rw-r--r--drivers/hid/hid-dell.c1
-rw-r--r--drivers/hid/hid-gyration.c4
-rw-r--r--drivers/hid/hid-ids.h11
-rw-r--r--drivers/hid/hid-lg.c5
-rw-r--r--drivers/hid/hid-sony.c44
-rw-r--r--drivers/hid/hidraw.c3
-rw-r--r--drivers/hid/usbhid/hid-core.c63
-rw-r--r--drivers/hid/usbhid/hiddev.c5
-rw-r--r--drivers/hid/usbhid/usbhid.h2
12 files changed, 171 insertions, 77 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f5999a91614e..b4fd8ca701a4 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -247,7 +247,6 @@ config HID_SUNPLUS
247 247
248config THRUSTMASTER_FF 248config THRUSTMASTER_FF
249 tristate "ThrustMaster devices support" 249 tristate "ThrustMaster devices support"
250 default m
251 depends on USB_HID 250 depends on USB_HID
252 select INPUT_FF_MEMLESS 251 select INPUT_FF_MEMLESS
253 help 252 help
@@ -256,7 +255,6 @@ config THRUSTMASTER_FF
256 255
257config ZEROPLUS_FF 256config ZEROPLUS_FF
258 tristate "Zeroplus based game controller support" 257 tristate "Zeroplus based game controller support"
259 default m
260 depends on USB_HID 258 depends on USB_HID
261 select INPUT_FF_MEMLESS 259 select INPUT_FF_MEMLESS
262 help 260 help
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index fd7f896b34f7..c6ab4ba60c52 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -312,13 +312,6 @@ static int apple_probe(struct hid_device *hdev,
312 unsigned int connect_mask = HID_CONNECT_DEFAULT; 312 unsigned int connect_mask = HID_CONNECT_DEFAULT;
313 int ret; 313 int ret;
314 314
315 /* return something else or move to hid layer? device will reside
316 allocated */
317 if (id->bus == BUS_USB && (quirks & APPLE_IGNORE_MOUSE) &&
318 to_usb_interface(hdev->dev.parent)->cur_altsetting->
319 desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)
320 return -ENODEV;
321
322 asc = kzalloc(sizeof(*asc), GFP_KERNEL); 315 asc = kzalloc(sizeof(*asc), GFP_KERNEL);
323 if (asc == NULL) { 316 if (asc == NULL) {
324 dev_err(&hdev->dev, "can't alloc apple descriptor\n"); 317 dev_err(&hdev->dev, "can't alloc apple descriptor\n");
@@ -367,38 +360,32 @@ static const struct hid_device_id apple_devices[] = {
367 .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, 360 .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL },
368 361
369 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), 362 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI),
370 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 363 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
371 APPLE_IGNORE_MOUSE },
372 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), 364 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO),
373 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 365 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
374 APPLE_IGNORE_MOUSE },
375 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), 366 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI),
376 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 367 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
377 APPLE_IGNORE_MOUSE },
378 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), 368 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO),
379 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 369 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
380 APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, 370 APPLE_ISO_KEYBOARD },
381 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), 371 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS),
382 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 372 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
383 APPLE_IGNORE_MOUSE },
384 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), 373 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI),
385 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 374 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
386 APPLE_IGNORE_MOUSE },
387 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), 375 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO),
388 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 376 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
389 APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, 377 APPLE_ISO_KEYBOARD },
390 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), 378 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS),
391 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 379 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
392 APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, 380 APPLE_RDESC_JIS },
393 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), 381 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI),
394 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 382 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
395 APPLE_IGNORE_MOUSE },
396 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), 383 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO),
397 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 384 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
398 APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, 385 APPLE_ISO_KEYBOARD },
399 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), 386 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS),
400 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 387 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
401 APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS}, 388 APPLE_RDESC_JIS },
402 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), 389 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI),
403 .driver_data = APPLE_HAS_FN }, 390 .driver_data = APPLE_HAS_FN },
404 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), 391 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO),
@@ -406,14 +393,12 @@ static const struct hid_device_id apple_devices[] = {
406 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), 393 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS),
407 .driver_data = APPLE_HAS_FN }, 394 .driver_data = APPLE_HAS_FN },
408 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), 395 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI),
409 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 396 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
410 APPLE_IGNORE_MOUSE },
411 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), 397 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO),
412 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 398 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
413 APPLE_IGNORE_MOUSE },
414 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), 399 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS),
415 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 400 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
416 APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, 401 APPLE_RDESC_JIS },
417 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), 402 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
418 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 403 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
419 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), 404 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
@@ -422,25 +407,21 @@ static const struct hid_device_id apple_devices[] = {
422 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), 407 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
423 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 408 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
424 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), 409 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
425 .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, 410 .driver_data = APPLE_HAS_FN },
426 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), 411 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
427 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | 412 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
428 APPLE_IGNORE_MOUSE },
429 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), 413 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS),
430 .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, 414 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
431 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), 415 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
432 .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, 416 .driver_data = APPLE_HAS_FN },
433 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), 417 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
434 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | 418 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
435 APPLE_IGNORE_MOUSE },
436 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), 419 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
437 .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, 420 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
438 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), 421 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
439 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 422 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
440 APPLE_IGNORE_MOUSE },
441 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), 423 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
442 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 424 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
443 APPLE_IGNORE_MOUSE },
444 425
445 /* Apple wireless Mighty Mouse */ 426 /* Apple wireless Mighty Mouse */
446 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), 427 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 721a36d97582..d3671b4049c0 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1263,7 +1263,10 @@ static const struct hid_device_id hid_blacklist[] = {
1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
1269 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1270 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 1271 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
1269 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 1272 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
@@ -1275,8 +1278,6 @@ static const struct hid_device_id hid_blacklist[] = {
1275 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, 1278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) },
1276 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, 1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, 1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3) },
1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150) },
1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, 1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },
1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, 1282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) },
1282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, 1283 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
@@ -1295,6 +1296,7 @@ static const struct hid_device_id hid_blacklist[] = {
1295 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1299 1301
1300 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1302 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
@@ -1406,6 +1408,7 @@ static const struct hid_device_id hid_ignore_list[] = {
1406 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, 1408 { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) },
1407 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, 1409 { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
1408 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, 1410 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
1411 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
1409 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 1412 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
1410 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 1413 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
1411 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 1414 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
@@ -1541,6 +1544,40 @@ static const struct hid_device_id hid_ignore_list[] = {
1541 { } 1544 { }
1542}; 1545};
1543 1546
1547/**
1548 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
1549 *
1550 * There are composite devices for which we want to ignore only a certain
1551 * interface. This is a list of devices for which only the mouse interface will
1552 * be ignored. This allows a dedicated driver to take care of the interface.
1553 */
1554static const struct hid_device_id hid_mouse_ignore_list[] = {
1555 /* appletouch driver */
1556 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
1557 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
1558 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
1559 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) },
1560 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) },
1561 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) },
1562 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) },
1563 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) },
1564 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) },
1565 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) },
1566 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) },
1567 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) },
1568 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) },
1569 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) },
1570 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) },
1571 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) },
1572 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) },
1573 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
1574 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
1575 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
1576 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1577 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1578 { }
1579};
1580
1544static bool hid_ignore(struct hid_device *hdev) 1581static bool hid_ignore(struct hid_device *hdev)
1545{ 1582{
1546 switch (hdev->vendor) { 1583 switch (hdev->vendor) {
@@ -1557,6 +1594,10 @@ static bool hid_ignore(struct hid_device *hdev)
1557 break; 1594 break;
1558 } 1595 }
1559 1596
1597 if (hdev->type == HID_TYPE_USBMOUSE &&
1598 hid_match_id(hdev, hid_mouse_ignore_list))
1599 return true;
1600
1560 return !!hid_match_id(hdev, hid_ignore_list); 1601 return !!hid_match_id(hdev, hid_ignore_list);
1561} 1602}
1562 1603
diff --git a/drivers/hid/hid-dell.c b/drivers/hid/hid-dell.c
index 1a0d0dfc62fc..f5474300b83a 100644
--- a/drivers/hid/hid-dell.c
+++ b/drivers/hid/hid-dell.c
@@ -48,6 +48,7 @@ err_free:
48static const struct hid_device_id dell_devices[] = { 48static const struct hid_device_id dell_devices[] = {
49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
51 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
51 { } 52 { }
52}; 53};
53MODULE_DEVICE_TABLE(hid, dell_devices); 54MODULE_DEVICE_TABLE(hid, dell_devices);
diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c
index ac5120f542cc..04a0afec52ac 100644
--- a/drivers/hid/hid-gyration.c
+++ b/drivers/hid/hid-gyration.c
@@ -4,9 +4,9 @@
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 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 7 * Copyright (c) 2007 Paul Walmsley
9 * Copyright (c) 2008 Jiri Slaby 8 * Copyright (c) 2008 Jiri Slaby
9 * Copyright (c) 2006-2008 Jiri Kosina
10 */ 10 */
11 11
12/* 12/*
@@ -40,6 +40,7 @@ static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi,
40 case 0x025: gy_map_key_clear(KEY_PVR); break; 40 case 0x025: gy_map_key_clear(KEY_PVR); break;
41 case 0x046: gy_map_key_clear(KEY_MEDIA); break; 41 case 0x046: gy_map_key_clear(KEY_MEDIA); break;
42 case 0x047: gy_map_key_clear(KEY_MP3); break; 42 case 0x047: gy_map_key_clear(KEY_MP3); break;
43 case 0x048: gy_map_key_clear(KEY_MEDIA); break;
43 case 0x049: gy_map_key_clear(KEY_CAMERA); break; 44 case 0x049: gy_map_key_clear(KEY_CAMERA); break;
44 case 0x04a: gy_map_key_clear(KEY_VIDEO); break; 45 case 0x04a: gy_map_key_clear(KEY_VIDEO); break;
45 46
@@ -68,6 +69,7 @@ static int gyration_event(struct hid_device *hdev, struct hid_field *field,
68 69
69static const struct hid_device_id gyration_devices[] = { 70static const struct hid_device_id gyration_devices[] = {
70 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 71 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
72 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
71 { } 73 { }
72}; 74};
73MODULE_DEVICE_TABLE(hid, gyration_devices); 75MODULE_DEVICE_TABLE(hid, gyration_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index d9a1ba920c23..f05bcbbbb0d5 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -89,6 +89,7 @@
89 89
90#define USB_VENDOR_ID_ASUS 0x0b05 90#define USB_VENDOR_ID_ASUS 0x0b05
91#define USB_DEVICE_ID_ASUS_LCM 0x1726 91#define USB_DEVICE_ID_ASUS_LCM 0x1726
92#define USB_DEVICE_ID_ASUS_LCM2 0x175b
92 93
93#define USB_VENDOR_ID_ATEN 0x0557 94#define USB_VENDOR_ID_ATEN 0x0557
94#define USB_DEVICE_ID_ATEN_UC100KM 0x2004 95#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
@@ -162,6 +163,9 @@
162 163
163#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
164 165
166#define USB_VENDOR_ID_GENERIC_13BA 0x13ba
167#define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017
168
165#define USB_VENDOR_ID_GLAB 0x06c2 169#define USB_VENDOR_ID_GLAB 0x06c2
166#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 170#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
167#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 171#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
@@ -236,6 +240,7 @@
236 240
237#define USB_VENDOR_ID_GYRATION 0x0c16 241#define USB_VENDOR_ID_GYRATION 0x0c16
238#define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 242#define USB_DEVICE_ID_GYRATION_REMOTE 0x0002
243#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003
239 244
240#define USB_VENDOR_ID_HAPP 0x078b 245#define USB_VENDOR_ID_HAPP 0x078b
241#define USB_DEVICE_ID_UGCI_DRIVING 0x0010 246#define USB_DEVICE_ID_UGCI_DRIVING 0x0010
@@ -248,6 +253,9 @@
248#define USB_VENDOR_ID_KBGEAR 0x084e 253#define USB_VENDOR_ID_KBGEAR 0x084e
249#define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 254#define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001
250 255
256#define USB_VENDOR_ID_KWORLD 0x1b80
257#define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700
258
251#define USB_VENDOR_ID_LABTEC 0x1020 259#define USB_VENDOR_ID_LABTEC 0x1020
252#define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 260#define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006
253 261
@@ -268,8 +276,6 @@
268#define USB_DEVICE_ID_LD_MACHINETEST 0x2040 276#define USB_DEVICE_ID_LD_MACHINETEST 0x2040
269 277
270#define USB_VENDOR_ID_LOGITECH 0x046d 278#define USB_VENDOR_ID_LOGITECH 0x046d
271#define USB_DEVICE_ID_LOGITECH_LX3 0xc044
272#define USB_DEVICE_ID_LOGITECH_V150 0xc047
273#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 279#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
274#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 280#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
275#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f 281#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
@@ -350,6 +356,7 @@
350#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 356#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
351 357
352#define USB_VENDOR_ID_SONY 0x054c 358#define USB_VENDOR_ID_SONY 0x054c
359#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
353#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 360#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
354 361
355#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 362#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 406d8c82abf1..2bae340eafe2 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -287,11 +287,6 @@ static const struct hid_device_id lg_devices[] = {
287 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), 287 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500),
288 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, 288 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
289 289
290 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3),
291 .driver_data = LG_INVERT_HWHEEL },
292 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150),
293 .driver_data = LG_INVERT_HWHEEL },
294
295 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), 290 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D),
296 .driver_data = LG_NOGET }, 291 .driver_data = LG_NOGET },
297 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), 292 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL),
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 3af8095a7de1..86e563b8d644 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -4,9 +4,9 @@
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 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 7 * Copyright (c) 2007 Paul Walmsley
9 * Copyright (c) 2008 Jiri Slaby 8 * Copyright (c) 2008 Jiri Slaby
9 * Copyright (c) 2006-2008 Jiri Kosina
10 */ 10 */
11 11
12/* 12/*
@@ -23,6 +23,26 @@
23 23
24#include "hid-ids.h" 24#include "hid-ids.h"
25 25
26#define VAIO_RDESC_CONSTANT 0x0001
27
28struct sony_sc {
29 unsigned long quirks;
30};
31
32/* Sony Vaio VGX has wrongly mouse pointer declared as constant */
33static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
34 unsigned int rsize)
35{
36 struct sony_sc *sc = hid_get_drvdata(hdev);
37
38 if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
39 rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
40 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report "
41 "descriptor\n");
42 rdesc[55] = 0x06;
43 }
44}
45
26/* 46/*
27 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller 47 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
28 * to "operational". Without this, the ps3 controller will not report any 48 * to "operational". Without this, the ps3 controller will not report any
@@ -56,6 +76,17 @@ static int sony_set_operational(struct hid_device *hdev)
56static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) 76static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
57{ 77{
58 int ret; 78 int ret;
79 unsigned long quirks = id->driver_data;
80 struct sony_sc *sc;
81
82 sc = kzalloc(sizeof(*sc), GFP_KERNEL);
83 if (sc == NULL) {
84 dev_err(&hdev->dev, "can't alloc apple descriptor\n");
85 return -ENOMEM;
86 }
87
88 sc->quirks = quirks;
89 hid_set_drvdata(hdev, sc);
59 90
60 ret = hid_parse(hdev); 91 ret = hid_parse(hdev);
61 if (ret) { 92 if (ret) {
@@ -78,11 +109,20 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
78err_stop: 109err_stop:
79 hid_hw_stop(hdev); 110 hid_hw_stop(hdev);
80err_free: 111err_free:
112 kfree(sc);
81 return ret; 113 return ret;
82} 114}
83 115
116static void sony_remove(struct hid_device *hdev)
117{
118 hid_hw_stop(hdev);
119 kfree(hid_get_drvdata(hdev));
120}
121
84static const struct hid_device_id sony_devices[] = { 122static const struct hid_device_id sony_devices[] = {
85 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 123 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
124 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
125 .driver_data = VAIO_RDESC_CONSTANT },
86 { } 126 { }
87}; 127};
88MODULE_DEVICE_TABLE(hid, sony_devices); 128MODULE_DEVICE_TABLE(hid, sony_devices);
@@ -91,6 +131,8 @@ static struct hid_driver sony_driver = {
91 .name = "sony", 131 .name = "sony",
92 .id_table = sony_devices, 132 .id_table = sony_devices,
93 .probe = sony_probe, 133 .probe = sony_probe,
134 .remove = sony_remove,
135 .report_fixup = sony_report_fixup,
94}; 136};
95 137
96static int sony_init(void) 138static int sony_init(void)
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index af3edb98df43..894d52e05bf9 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -264,6 +264,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
264 default: 264 default:
265 ret = -ENOTTY; 265 ret = -ENOTTY;
266 } 266 }
267 unlock_kernel();
267 return ret; 268 return ret;
268} 269}
269 270
@@ -403,7 +404,7 @@ out:
403 return result; 404 return result;
404} 405}
405 406
406void __exit hidraw_exit(void) 407void hidraw_exit(void)
407{ 408{
408 dev_t dev_id = MKDEV(hidraw_major, 0); 409 dev_t dev_id = MKDEV(hidraw_major, 0);
409 410
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 705a43cdeea4..18e5ddd722cd 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/mutex.h>
23#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
24#include <linux/spinlock.h> 25#include <linux/spinlock.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
@@ -776,21 +777,10 @@ static int usbhid_start(struct hid_device *hid)
776 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 777 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
777 struct usb_host_interface *interface = intf->cur_altsetting; 778 struct usb_host_interface *interface = intf->cur_altsetting;
778 struct usb_device *dev = interface_to_usbdev(intf); 779 struct usb_device *dev = interface_to_usbdev(intf);
779 struct usbhid_device *usbhid; 780 struct usbhid_device *usbhid = hid->driver_data;
780 unsigned int n, insize = 0; 781 unsigned int n, insize = 0;
781 int ret; 782 int ret;
782 783
783 WARN_ON(hid->driver_data);
784
785 usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL);
786 if (usbhid == NULL) {
787 ret = -ENOMEM;
788 goto err;
789 }
790
791 hid->driver_data = usbhid;
792 usbhid->hid = hid;
793
794 usbhid->bufsize = HID_MIN_BUFFER_SIZE; 784 usbhid->bufsize = HID_MIN_BUFFER_SIZE;
795 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize); 785 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize);
796 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize); 786 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize);
@@ -804,6 +794,7 @@ static int usbhid_start(struct hid_device *hid)
804 if (insize > HID_MAX_BUFFER_SIZE) 794 if (insize > HID_MAX_BUFFER_SIZE)
805 insize = HID_MAX_BUFFER_SIZE; 795 insize = HID_MAX_BUFFER_SIZE;
806 796
797 mutex_lock(&usbhid->setup);
807 if (hid_alloc_buffers(dev, hid)) { 798 if (hid_alloc_buffers(dev, hid)) {
808 ret = -ENOMEM; 799 ret = -ENOMEM;
809 goto fail; 800 goto fail;
@@ -888,6 +879,9 @@ static int usbhid_start(struct hid_device *hid)
888 usbhid_init_reports(hid); 879 usbhid_init_reports(hid);
889 hid_dump_device(hid); 880 hid_dump_device(hid);
890 881
882 set_bit(HID_STARTED, &usbhid->iofl);
883 mutex_unlock(&usbhid->setup);
884
891 return 0; 885 return 0;
892 886
893fail: 887fail:
@@ -895,8 +889,7 @@ fail:
895 usb_free_urb(usbhid->urbout); 889 usb_free_urb(usbhid->urbout);
896 usb_free_urb(usbhid->urbctrl); 890 usb_free_urb(usbhid->urbctrl);
897 hid_free_buffers(dev, hid); 891 hid_free_buffers(dev, hid);
898 kfree(usbhid); 892 mutex_unlock(&usbhid->setup);
899err:
900 return ret; 893 return ret;
901} 894}
902 895
@@ -907,6 +900,8 @@ static void usbhid_stop(struct hid_device *hid)
907 if (WARN_ON(!usbhid)) 900 if (WARN_ON(!usbhid))
908 return; 901 return;
909 902
903 mutex_lock(&usbhid->setup);
904 clear_bit(HID_STARTED, &usbhid->iofl);
910 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 905 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
911 set_bit(HID_DISCONNECTED, &usbhid->iofl); 906 set_bit(HID_DISCONNECTED, &usbhid->iofl);
912 spin_unlock_irq(&usbhid->inlock); 907 spin_unlock_irq(&usbhid->inlock);
@@ -931,8 +926,7 @@ static void usbhid_stop(struct hid_device *hid)
931 usb_free_urb(usbhid->urbout); 926 usb_free_urb(usbhid->urbout);
932 927
933 hid_free_buffers(hid_to_usb_dev(hid), hid); 928 hid_free_buffers(hid_to_usb_dev(hid), hid);
934 kfree(usbhid); 929 mutex_unlock(&usbhid->setup);
935 hid->driver_data = NULL;
936} 930}
937 931
938static struct hid_ll_driver usb_hid_driver = { 932static struct hid_ll_driver usb_hid_driver = {
@@ -947,6 +941,7 @@ static struct hid_ll_driver usb_hid_driver = {
947static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 941static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
948{ 942{
949 struct usb_device *dev = interface_to_usbdev(intf); 943 struct usb_device *dev = interface_to_usbdev(intf);
944 struct usbhid_device *usbhid;
950 struct hid_device *hid; 945 struct hid_device *hid;
951 size_t len; 946 size_t len;
952 int ret; 947 int ret;
@@ -972,6 +967,9 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
972 hid->vendor = le16_to_cpu(dev->descriptor.idVendor); 967 hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
973 hid->product = le16_to_cpu(dev->descriptor.idProduct); 968 hid->product = le16_to_cpu(dev->descriptor.idProduct);
974 hid->name[0] = 0; 969 hid->name[0] = 0;
970 if (intf->cur_altsetting->desc.bInterfaceProtocol ==
971 USB_INTERFACE_PROTOCOL_MOUSE)
972 hid->type = HID_TYPE_USBMOUSE;
975 973
976 if (dev->manufacturer) 974 if (dev->manufacturer)
977 strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); 975 strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));
@@ -997,14 +995,26 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
997 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) 995 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0)
998 hid->uniq[0] = 0; 996 hid->uniq[0] = 0;
999 997
998 usbhid = kzalloc(sizeof(*usbhid), GFP_KERNEL);
999 if (usbhid == NULL) {
1000 ret = -ENOMEM;
1001 goto err;
1002 }
1003
1004 hid->driver_data = usbhid;
1005 usbhid->hid = hid;
1006 mutex_init(&usbhid->setup); /* needed on suspend/resume */
1007
1000 ret = hid_add_device(hid); 1008 ret = hid_add_device(hid);
1001 if (ret) { 1009 if (ret) {
1002 if (ret != -ENODEV) 1010 if (ret != -ENODEV)
1003 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1011 dev_err(&intf->dev, "can't add hid device: %d\n", ret);
1004 goto err; 1012 goto err_free;
1005 } 1013 }
1006 1014
1007 return 0; 1015 return 0;
1016err_free:
1017 kfree(usbhid);
1008err: 1018err:
1009 hid_destroy_device(hid); 1019 hid_destroy_device(hid);
1010 return ret; 1020 return ret;
@@ -1013,11 +1023,14 @@ err:
1013static void hid_disconnect(struct usb_interface *intf) 1023static void hid_disconnect(struct usb_interface *intf)
1014{ 1024{
1015 struct hid_device *hid = usb_get_intfdata(intf); 1025 struct hid_device *hid = usb_get_intfdata(intf);
1026 struct usbhid_device *usbhid;
1016 1027
1017 if (WARN_ON(!hid)) 1028 if (WARN_ON(!hid))
1018 return; 1029 return;
1019 1030
1031 usbhid = hid->driver_data;
1020 hid_destroy_device(hid); 1032 hid_destroy_device(hid);
1033 kfree(usbhid);
1021} 1034}
1022 1035
1023static int hid_suspend(struct usb_interface *intf, pm_message_t message) 1036static int hid_suspend(struct usb_interface *intf, pm_message_t message)
@@ -1025,11 +1038,18 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1025 struct hid_device *hid = usb_get_intfdata (intf); 1038 struct hid_device *hid = usb_get_intfdata (intf);
1026 struct usbhid_device *usbhid = hid->driver_data; 1039 struct usbhid_device *usbhid = hid->driver_data;
1027 1040
1041 mutex_lock(&usbhid->setup);
1042 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1043 mutex_unlock(&usbhid->setup);
1044 return 0;
1045 }
1046
1028 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 1047 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
1029 set_bit(HID_SUSPENDED, &usbhid->iofl); 1048 set_bit(HID_SUSPENDED, &usbhid->iofl);
1030 spin_unlock_irq(&usbhid->inlock); 1049 spin_unlock_irq(&usbhid->inlock);
1031 del_timer(&usbhid->io_retry); 1050 del_timer_sync(&usbhid->io_retry);
1032 usb_kill_urb(usbhid->urbin); 1051 usb_kill_urb(usbhid->urbin);
1052 mutex_unlock(&usbhid->setup);
1033 dev_dbg(&intf->dev, "suspend\n"); 1053 dev_dbg(&intf->dev, "suspend\n");
1034 return 0; 1054 return 0;
1035} 1055}
@@ -1040,9 +1060,16 @@ static int hid_resume(struct usb_interface *intf)
1040 struct usbhid_device *usbhid = hid->driver_data; 1060 struct usbhid_device *usbhid = hid->driver_data;
1041 int status; 1061 int status;
1042 1062
1063 mutex_lock(&usbhid->setup);
1064 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1065 mutex_unlock(&usbhid->setup);
1066 return 0;
1067 }
1068
1043 clear_bit(HID_SUSPENDED, &usbhid->iofl); 1069 clear_bit(HID_SUSPENDED, &usbhid->iofl);
1044 usbhid->retry_delay = 0; 1070 usbhid->retry_delay = 0;
1045 status = hid_start_in(hid); 1071 status = hid_start_in(hid);
1072 mutex_unlock(&usbhid->setup);
1046 dev_dbg(&intf->dev, "resume status %d\n", status); 1073 dev_dbg(&intf->dev, "resume status %d\n", status);
1047 return status; 1074 return status;
1048} 1075}
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index babd65dd46ad..83e851a5ed30 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -242,8 +242,6 @@ static int hiddev_release(struct inode * inode, struct file * file)
242 struct hiddev_list *list = file->private_data; 242 struct hiddev_list *list = file->private_data;
243 unsigned long flags; 243 unsigned long flags;
244 244
245 hiddev_fasync(-1, file, 0);
246
247 spin_lock_irqsave(&list->hiddev->list_lock, flags); 245 spin_lock_irqsave(&list->hiddev->list_lock, flags);
248 list_del(&list->node); 246 list_del(&list->node);
249 spin_unlock_irqrestore(&list->hiddev->list_lock, flags); 247 spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
@@ -436,8 +434,7 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
436 if (copy_to_user(user_arg, uref, sizeof(*uref))) 434 if (copy_to_user(user_arg, uref, sizeof(*uref)))
437 goto fault; 435 goto fault;
438 436
439 kfree(uref_multi); 437 goto goodreturn;
440 return 0;
441 438
442 default: 439 default:
443 if (cmd != HIDIOCGUSAGE && 440 if (cmd != HIDIOCGUSAGE &&
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index abedb13c623e..55973ff54008 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/mutex.h>
30#include <linux/timer.h> 31#include <linux/timer.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <linux/workqueue.h> 33#include <linux/workqueue.h>
@@ -73,6 +74,7 @@ struct usbhid_device {
73 dma_addr_t outbuf_dma; /* Output buffer dma */ 74 dma_addr_t outbuf_dma; /* Output buffer dma */
74 spinlock_t outlock; /* Output fifo spinlock */ 75 spinlock_t outlock; /* Output fifo spinlock */
75 76
77 struct mutex setup;
76 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
77 struct timer_list io_retry; /* Retry timer */ 79 struct timer_list io_retry; /* Retry timer */
78 unsigned long stop_retry; /* Time to give up, in jiffies */ 80 unsigned long stop_retry; /* Time to give up, in jiffies */