aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-apple.c12
-rw-r--r--drivers/hid/hid-core.c7
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-multitouch.c47
-rw-r--r--drivers/hid/hid-roccat.c18
5 files changed, 33 insertions, 55 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 9bc7b03269df..299d23871122 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -183,9 +183,6 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
183 if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && 183 if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
184 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) 184 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
185 table = macbookair_fn_keys; 185 table = macbookair_fn_keys;
186 else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI &&
187 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6_JIS)
188 table = macbookair_fn_keys;
189 else if (hid->product < 0x21d || hid->product >= 0x300) 186 else if (hid->product < 0x21d || hid->product >= 0x300)
190 table = powerbook_fn_keys; 187 table = powerbook_fn_keys;
191 else 188 else
@@ -458,6 +455,9 @@ static const struct hid_device_id apple_devices[] = {
458 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), 455 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
459 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 456 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
460 APPLE_ISO_KEYBOARD }, 457 APPLE_ISO_KEYBOARD },
458 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
459 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
460 APPLE_ISO_KEYBOARD },
461 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), 461 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
462 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 462 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
463 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), 463 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
@@ -508,6 +508,12 @@ static const struct hid_device_id apple_devices[] = {
508 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 508 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
509 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), 509 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
510 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 510 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
511 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
512 .driver_data = APPLE_HAS_FN },
513 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
514 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
515 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
516 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
511 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 517 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
512 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 518 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
513 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 519 { 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 91adcc5bad28..848a56c0279c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1362,6 +1362,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
1362 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 1362 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
1363 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 1363 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
1364 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1364 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1365 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) },
1366 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) },
1367 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) },
1365 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, 1368 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) },
1366 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, 1369 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) },
1367 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, 1370 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
@@ -1374,6 +1377,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1374 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1377 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1375 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1378 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1376 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1379 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
1380 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
1377 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1381 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1378 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1382 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1379 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, 1383 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
@@ -1942,6 +1946,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1942 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 1946 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
1943 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 1947 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
1944 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1948 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1949 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) },
1950 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) },
1951 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) },
1945 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 1952 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) },
1946 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 1953 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) },
1947 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, 1954 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1680e99b4816..06ce996b8b65 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -112,6 +112,9 @@
112#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f 112#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f
113#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250 113#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250
114#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251 114#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251
115#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252
116#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253
117#define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254
115#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 118#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249
116#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a 119#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a
117#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b 120#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b
@@ -121,6 +124,7 @@
121#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 124#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
122#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 125#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
123#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 126#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
127#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256
124#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 128#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
125#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 129#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
126#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 130#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index fa5d7a1ffa9e..f1c909f1b239 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -291,7 +291,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
291 td->last_slot_field = usage->hid; 291 td->last_slot_field = usage->hid;
292 td->last_field_index = field->index; 292 td->last_field_index = field->index;
293 td->last_mt_collection = usage->collection_index; 293 td->last_mt_collection = usage->collection_index;
294 hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
295 return 1; 294 return 1;
296 case HID_DG_WIDTH: 295 case HID_DG_WIDTH:
297 hid_map_usage(hi, usage, bit, max, 296 hid_map_usage(hi, usage, bit, max,
@@ -530,44 +529,12 @@ static void mt_set_input_mode(struct hid_device *hdev)
530 } 529 }
531} 530}
532 531
533/* a list of devices for which there is a specialized multitouch driver */
534static const struct hid_device_id mt_have_special_driver[] = {
535 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0001) },
536 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0006) },
537 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
538 USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) },
539 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
540 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
541 { }
542};
543
544static bool mt_match_one_id(struct hid_device *hdev,
545 const struct hid_device_id *id)
546{
547 return id->bus == hdev->bus &&
548 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) &&
549 (id->product == HID_ANY_ID || id->product == hdev->product);
550}
551
552static const struct hid_device_id *mt_match_id(struct hid_device *hdev,
553 const struct hid_device_id *id)
554{
555 for (; id->bus; id++)
556 if (mt_match_one_id(hdev, id))
557 return id;
558
559 return NULL;
560}
561
562static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) 532static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
563{ 533{
564 int ret, i; 534 int ret, i;
565 struct mt_device *td; 535 struct mt_device *td;
566 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ 536 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
567 537
568 if (mt_match_id(hdev, mt_have_special_driver))
569 return -ENODEV;
570
571 for (i = 0; mt_classes[i].name ; i++) { 538 for (i = 0; mt_classes[i].name ; i++) {
572 if (id->driver_data == mt_classes[i].name) { 539 if (id->driver_data == mt_classes[i].name) {
573 mtclass = &(mt_classes[i]); 540 mtclass = &(mt_classes[i]);
@@ -575,6 +542,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
575 } 542 }
576 } 543 }
577 544
545 /* This allows the driver to correctly support devices
546 * that emit events over several HID messages.
547 */
548 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
578 549
579 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); 550 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
580 if (!td) { 551 if (!td) {
@@ -590,16 +561,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
590 if (ret != 0) 561 if (ret != 0)
591 goto fail; 562 goto fail;
592 563
593 hdev->quirks |= HID_QUIRK_MULTITOUCH;
594 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 564 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
595 if (ret) 565 if (ret)
596 goto fail; 566 goto fail;
597 567
598 /* This allows the driver to correctly support devices
599 * that emit events over several HID messages.
600 */
601 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
602
603 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), 568 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
604 GFP_KERNEL); 569 GFP_KERNEL);
605 if (!td->slots) { 570 if (!td->slots) {
@@ -793,10 +758,6 @@ static const struct hid_device_id mt_devices[] = {
793 HID_USB_DEVICE(USB_VENDOR_ID_XAT, 758 HID_USB_DEVICE(USB_VENDOR_ID_XAT,
794 USB_DEVICE_ID_XAT_CSR) }, 759 USB_DEVICE_ID_XAT_CSR) },
795 760
796 /* Rest of the world */
797 { .driver_data = MT_CLS_DEFAULT,
798 HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) },
799
800 { } 761 { }
801}; 762};
802MODULE_DEVICE_TABLE(hid, mt_devices); 763MODULE_DEVICE_TABLE(hid, mt_devices);
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 2596321bab07..b685b04dbf9d 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -163,27 +163,27 @@ static int roccat_open(struct inode *inode, struct file *file)
163 163
164 device = devices[minor]; 164 device = devices[minor];
165 165
166 mutex_lock(&device->readers_lock);
167
168 if (!device) { 166 if (!device) {
169 pr_emerg("roccat device with minor %d doesn't exist\n", minor); 167 pr_emerg("roccat device with minor %d doesn't exist\n", minor);
170 error = -ENODEV; 168 error = -ENODEV;
171 goto exit_err; 169 goto exit_err_devices;
172 } 170 }
173 171
172 mutex_lock(&device->readers_lock);
173
174 if (!device->open++) { 174 if (!device->open++) {
175 /* power on device on adding first reader */ 175 /* power on device on adding first reader */
176 error = hid_hw_power(device->hid, PM_HINT_FULLON); 176 error = hid_hw_power(device->hid, PM_HINT_FULLON);
177 if (error < 0) { 177 if (error < 0) {
178 --device->open; 178 --device->open;
179 goto exit_err; 179 goto exit_err_readers;
180 } 180 }
181 181
182 error = hid_hw_open(device->hid); 182 error = hid_hw_open(device->hid);
183 if (error < 0) { 183 if (error < 0) {
184 hid_hw_power(device->hid, PM_HINT_NORMAL); 184 hid_hw_power(device->hid, PM_HINT_NORMAL);
185 --device->open; 185 --device->open;
186 goto exit_err; 186 goto exit_err_readers;
187 } 187 }
188 } 188 }
189 189
@@ -194,13 +194,13 @@ static int roccat_open(struct inode *inode, struct file *file)
194 list_add_tail(&reader->node, &device->readers); 194 list_add_tail(&reader->node, &device->readers);
195 file->private_data = reader; 195 file->private_data = reader;
196 196
197exit_unlock: 197exit_err_readers:
198 mutex_unlock(&device->readers_lock); 198 mutex_unlock(&device->readers_lock);
199exit_err_devices:
199 mutex_unlock(&devices_lock); 200 mutex_unlock(&devices_lock);
201 if (error)
202 kfree(reader);
200 return error; 203 return error;
201exit_err:
202 kfree(reader);
203 goto exit_unlock;
204} 204}
205 205
206static int roccat_release(struct inode *inode, struct file *file) 206static int roccat_release(struct inode *inode, struct file *file)