aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig13
-rw-r--r--drivers/hid/hid-apple.c6
-rw-r--r--drivers/hid/hid-core.c17
-rw-r--r--drivers/hid/hid-debug.c2
-rw-r--r--drivers/hid/hid-ids.h13
-rw-r--r--drivers/hid/hid-input.c64
-rw-r--r--drivers/hid/hid-lg.c2
-rw-r--r--drivers/hid/hid-lgff.c5
-rw-r--r--drivers/hid/hid-magicmouse.c14
-rw-r--r--drivers/hid/hid-ortek.c16
-rw-r--r--drivers/hid/hid-picolcd.c9
-rw-r--r--drivers/hid/hid-roccat-kone.h2
-rw-r--r--drivers/hid/hid-roccat-koneplus.c82
-rw-r--r--drivers/hid/hid-roccat-koneplus.h11
-rw-r--r--drivers/hid/hid-roccat-pyra.c3
-rw-r--r--drivers/hid/hid-sony.c2
-rw-r--r--drivers/hid/hidraw.c30
-rw-r--r--drivers/hid/usbhid/hid-quirks.c3
-rw-r--r--drivers/hid/usbhid/hiddev.c34
19 files changed, 217 insertions, 111 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index d588a5e28d0e..67d2a7585934 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -173,7 +173,7 @@ config HID_EZKEY
173 Support for Ezkey BTC 8193 keyboard. 173 Support for Ezkey BTC 8193 keyboard.
174 174
175config HID_KEYTOUCH 175config HID_KEYTOUCH
176 tristate "Keyoutch HID devices" 176 tristate "Keytouch HID devices"
177 depends on USB_HID 177 depends on USB_HID
178 ---help--- 178 ---help---
179 Support for Keytouch HID devices not fully compliant with 179 Support for Keytouch HID devices not fully compliant with
@@ -334,10 +334,17 @@ config HID_NTRIG
334 Support for N-Trig touch screen. 334 Support for N-Trig touch screen.
335 335
336config HID_ORTEK 336config HID_ORTEK
337 tristate "Ortek PKB-1700/WKB-2000 wireless keyboard and mouse trackpad" 337 tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
338 depends on USB_HID 338 depends on USB_HID
339 ---help--- 339 ---help---
340 Support for Ortek PKB-1700/WKB-2000 wireless keyboard + mouse trackpad. 340 There are certain devices which have LogicalMaximum wrong in the keyboard
341 usage page of their report descriptor. The most prevailing ones so far
342 are manufactured by Ortek, thus the name of the driver. Currently
343 supported devices by this driver are
344
345 - Ortek PKB-1700
346 - Ortek WKB-2000
347 - Skycable wireless presenter
341 348
342config HID_PANTHERLORD 349config HID_PANTHERLORD
343 tristate "Pantherlord/GreenAsia game controller" 350 tristate "Pantherlord/GreenAsia game controller"
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 61aa71233392..b85744fe8464 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -481,6 +481,12 @@ static const struct hid_device_id apple_devices[] = {
481 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 481 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
482 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), 482 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
483 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 483 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
484 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
485 .driver_data = APPLE_HAS_FN },
486 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
487 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
488 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
489 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
484 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 490 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
485 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 491 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
486 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 492 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9f15c9238fb2..4140fd271417 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -306,7 +306,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
306 case HID_GLOBAL_ITEM_TAG_PUSH: 306 case HID_GLOBAL_ITEM_TAG_PUSH:
307 307
308 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { 308 if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) {
309 dbg_hid("global enviroment stack overflow\n"); 309 dbg_hid("global environment stack overflow\n");
310 return -1; 310 return -1;
311 } 311 }
312 312
@@ -317,7 +317,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
317 case HID_GLOBAL_ITEM_TAG_POP: 317 case HID_GLOBAL_ITEM_TAG_POP:
318 318
319 if (!parser->global_stack_ptr) { 319 if (!parser->global_stack_ptr) {
320 dbg_hid("global enviroment stack underflow\n"); 320 dbg_hid("global environment stack underflow\n");
321 return -1; 321 return -1;
322 } 322 }
323 323
@@ -1045,6 +1045,9 @@ void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1045 1045
1046 rsize = ((report->size - 1) >> 3) + 1; 1046 rsize = ((report->size - 1) >> 3) + 1;
1047 1047
1048 if (rsize > HID_MAX_BUFFER_SIZE)
1049 rsize = HID_MAX_BUFFER_SIZE;
1050
1048 if (csize < rsize) { 1051 if (csize < rsize) {
1049 dbg_hid("report %d is too short, (%d < %d)\n", report->id, 1052 dbg_hid("report %d is too short, (%d < %d)\n", report->id,
1050 csize, rsize); 1053 csize, rsize);
@@ -1334,6 +1337,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
1334 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 1337 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1335 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 1338 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1336 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 1339 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1340 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
1341 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
1342 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1337 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1343 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1338 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1344 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1339 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1345 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1410,6 +1416,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1410 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, 1416 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
1411 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, 1417 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) },
1412 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, 1418 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
1419 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) },
1413 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, 1420 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) },
1414 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, 1421 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
1415 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, 1422 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) },
@@ -1453,9 +1460,12 @@ static const struct hid_device_id hid_have_special_driver[] = {
1453 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, 1460 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) },
1454 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, 1461 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) },
1455 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 1462 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
1463 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) },
1456 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1464 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1457 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, 1465 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
1466 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
1458 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1467 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1468 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
1459 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1469 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1460 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1470 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1461 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, 1471 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
@@ -1850,6 +1860,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1850 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 1860 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1851 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 1861 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1852 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 1862 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1863 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
1864 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
1865 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1853 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1866 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1854 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1867 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1855 { } 1868 { }
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 555382fc7417..bae48745bb42 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -341,7 +341,7 @@ static const struct hid_usage_entry hid_usage_table[] = {
341 { 0x85, 0x83, "DesignCapacity" }, 341 { 0x85, 0x83, "DesignCapacity" },
342 { 0x85, 0x85, "ManufacturerDate" }, 342 { 0x85, 0x85, "ManufacturerDate" },
343 { 0x85, 0x89, "iDeviceChemistry" }, 343 { 0x85, 0x89, "iDeviceChemistry" },
344 { 0x85, 0x8b, "Rechargable" }, 344 { 0x85, 0x8b, "Rechargeable" },
345 { 0x85, 0x8f, "iOEMInformation" }, 345 { 0x85, 0x8f, "iOEMInformation" },
346 { 0x85, 0x8d, "CapacityGranularity1" }, 346 { 0x85, 0x8d, "CapacityGranularity1" },
347 { 0x85, 0xd0, "ACPresent" }, 347 { 0x85, 0xd0, "ACPresent" },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b8299ef0f01c..e715c43aa013 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -106,6 +106,9 @@
106#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 106#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
107#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 107#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
108#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 108#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
109#define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245
110#define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246
111#define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247
109#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 112#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
110#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 113#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
111#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 114#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
@@ -150,6 +153,7 @@
150#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 153#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01
151 154
152#define USB_VENDOR_ID_CH 0x068e 155#define USB_VENDOR_ID_CH 0x068e
156#define USB_DEVICE_ID_CH_PRO_THROTTLE 0x00f1
153#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 157#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2
154#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4 158#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4
155#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 159#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051
@@ -407,6 +411,7 @@
407#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 411#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295
408#define USB_DEVICE_ID_LOGITECH_DFP_WHEEL 0xc298 412#define USB_DEVICE_ID_LOGITECH_DFP_WHEEL 0xc298
409#define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299 413#define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299
414#define USB_DEVICE_ID_LOGITECH_G27_WHEEL 0xc29b
410#define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c 415#define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c
411#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a 416#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
412#define USB_DEVICE_ID_S510_RECEIVER 0xc50c 417#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
@@ -540,9 +545,13 @@
540#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 545#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
541#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 546#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600
542 547
548#define USB_VENDOR_ID_SKYCABLE 0x1223
549#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
550
543#define USB_VENDOR_ID_SONY 0x054c 551#define USB_VENDOR_ID_SONY 0x054c
544#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b 552#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
545#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 553#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
554#define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f
546 555
547#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 556#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
548#define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034 557#define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034
@@ -563,6 +572,10 @@
563#define USB_VENDOR_ID_SUNPLUS 0x04fc 572#define USB_VENDOR_ID_SUNPLUS 0x04fc
564#define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 573#define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
565 574
575#define USB_VENDOR_ID_SYMBOL 0x05e0
576#define USB_DEVICE_ID_SYMBOL_SCANNER_1 0x0800
577#define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300
578
566#define USB_VENDOR_ID_THRUSTMASTER 0x044f 579#define USB_VENDOR_ID_THRUSTMASTER 0x044f
567 580
568#define USB_VENDOR_ID_TOPSEED 0x0766 581#define USB_VENDOR_ID_TOPSEED 0x0766
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index cd74203c8178..6559e2e3364e 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -44,11 +44,11 @@ static const unsigned char hid_keyboard[256] = {
44 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, 44 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190,
45 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113, 45 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113,
46 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, 46 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk,
47 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, 47 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk,
48 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, 48 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
49 unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk, 49 unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk,
50 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, 50 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
51 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, 51 unk,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk,unk,unk,unk,unk,
52 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, 52 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
53 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk 53 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk
54}; 54};
@@ -357,6 +357,18 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
357 case 0x1: map_key_clear(KEY_POWER); break; 357 case 0x1: map_key_clear(KEY_POWER); break;
358 case 0x2: map_key_clear(KEY_SLEEP); break; 358 case 0x2: map_key_clear(KEY_SLEEP); break;
359 case 0x3: map_key_clear(KEY_WAKEUP); break; 359 case 0x3: map_key_clear(KEY_WAKEUP); break;
360 case 0x4: map_key_clear(KEY_CONTEXT_MENU); break;
361 case 0x5: map_key_clear(KEY_MENU); break;
362 case 0x6: map_key_clear(KEY_PROG1); break;
363 case 0x7: map_key_clear(KEY_HELP); break;
364 case 0x8: map_key_clear(KEY_EXIT); break;
365 case 0x9: map_key_clear(KEY_SELECT); break;
366 case 0xa: map_key_clear(KEY_RIGHT); break;
367 case 0xb: map_key_clear(KEY_LEFT); break;
368 case 0xc: map_key_clear(KEY_UP); break;
369 case 0xd: map_key_clear(KEY_DOWN); break;
370 case 0xe: map_key_clear(KEY_POWER2); break;
371 case 0xf: map_key_clear(KEY_RESTART); break;
360 default: goto unknown; 372 default: goto unknown;
361 } 373 }
362 break; 374 break;
@@ -466,16 +478,39 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
466 } 478 }
467 break; 479 break;
468 480
469 case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */ 481 case HID_UP_CONSUMER: /* USB HUT v1.12, pages 75-84 */
470 switch (usage->hid & HID_USAGE) { 482 switch (usage->hid & HID_USAGE) {
471 case 0x000: goto ignore; 483 case 0x000: goto ignore;
484 case 0x030: map_key_clear(KEY_POWER); break;
485 case 0x031: map_key_clear(KEY_RESTART); break;
486 case 0x032: map_key_clear(KEY_SLEEP); break;
472 case 0x034: map_key_clear(KEY_SLEEP); break; 487 case 0x034: map_key_clear(KEY_SLEEP); break;
488 case 0x035: map_key_clear(KEY_KBDILLUMTOGGLE); break;
473 case 0x036: map_key_clear(BTN_MISC); break; 489 case 0x036: map_key_clear(BTN_MISC); break;
474 490
475 case 0x040: map_key_clear(KEY_MENU); break; 491 case 0x040: map_key_clear(KEY_MENU); break; /* Menu */
476 case 0x045: map_key_clear(KEY_RADIO); break; 492 case 0x041: map_key_clear(KEY_SELECT); break; /* Menu Pick */
477 493 case 0x042: map_key_clear(KEY_UP); break; /* Menu Up */
494 case 0x043: map_key_clear(KEY_DOWN); break; /* Menu Down */
495 case 0x044: map_key_clear(KEY_LEFT); break; /* Menu Left */
496 case 0x045: map_key_clear(KEY_RIGHT); break; /* Menu Right */
497 case 0x046: map_key_clear(KEY_ESC); break; /* Menu Escape */
498 case 0x047: map_key_clear(KEY_KPPLUS); break; /* Menu Value Increase */
499 case 0x048: map_key_clear(KEY_KPMINUS); break; /* Menu Value Decrease */
500
501 case 0x060: map_key_clear(KEY_INFO); break; /* Data On Screen */
502 case 0x061: map_key_clear(KEY_SUBTITLE); break; /* Closed Caption */
503 case 0x063: map_key_clear(KEY_VCR); break; /* VCR/TV */
504 case 0x065: map_key_clear(KEY_CAMERA); break; /* Snapshot */
505 case 0x069: map_key_clear(KEY_RED); break;
506 case 0x06a: map_key_clear(KEY_GREEN); break;
507 case 0x06b: map_key_clear(KEY_BLUE); break;
508 case 0x06c: map_key_clear(KEY_YELLOW); break;
509 case 0x06d: map_key_clear(KEY_ZOOM); break;
510
511 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break;
478 case 0x083: map_key_clear(KEY_LAST); break; 512 case 0x083: map_key_clear(KEY_LAST); break;
513 case 0x084: map_key_clear(KEY_ENTER); break;
479 case 0x088: map_key_clear(KEY_PC); break; 514 case 0x088: map_key_clear(KEY_PC); break;
480 case 0x089: map_key_clear(KEY_TV); break; 515 case 0x089: map_key_clear(KEY_TV); break;
481 case 0x08a: map_key_clear(KEY_WWW); break; 516 case 0x08a: map_key_clear(KEY_WWW); break;
@@ -509,6 +544,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
509 case 0x0b7: map_key_clear(KEY_STOPCD); break; 544 case 0x0b7: map_key_clear(KEY_STOPCD); break;
510 case 0x0b8: map_key_clear(KEY_EJECTCD); break; 545 case 0x0b8: map_key_clear(KEY_EJECTCD); break;
511 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; 546 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break;
547 case 0x0b9: map_key_clear(KEY_SHUFFLE); break;
548 case 0x0bf: map_key_clear(KEY_SLOW); break;
512 549
513 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; 550 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
514 case 0x0e0: map_abs_clear(ABS_VOLUME); break; 551 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
@@ -516,6 +553,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
516 case 0x0e5: map_key_clear(KEY_BASSBOOST); break; 553 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
517 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; 554 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
518 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; 555 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
556 case 0x0f5: map_key_clear(KEY_SLOW); break;
519 557
520 case 0x182: map_key_clear(KEY_BOOKMARKS); break; 558 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
521 case 0x183: map_key_clear(KEY_CONFIG); break; 559 case 0x183: map_key_clear(KEY_CONFIG); break;
@@ -532,6 +570,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
532 case 0x18e: map_key_clear(KEY_CALENDAR); break; 570 case 0x18e: map_key_clear(KEY_CALENDAR); break;
533 case 0x191: map_key_clear(KEY_FINANCE); break; 571 case 0x191: map_key_clear(KEY_FINANCE); break;
534 case 0x192: map_key_clear(KEY_CALC); break; 572 case 0x192: map_key_clear(KEY_CALC); break;
573 case 0x193: map_key_clear(KEY_PLAYER); break;
535 case 0x194: map_key_clear(KEY_FILE); break; 574 case 0x194: map_key_clear(KEY_FILE); break;
536 case 0x196: map_key_clear(KEY_WWW); break; 575 case 0x196: map_key_clear(KEY_WWW); break;
537 case 0x199: map_key_clear(KEY_CHAT); break; 576 case 0x199: map_key_clear(KEY_CHAT); break;
@@ -540,8 +579,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
540 case 0x1a6: map_key_clear(KEY_HELP); break; 579 case 0x1a6: map_key_clear(KEY_HELP); break;
541 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; 580 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
542 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; 581 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
543 case 0x1b6: map_key_clear(KEY_MEDIA); break; 582 case 0x1ae: map_key_clear(KEY_KEYBOARD); break;
544 case 0x1b7: map_key_clear(KEY_SOUND); break; 583 case 0x1b6: map_key_clear(KEY_IMAGES); break;
584 case 0x1b7: map_key_clear(KEY_AUDIO); break;
585 case 0x1b8: map_key_clear(KEY_VIDEO); break;
545 case 0x1bc: map_key_clear(KEY_MESSENGER); break; 586 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
546 case 0x1bd: map_key_clear(KEY_INFO); break; 587 case 0x1bd: map_key_clear(KEY_INFO); break;
547 case 0x201: map_key_clear(KEY_NEW); break; 588 case 0x201: map_key_clear(KEY_NEW); break;
@@ -570,7 +611,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
570 case 0x233: map_key_clear(KEY_SCROLLUP); break; 611 case 0x233: map_key_clear(KEY_SCROLLUP); break;
571 case 0x234: map_key_clear(KEY_SCROLLDOWN); break; 612 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
572 case 0x238: map_rel(REL_HWHEEL); break; 613 case 0x238: map_rel(REL_HWHEEL); break;
614 case 0x23d: map_key_clear(KEY_EDIT); break;
573 case 0x25f: map_key_clear(KEY_CANCEL); break; 615 case 0x25f: map_key_clear(KEY_CANCEL); break;
616 case 0x269: map_key_clear(KEY_INSERT); break;
617 case 0x26a: map_key_clear(KEY_DELETE); break;
574 case 0x279: map_key_clear(KEY_REDO); break; 618 case 0x279: map_key_clear(KEY_REDO); break;
575 619
576 case 0x289: map_key_clear(KEY_REPLY); break; 620 case 0x289: map_key_clear(KEY_REPLY); break;
@@ -900,8 +944,8 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
900 hid->ll_driver->hidinput_input_event; 944 hid->ll_driver->hidinput_input_event;
901 input_dev->open = hidinput_open; 945 input_dev->open = hidinput_open;
902 input_dev->close = hidinput_close; 946 input_dev->close = hidinput_close;
903 input_dev->setkeycode_new = hidinput_setkeycode; 947 input_dev->setkeycode = hidinput_setkeycode;
904 input_dev->getkeycode_new = hidinput_getkeycode; 948 input_dev->getkeycode = hidinput_getkeycode;
905 949
906 input_dev->name = hid->name; 950 input_dev->name = hid->name;
907 input_dev->phys = hid->phys; 951 input_dev->phys = hid->phys;
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 3da90402ee81..21f205f09250 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -377,6 +377,8 @@ static const struct hid_device_id lg_devices[] = {
377 .driver_data = LG_FF }, 377 .driver_data = LG_FF },
378 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), 378 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL),
379 .driver_data = LG_FF }, 379 .driver_data = LG_FF },
380 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
381 .driver_data = LG_FF },
380 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL), 382 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
381 .driver_data = LG_FF }, 383 .driver_data = LG_FF },
382 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), 384 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c
index 90d0ef2c92be..088f85049290 100644
--- a/drivers/hid/hid-lgff.c
+++ b/drivers/hid/hid-lgff.c
@@ -72,7 +72,12 @@ static const struct dev_type devices[] = {
72 { 0x046d, 0xc287, ff_joystick_ac }, 72 { 0x046d, 0xc287, ff_joystick_ac },
73 { 0x046d, 0xc293, ff_joystick }, 73 { 0x046d, 0xc293, ff_joystick },
74 { 0x046d, 0xc294, ff_wheel }, 74 { 0x046d, 0xc294, ff_wheel },
75 { 0x046d, 0xc298, ff_wheel },
76 { 0x046d, 0xc299, ff_wheel },
77 { 0x046d, 0xc29b, ff_wheel },
75 { 0x046d, 0xc295, ff_joystick }, 78 { 0x046d, 0xc295, ff_joystick },
79 { 0x046d, 0xc298, ff_wheel },
80 { 0x046d, 0xc299, ff_wheel },
76 { 0x046d, 0xca03, ff_wheel }, 81 { 0x046d, 0xca03, ff_wheel },
77}; 82};
78 83
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 318cc40df92d..a5eda4c8127a 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -76,7 +76,7 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
76 * This is true when single_touch_id is equal to NO_TOUCHES. If multiple touches 76 * This is true when single_touch_id is equal to NO_TOUCHES. If multiple touches
77 * are down and the touch providing for single touch emulation is lifted, 77 * are down and the touch providing for single touch emulation is lifted,
78 * single_touch_id is equal to SINGLE_TOUCH_UP. While single touch emulation is 78 * single_touch_id is equal to SINGLE_TOUCH_UP. While single touch emulation is
79 * occuring, single_touch_id corresponds with the tracking id of the touch used. 79 * occurring, single_touch_id corresponds with the tracking id of the touch used.
80 */ 80 */
81#define NO_TOUCHES -1 81#define NO_TOUCHES -1
82#define SINGLE_TOUCH_UP -2 82#define SINGLE_TOUCH_UP -2
@@ -418,6 +418,8 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
418 input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, 418 input_set_abs_params(input, ABS_MT_POSITION_Y, -2456,
419 2565, 4, 0); 419 2565, 4, 0);
420 } 420 }
421
422 input_set_events_per_packet(input, 60);
421 } 423 }
422 424
423 if (report_undeciphered) { 425 if (report_undeciphered) {
@@ -499,9 +501,17 @@ static int magicmouse_probe(struct hid_device *hdev,
499 } 501 }
500 report->size = 6; 502 report->size = 6;
501 503
504 /*
505 * The device reponds with 'invalid report id' when feature
506 * report switching it into multitouch mode is sent to it.
507 *
508 * This results in -EIO from the _raw low-level transport callback,
509 * but there seems to be no other way of switching the mode.
510 * Thus the super-ugly hacky success check below.
511 */
502 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), 512 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
503 HID_FEATURE_REPORT); 513 HID_FEATURE_REPORT);
504 if (ret != sizeof(feature)) { 514 if (ret != -EIO) {
505 hid_err(hdev, "unable to request touch data (%d)\n", ret); 515 hid_err(hdev, "unable to request touch data (%d)\n", ret);
506 goto err_stop_hw; 516 goto err_stop_hw;
507 } 517 }
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index f9b7dd4f607f..0ffa1d2d64f0 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -1,8 +1,14 @@
1/* 1/*
2 * HID driver for Ortek PKB-1700/WKB-2000 (wireless keyboard + mouse trackpad). 2 * HID driver for various devices which are apparently based on the same chipset
3 * Fixes LogicalMaximum error in HID report description. 3 * from certain vendor which produces chips that contain wrong LogicalMaximum
4 * value in their HID report descriptor. Currently supported devices are:
5 *
6 * Ortek PKB-1700
7 * Ortek WKB-2000
8 * Skycable wireless presenter
4 * 9 *
5 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> 10 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
11 * Copyright (c) 2011 Jiri Kosina
6 */ 12 */
7 13
8/* 14/*
@@ -22,8 +28,11 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
22 unsigned int *rsize) 28 unsigned int *rsize)
23{ 29{
24 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 30 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
25 hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n"); 31 hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n");
26 rdesc[55] = 0x92; 32 rdesc[55] = 0x92;
33 } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
34 hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n");
35 rdesc[53] = 0x65;
27 } 36 }
28 return rdesc; 37 return rdesc;
29} 38}
@@ -31,6 +40,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
31static const struct hid_device_id ortek_devices[] = { 40static const struct hid_device_id ortek_devices[] = {
32 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 41 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
33 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 42 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
43 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
34 { } 44 { }
35}; 45};
36MODULE_DEVICE_TABLE(hid, ortek_devices); 46MODULE_DEVICE_TABLE(hid, ortek_devices);
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index de9cf21b3494..9d8710f8bc79 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -944,6 +944,7 @@ static int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *
944 } 944 }
945 945
946 memset(&props, 0, sizeof(props)); 946 memset(&props, 0, sizeof(props));
947 props.type = BACKLIGHT_RAW;
947 props.max_brightness = 0xff; 948 props.max_brightness = 0xff;
948 bdev = backlight_device_register(dev_name(dev), dev, data, 949 bdev = backlight_device_register(dev_name(dev), dev, data,
949 &picolcd_blops, &props); 950 &picolcd_blops, &props);
@@ -1584,11 +1585,11 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u,
1584 memset(raw_data, 0, sizeof(raw_data)); 1585 memset(raw_data, 0, sizeof(raw_data));
1585 raw_data[0] = *off & 0xff; 1586 raw_data[0] = *off & 0xff;
1586 raw_data[1] = (*off >> 8) & 0xff; 1587 raw_data[1] = (*off >> 8) & 0xff;
1587 raw_data[2] = s < 20 ? s : 20; 1588 raw_data[2] = min((size_t)20, s);
1588 if (*off + raw_data[2] > 0xff) 1589 if (*off + raw_data[2] > 0xff)
1589 raw_data[2] = 0x100 - *off; 1590 raw_data[2] = 0x100 - *off;
1590 1591
1591 if (copy_from_user(raw_data+3, u, raw_data[2])) 1592 if (copy_from_user(raw_data+3, u, min((u8)20, raw_data[2])))
1592 return -EFAULT; 1593 return -EFAULT;
1593 resp = picolcd_send_and_wait(data->hdev, REPORT_EE_WRITE, raw_data, 1594 resp = picolcd_send_and_wait(data->hdev, REPORT_EE_WRITE, raw_data,
1594 sizeof(raw_data)); 1595 sizeof(raw_data));
@@ -1805,13 +1806,13 @@ static ssize_t picolcd_debug_flash_write(struct file *f, const char __user *u,
1805/* 1806/*
1806 * Notes: 1807 * Notes:
1807 * - concurrent writing is prevented by mutex and all writes must be 1808 * - concurrent writing is prevented by mutex and all writes must be
1808 * n*64 bytes and 64-byte aligned, each write being preceeded by an 1809 * n*64 bytes and 64-byte aligned, each write being preceded by an
1809 * ERASE which erases a 64byte block. 1810 * ERASE which erases a 64byte block.
1810 * If less than requested was written or an error is returned for an 1811 * If less than requested was written or an error is returned for an
1811 * otherwise correct write request the next 64-byte block which should 1812 * otherwise correct write request the next 64-byte block which should
1812 * have been written is in undefined state (mostly: original, erased, 1813 * have been written is in undefined state (mostly: original, erased,
1813 * (half-)written with write error) 1814 * (half-)written with write error)
1814 * - reading can happend without special restriction 1815 * - reading can happen without special restriction
1815 */ 1816 */
1816static const struct file_operations picolcd_debug_flash_fops = { 1817static const struct file_operations picolcd_debug_flash_fops = {
1817 .owner = THIS_MODULE, 1818 .owner = THIS_MODULE,
diff --git a/drivers/hid/hid-roccat-kone.h b/drivers/hid/hid-roccat-kone.h
index 64abb5b8a59a..4109a028e138 100644
--- a/drivers/hid/hid-roccat-kone.h
+++ b/drivers/hid/hid-roccat-kone.h
@@ -166,7 +166,7 @@ enum kone_mouse_events {
166 /* osd events are thought to be display on screen */ 166 /* osd events are thought to be display on screen */
167 kone_mouse_event_osd_dpi = 0xa0, 167 kone_mouse_event_osd_dpi = 0xa0,
168 kone_mouse_event_osd_profile = 0xb0, 168 kone_mouse_event_osd_profile = 0xb0,
169 /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ 169 /* TODO clarify meaning and occurrence of kone_mouse_event_calibration */
170 kone_mouse_event_calibration = 0xc0, 170 kone_mouse_event_calibration = 0xc0,
171 kone_mouse_event_call_overlong_macro = 0xe0, 171 kone_mouse_event_call_overlong_macro = 0xe0,
172 /* switch events notify if user changed values with mousebutton click */ 172 /* switch events notify if user changed values with mousebutton click */
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 33eec74e0615..5b640a7a15a7 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -167,28 +167,28 @@ static int koneplus_set_profile_buttons(struct usb_device *usb_dev,
167} 167}
168 168
169/* retval is 0-4 on success, < 0 on error */ 169/* retval is 0-4 on success, < 0 on error */
170static int koneplus_get_startup_profile(struct usb_device *usb_dev) 170static int koneplus_get_actual_profile(struct usb_device *usb_dev)
171{ 171{
172 struct koneplus_startup_profile buf; 172 struct koneplus_actual_profile buf;
173 int retval; 173 int retval;
174 174
175 retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_STARTUP_PROFILE, 175 retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE,
176 &buf, sizeof(struct koneplus_startup_profile)); 176 &buf, sizeof(struct koneplus_actual_profile));
177 177
178 return retval ? retval : buf.startup_profile; 178 return retval ? retval : buf.actual_profile;
179} 179}
180 180
181static int koneplus_set_startup_profile(struct usb_device *usb_dev, 181static int koneplus_set_actual_profile(struct usb_device *usb_dev,
182 int startup_profile) 182 int new_profile)
183{ 183{
184 struct koneplus_startup_profile buf; 184 struct koneplus_actual_profile buf;
185 185
186 buf.command = KONEPLUS_COMMAND_STARTUP_PROFILE; 186 buf.command = KONEPLUS_COMMAND_ACTUAL_PROFILE;
187 buf.size = sizeof(struct koneplus_startup_profile); 187 buf.size = sizeof(struct koneplus_actual_profile);
188 buf.startup_profile = startup_profile; 188 buf.actual_profile = new_profile;
189 189
190 return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_STARTUP_PROFILE, 190 return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE,
191 &buf, sizeof(struct koneplus_profile_buttons)); 191 &buf, sizeof(struct koneplus_actual_profile));
192} 192}
193 193
194static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj, 194static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj,
@@ -398,21 +398,22 @@ static ssize_t koneplus_sysfs_write_profile_buttons(struct file *fp,
398 return sizeof(struct koneplus_profile_buttons); 398 return sizeof(struct koneplus_profile_buttons);
399} 399}
400 400
401static ssize_t koneplus_sysfs_show_startup_profile(struct device *dev, 401static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev,
402 struct device_attribute *attr, char *buf) 402 struct device_attribute *attr, char *buf)
403{ 403{
404 struct koneplus_device *koneplus = 404 struct koneplus_device *koneplus =
405 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 405 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
406 return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->startup_profile); 406 return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile);
407} 407}
408 408
409static ssize_t koneplus_sysfs_set_startup_profile(struct device *dev, 409static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev,
410 struct device_attribute *attr, char const *buf, size_t size) 410 struct device_attribute *attr, char const *buf, size_t size)
411{ 411{
412 struct koneplus_device *koneplus; 412 struct koneplus_device *koneplus;
413 struct usb_device *usb_dev; 413 struct usb_device *usb_dev;
414 unsigned long profile; 414 unsigned long profile;
415 int retval; 415 int retval;
416 struct koneplus_roccat_report roccat_report;
416 417
417 dev = dev->parent->parent; 418 dev = dev->parent->parent;
418 koneplus = hid_get_drvdata(dev_get_drvdata(dev)); 419 koneplus = hid_get_drvdata(dev_get_drvdata(dev));
@@ -423,20 +424,25 @@ static ssize_t koneplus_sysfs_set_startup_profile(struct device *dev,
423 return retval; 424 return retval;
424 425
425 mutex_lock(&koneplus->koneplus_lock); 426 mutex_lock(&koneplus->koneplus_lock);
426 retval = koneplus_set_startup_profile(usb_dev, profile); 427
427 mutex_unlock(&koneplus->koneplus_lock); 428 retval = koneplus_set_actual_profile(usb_dev, profile);
428 if (retval) 429 if (retval) {
430 mutex_unlock(&koneplus->koneplus_lock);
429 return retval; 431 return retval;
432 }
430 433
431 return size; 434 koneplus->actual_profile = profile;
432}
433 435
434static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev, 436 roccat_report.type = KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE;
435 struct device_attribute *attr, char *buf) 437 roccat_report.data1 = profile + 1;
436{ 438 roccat_report.data2 = 0;
437 struct koneplus_device *koneplus = 439 roccat_report.profile = profile + 1;
438 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); 440 roccat_report_event(koneplus->chrdev_minor,
439 return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile); 441 (uint8_t const *)&roccat_report);
442
443 mutex_unlock(&koneplus->koneplus_lock);
444
445 return size;
440} 446}
441 447
442static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, 448static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
@@ -448,11 +454,12 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
448} 454}
449 455
450static struct device_attribute koneplus_attributes[] = { 456static struct device_attribute koneplus_attributes[] = {
457 __ATTR(actual_profile, 0660,
458 koneplus_sysfs_show_actual_profile,
459 koneplus_sysfs_set_actual_profile),
451 __ATTR(startup_profile, 0660, 460 __ATTR(startup_profile, 0660,
452 koneplus_sysfs_show_startup_profile, 461 koneplus_sysfs_show_actual_profile,
453 koneplus_sysfs_set_startup_profile), 462 koneplus_sysfs_set_actual_profile),
454 __ATTR(actual_profile, 0440,
455 koneplus_sysfs_show_actual_profile, NULL),
456 __ATTR(firmware_version, 0440, 463 __ATTR(firmware_version, 0440,
457 koneplus_sysfs_show_firmware_version, NULL), 464 koneplus_sysfs_show_firmware_version, NULL),
458 __ATTR_NULL 465 __ATTR_NULL
@@ -557,15 +564,10 @@ static int koneplus_init_koneplus_device_struct(struct usb_device *usb_dev,
557 struct koneplus_device *koneplus) 564 struct koneplus_device *koneplus)
558{ 565{
559 int retval, i; 566 int retval, i;
560 static uint wait = 100; /* device will freeze with just 60 */ 567 static uint wait = 200;
561 568
562 mutex_init(&koneplus->koneplus_lock); 569 mutex_init(&koneplus->koneplus_lock);
563 570
564 koneplus->startup_profile = koneplus_get_startup_profile(usb_dev);
565 if (koneplus->startup_profile < 0)
566 return koneplus->startup_profile;
567
568 msleep(wait);
569 retval = koneplus_get_info(usb_dev, &koneplus->info); 571 retval = koneplus_get_info(usb_dev, &koneplus->info);
570 if (retval) 572 if (retval)
571 return retval; 573 return retval;
@@ -584,7 +586,11 @@ static int koneplus_init_koneplus_device_struct(struct usb_device *usb_dev,
584 return retval; 586 return retval;
585 } 587 }
586 588
587 koneplus_profile_activated(koneplus, koneplus->startup_profile); 589 msleep(wait);
590 retval = koneplus_get_actual_profile(usb_dev);
591 if (retval < 0)
592 return retval;
593 koneplus_profile_activated(koneplus, retval);
588 594
589 return 0; 595 return 0;
590} 596}
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h
index 57a5c1ab7b05..c57a376ab8ae 100644
--- a/drivers/hid/hid-roccat-koneplus.h
+++ b/drivers/hid/hid-roccat-koneplus.h
@@ -40,10 +40,10 @@ enum koneplus_control_values {
40 KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, 40 KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,
41}; 41};
42 42
43struct koneplus_startup_profile { 43struct koneplus_actual_profile {
44 uint8_t command; /* KONEPLUS_COMMAND_STARTUP_PROFILE */ 44 uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
45 uint8_t size; /* always 3 */ 45 uint8_t size; /* always 3 */
46 uint8_t startup_profile; /* Range 0-4! */ 46 uint8_t actual_profile; /* Range 0-4! */
47} __attribute__ ((__packed__)); 47} __attribute__ ((__packed__));
48 48
49struct koneplus_profile_settings { 49struct koneplus_profile_settings {
@@ -132,7 +132,7 @@ struct koneplus_tcu_image {
132 132
133enum koneplus_commands { 133enum koneplus_commands {
134 KONEPLUS_COMMAND_CONTROL = 0x4, 134 KONEPLUS_COMMAND_CONTROL = 0x4,
135 KONEPLUS_COMMAND_STARTUP_PROFILE = 0x5, 135 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
136 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, 136 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
137 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, 137 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
138 KONEPLUS_COMMAND_MACRO = 0x8, 138 KONEPLUS_COMMAND_MACRO = 0x8,
@@ -145,7 +145,7 @@ enum koneplus_commands {
145 145
146enum koneplus_usb_commands { 146enum koneplus_usb_commands {
147 KONEPLUS_USB_COMMAND_CONTROL = 0x304, 147 KONEPLUS_USB_COMMAND_CONTROL = 0x304,
148 KONEPLUS_USB_COMMAND_STARTUP_PROFILE = 0x305, 148 KONEPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
149 KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306, 149 KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
150 KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307, 150 KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
151 KONEPLUS_USB_COMMAND_MACRO = 0x308, 151 KONEPLUS_USB_COMMAND_MACRO = 0x308,
@@ -215,7 +215,6 @@ struct koneplus_device {
215 215
216 struct mutex koneplus_lock; 216 struct mutex koneplus_lock;
217 217
218 int startup_profile;
219 struct koneplus_info info; 218 struct koneplus_info info;
220 struct koneplus_profile_settings profile_settings[5]; 219 struct koneplus_profile_settings profile_settings[5];
221 struct koneplus_profile_buttons profile_buttons[5]; 220 struct koneplus_profile_buttons profile_buttons[5];
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 160f481344f6..38280c055a19 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -652,7 +652,8 @@ static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report,
652static const struct hid_device_id pyra_devices[] = { 652static const struct hid_device_id pyra_devices[] = {
653 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, 653 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT,
654 USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 654 USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
655 /* TODO add USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS after testing */ 655 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT,
656 USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) },
656 { } 657 { }
657}; 658};
658 659
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 93819a08121a..936c911fdca6 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -178,6 +178,8 @@ static void sony_remove(struct hid_device *hdev)
178static const struct hid_device_id sony_devices[] = { 178static const struct hid_device_id sony_devices[] = {
179 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), 179 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
180 .driver_data = SIXAXIS_CONTROLLER_USB }, 180 .driver_data = SIXAXIS_CONTROLLER_USB },
181 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER),
182 .driver_data = SIXAXIS_CONTROLLER_USB },
181 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), 183 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
182 .driver_data = SIXAXIS_CONTROLLER_BT }, 184 .driver_data = SIXAXIS_CONTROLLER_BT },
183 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), 185 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 54409cba018c..c79578b5a788 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -101,8 +101,8 @@ out:
101 return ret; 101 return ret;
102} 102}
103 103
104/* the first byte is expected to be a report number */ 104/* The first byte is expected to be a report number.
105/* This function is to be called with the minors_lock mutex held */ 105 * This function is to be called with the minors_lock mutex held */
106static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) 106static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type)
107{ 107{
108 unsigned int minor = iminor(file->f_path.dentry->d_inode); 108 unsigned int minor = iminor(file->f_path.dentry->d_inode);
@@ -166,11 +166,11 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
166 166
167 167
168/* This function performs a Get_Report transfer over the control endpoint 168/* This function performs a Get_Report transfer over the control endpoint
169 per section 7.2.1 of the HID specification, version 1.1. The first byte 169 * per section 7.2.1 of the HID specification, version 1.1. The first byte
170 of buffer is the report number to request, or 0x0 if the defice does not 170 * of buffer is the report number to request, or 0x0 if the defice does not
171 use numbered reports. The report_type parameter can be HID_FEATURE_REPORT 171 * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT
172 or HID_INPUT_REPORT. This function is to be called with the minors_lock 172 * or HID_INPUT_REPORT. This function is to be called with the minors_lock
173 mutex held. */ 173 * mutex held. */
174static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) 174static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type)
175{ 175{
176 unsigned int minor = iminor(file->f_path.dentry->d_inode); 176 unsigned int minor = iminor(file->f_path.dentry->d_inode);
@@ -207,7 +207,7 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
207 } 207 }
208 208
209 /* Read the first byte from the user. This is the report number, 209 /* Read the first byte from the user. This is the report number,
210 which is passed to dev->hid_get_raw_report(). */ 210 * which is passed to dev->hid_get_raw_report(). */
211 if (copy_from_user(&report_number, buffer, 1)) { 211 if (copy_from_user(&report_number, buffer, 1)) {
212 ret = -EFAULT; 212 ret = -EFAULT;
213 goto out_free; 213 goto out_free;
@@ -395,12 +395,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
395 } 395 }
396 396
397 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { 397 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
398 int len; 398 int len = strlen(hid->name) + 1;
399 if (!hid->name) {
400 ret = 0;
401 break;
402 }
403 len = strlen(hid->name) + 1;
404 if (len > _IOC_SIZE(cmd)) 399 if (len > _IOC_SIZE(cmd))
405 len = _IOC_SIZE(cmd); 400 len = _IOC_SIZE(cmd);
406 ret = copy_to_user(user_arg, hid->name, len) ? 401 ret = copy_to_user(user_arg, hid->name, len) ?
@@ -409,12 +404,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
409 } 404 }
410 405
411 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { 406 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
412 int len; 407 int len = strlen(hid->phys) + 1;
413 if (!hid->phys) {
414 ret = 0;
415 break;
416 }
417 len = strlen(hid->phys) + 1;
418 if (len > _IOC_SIZE(cmd)) 408 if (len > _IOC_SIZE(cmd))
419 len = _IOC_SIZE(cmd); 409 len = _IOC_SIZE(cmd);
420 ret = copy_to_user(user_arg, hid->phys, len) ? 410 ret = copy_to_user(user_arg, hid->phys, len) ?
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 9a94b643ccde..0e30b140edca 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -59,6 +59,7 @@ static const struct hid_blacklist {
59 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, 59 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET },
60 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, 60 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET },
61 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, 61 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET },
62 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE, HID_QUIRK_NOGET },
62 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, 63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET },
63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, 64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, 65 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
@@ -67,6 +68,8 @@ static const struct hid_blacklist {
67 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, 68 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
68 { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, 69 { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET },
69 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, 70 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
71 { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
72 { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
70 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 73 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
71 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, 74 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
72 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, 75 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT },
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index af0a7c1002af..ff3c644888b1 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -242,6 +242,7 @@ static int hiddev_release(struct inode * inode, struct file * file)
242 list_del(&list->node); 242 list_del(&list->node);
243 spin_unlock_irqrestore(&list->hiddev->list_lock, flags); 243 spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
244 244
245 mutex_lock(&list->hiddev->existancelock);
245 if (!--list->hiddev->open) { 246 if (!--list->hiddev->open) {
246 if (list->hiddev->exist) { 247 if (list->hiddev->exist) {
247 usbhid_close(list->hiddev->hid); 248 usbhid_close(list->hiddev->hid);
@@ -252,6 +253,7 @@ static int hiddev_release(struct inode * inode, struct file * file)
252 } 253 }
253 254
254 kfree(list); 255 kfree(list);
256 mutex_unlock(&list->hiddev->existancelock);
255 257
256 return 0; 258 return 0;
257} 259}
@@ -300,17 +302,21 @@ static int hiddev_open(struct inode *inode, struct file *file)
300 list_add_tail(&list->node, &hiddev->list); 302 list_add_tail(&list->node, &hiddev->list);
301 spin_unlock_irq(&list->hiddev->list_lock); 303 spin_unlock_irq(&list->hiddev->list_lock);
302 304
305 mutex_lock(&hiddev->existancelock);
303 if (!list->hiddev->open++) 306 if (!list->hiddev->open++)
304 if (list->hiddev->exist) { 307 if (list->hiddev->exist) {
305 struct hid_device *hid = hiddev->hid; 308 struct hid_device *hid = hiddev->hid;
306 res = usbhid_get_power(hid); 309 res = usbhid_get_power(hid);
307 if (res < 0) { 310 if (res < 0) {
308 res = -EIO; 311 res = -EIO;
309 goto bail; 312 goto bail_unlock;
310 } 313 }
311 usbhid_open(hid); 314 usbhid_open(hid);
312 } 315 }
316 mutex_unlock(&hiddev->existancelock);
313 return 0; 317 return 0;
318bail_unlock:
319 mutex_unlock(&hiddev->existancelock);
314bail: 320bail:
315 file->private_data = NULL; 321 file->private_data = NULL;
316 kfree(list); 322 kfree(list);
@@ -367,8 +373,10 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
367 /* let O_NONBLOCK tasks run */ 373 /* let O_NONBLOCK tasks run */
368 mutex_unlock(&list->thread_lock); 374 mutex_unlock(&list->thread_lock);
369 schedule(); 375 schedule();
370 if (mutex_lock_interruptible(&list->thread_lock)) 376 if (mutex_lock_interruptible(&list->thread_lock)) {
377 finish_wait(&list->hiddev->wait, &wait);
371 return -EINTR; 378 return -EINTR;
379 }
372 set_current_state(TASK_INTERRUPTIBLE); 380 set_current_state(TASK_INTERRUPTIBLE);
373 } 381 }
374 finish_wait(&list->hiddev->wait, &wait); 382 finish_wait(&list->hiddev->wait, &wait);
@@ -509,7 +517,7 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
509 (uref_multi->num_values > HID_MAX_MULTI_USAGES || 517 (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
510 uref->usage_index + uref_multi->num_values > field->report_count)) 518 uref->usage_index + uref_multi->num_values > field->report_count))
511 goto inval; 519 goto inval;
512 } 520 }
513 521
514 switch (cmd) { 522 switch (cmd) {
515 case HIDIOCGUSAGE: 523 case HIDIOCGUSAGE:
@@ -801,14 +809,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
801 break; 809 break;
802 810
803 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { 811 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) {
804 int len; 812 int len = strlen(hid->name) + 1;
805
806 if (!hid->name) {
807 r = 0;
808 break;
809 }
810
811 len = strlen(hid->name) + 1;
812 if (len > _IOC_SIZE(cmd)) 813 if (len > _IOC_SIZE(cmd))
813 len = _IOC_SIZE(cmd); 814 len = _IOC_SIZE(cmd);
814 r = copy_to_user(user_arg, hid->name, len) ? 815 r = copy_to_user(user_arg, hid->name, len) ?
@@ -817,14 +818,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
817 } 818 }
818 819
819 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { 820 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) {
820 int len; 821 int len = strlen(hid->phys) + 1;
821
822 if (!hid->phys) {
823 r = 0;
824 break;
825 }
826
827 len = strlen(hid->phys) + 1;
828 if (len > _IOC_SIZE(cmd)) 822 if (len > _IOC_SIZE(cmd))
829 len = _IOC_SIZE(cmd); 823 len = _IOC_SIZE(cmd);
830 r = copy_to_user(user_arg, hid->phys, len) ? 824 r = copy_to_user(user_arg, hid->phys, len) ?
@@ -925,7 +919,6 @@ void hiddev_disconnect(struct hid_device *hid)
925 919
926 mutex_lock(&hiddev->existancelock); 920 mutex_lock(&hiddev->existancelock);
927 hiddev->exist = 0; 921 hiddev->exist = 0;
928 mutex_unlock(&hiddev->existancelock);
929 922
930 usb_deregister_dev(usbhid->intf, &hiddev_class); 923 usb_deregister_dev(usbhid->intf, &hiddev_class);
931 924
@@ -935,4 +928,5 @@ void hiddev_disconnect(struct hid_device *hid)
935 } else { 928 } else {
936 kfree(hiddev); 929 kfree(hiddev);
937 } 930 }
931 mutex_unlock(&hiddev->existancelock);
938} 932}