aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/Kconfig3
-rw-r--r--drivers/hid/hid-core.c21
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-input.c2
-rw-r--r--drivers/hid/hid-roccat-kone.c9
-rw-r--r--drivers/hid/hid-saitek.c4
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c2
-rw-r--r--drivers/hid/usbhid/hid-core.c36
-rw-r--r--drivers/hid/usbhid/usbhid.h1
-rw-r--r--drivers/hid/wacom_sys.c9
-rw-r--r--drivers/hid/wacom_wac.c1
-rw-r--r--include/linux/hid.h4
12 files changed, 50 insertions, 43 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f42df4dd58d2..3a3f29c0cc36 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -629,7 +629,7 @@ config HID_ROCCAT
629 support for its special functionalities. 629 support for its special functionalities.
630 630
631config HID_SAITEK 631config HID_SAITEK
632 tristate "Saitek non-fully HID-compliant devices" 632 tristate "Saitek (Mad Catz) non-fully HID-compliant devices"
633 depends on HID 633 depends on HID
634 ---help--- 634 ---help---
635 Support for Saitek devices that are not fully compliant with the 635 Support for Saitek devices that are not fully compliant with the
@@ -637,6 +637,7 @@ config HID_SAITEK
637 637
638 Supported devices: 638 Supported devices:
639 - PS1000 Dual Analog Pad 639 - PS1000 Dual Analog Pad
640 - R.A.T.9 Gaming Mouse
640 - R.A.T.7 Gaming Mouse 641 - R.A.T.7 Gaming Mouse
641 - M.M.O.7 Gaming Mouse 642 - M.M.O.7 Gaming Mouse
642 643
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3402033fa52a..bae74afa5e00 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -780,22 +780,19 @@ static int hid_scan_report(struct hid_device *hid)
780 hid->group = HID_GROUP_MULTITOUCH_WIN_8; 780 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
781 781
782 /* 782 /*
783 * Vendor specific handlings
784 */
785 if ((hid->vendor == USB_VENDOR_ID_SYNAPTICS) &&
786 (hid->group == HID_GROUP_GENERIC) &&
787 /* only bind to the mouse interface of composite USB devices */
788 (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
789 /* hid-rmi should take care of them, not hid-generic */
790 hid->group = HID_GROUP_RMI;
791
792 /*
793 * Vendor specific handlings 783 * Vendor specific handlings
794 */ 784 */
795 switch (hid->vendor) { 785 switch (hid->vendor) {
796 case USB_VENDOR_ID_WACOM: 786 case USB_VENDOR_ID_WACOM:
797 hid->group = HID_GROUP_WACOM; 787 hid->group = HID_GROUP_WACOM;
798 break; 788 break;
789 case USB_VENDOR_ID_SYNAPTICS:
790 if ((hid->group == HID_GROUP_GENERIC) &&
791 (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
792 /* hid-rmi should only bind to the mouse interface of
793 * composite USB devices */
794 hid->group = HID_GROUP_RMI;
795 break;
799 } 796 }
800 797
801 vfree(parser); 798 vfree(parser);
@@ -1910,6 +1907,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1910 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, 1907 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
1911 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, 1908 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
1912 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, 1909 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
1910 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
1913#endif 1911#endif
1914 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1912 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1915 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, 1913 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
@@ -2539,7 +2537,8 @@ int hid_add_device(struct hid_device *hdev)
2539 * Scan generic devices for group information 2537 * Scan generic devices for group information
2540 */ 2538 */
2541 if (hid_ignore_special_drivers || 2539 if (hid_ignore_special_drivers ||
2542 !hid_match_id(hdev, hid_have_special_driver)) { 2540 (!hdev->group &&
2541 !hid_match_id(hdev, hid_have_special_driver))) {
2543 ret = hid_scan_report(hdev); 2542 ret = hid_scan_report(hdev);
2544 if (ret) 2543 if (ret)
2545 hid_warn(hdev, "bad device descriptor (%d)\n", ret); 2544 hid_warn(hdev, "bad device descriptor (%d)\n", ret);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index a7c1c1d9706d..40627c713519 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -621,6 +621,7 @@
621 621
622#define USB_VENDOR_ID_MADCATZ 0x0738 622#define USB_VENDOR_ID_MADCATZ 0x0738
623#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 623#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
624#define USB_DEVICE_ID_MADCATZ_RAT9 0x1709
624 625
625#define USB_VENDOR_ID_MCC 0x09db 626#define USB_VENDOR_ID_MCC 0x09db
626#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 627#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 725f22ca47fc..be3eba8b9731 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -872,7 +872,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
872 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; 872 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;
873 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; 873 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;
874 874
875 default: goto ignore; 875 default: map_key_clear(KEY_UNKNOWN);
876 } 876 }
877 break; 877 break;
878 878
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 6101816a7ddd..c29265055ac1 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -46,6 +46,7 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile)
46static void kone_profile_report(struct kone_device *kone, uint new_profile) 46static void kone_profile_report(struct kone_device *kone, uint new_profile)
47{ 47{
48 struct kone_roccat_report roccat_report; 48 struct kone_roccat_report roccat_report;
49
49 roccat_report.event = kone_mouse_event_switch_profile; 50 roccat_report.event = kone_mouse_event_switch_profile;
50 roccat_report.value = new_profile; 51 roccat_report.value = new_profile;
51 roccat_report.key = 0; 52 roccat_report.key = 0;
@@ -163,6 +164,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
163 struct kone_settings const *settings) 164 struct kone_settings const *settings)
164{ 165{
165 int retval; 166 int retval;
167
166 retval = kone_send(usb_dev, kone_command_settings, 168 retval = kone_send(usb_dev, kone_command_settings,
167 settings, sizeof(struct kone_settings)); 169 settings, sizeof(struct kone_settings));
168 if (retval) 170 if (retval)
@@ -387,7 +389,7 @@ static struct bin_attribute bin_attr_profile##number = { \
387 .read = kone_sysfs_read_profilex, \ 389 .read = kone_sysfs_read_profilex, \
388 .write = kone_sysfs_write_profilex, \ 390 .write = kone_sysfs_write_profilex, \
389 .private = &profile_numbers[number-1], \ 391 .private = &profile_numbers[number-1], \
390}; 392}
391PROFILE_ATTR(1); 393PROFILE_ATTR(1);
392PROFILE_ATTR(2); 394PROFILE_ATTR(2);
393PROFILE_ATTR(3); 395PROFILE_ATTR(3);
@@ -456,6 +458,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
456static int kone_tcu_command(struct usb_device *usb_dev, int number) 458static int kone_tcu_command(struct usb_device *usb_dev, int number)
457{ 459{
458 unsigned char value; 460 unsigned char value;
461
459 value = number; 462 value = number;
460 return kone_send(usb_dev, kone_command_calibrate, &value, 1); 463 return kone_send(usb_dev, kone_command_calibrate, &value, 1);
461} 464}
@@ -697,10 +700,8 @@ static int kone_init_specials(struct hid_device *hdev)
697 == USB_INTERFACE_PROTOCOL_MOUSE) { 700 == USB_INTERFACE_PROTOCOL_MOUSE) {
698 701
699 kone = kzalloc(sizeof(*kone), GFP_KERNEL); 702 kone = kzalloc(sizeof(*kone), GFP_KERNEL);
700 if (!kone) { 703 if (!kone)
701 hid_err(hdev, "can't alloc device descriptor\n");
702 return -ENOMEM; 704 return -ENOMEM;
703 }
704 hid_set_drvdata(hdev, kone); 705 hid_set_drvdata(hdev, kone);
705 706
706 retval = kone_init_kone_device_struct(usb_dev, kone); 707 retval = kone_init_kone_device_struct(usb_dev, kone);
diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c
index 69cca1476a0c..5632c54eadf0 100644
--- a/drivers/hid/hid-saitek.c
+++ b/drivers/hid/hid-saitek.c
@@ -7,7 +7,7 @@
7 * (This module is based on "hid-ortek".) 7 * (This module is based on "hid-ortek".)
8 * Copyright (c) 2012 Andreas Hübner 8 * Copyright (c) 2012 Andreas Hübner
9 * 9 *
10 * R.A.T.7, M.M.O.7 (USB gaming mice): 10 * R.A.T.7, R.A.T.9, M.M.O.7 (USB gaming mice):
11 * Fixes the mode button which cycles through three constantly pressed 11 * Fixes the mode button which cycles through three constantly pressed
12 * buttons. All three press events are mapped to one button and the 12 * buttons. All three press events are mapped to one button and the
13 * missing release event is generated immediately. 13 * missing release event is generated immediately.
@@ -179,6 +179,8 @@ static const struct hid_device_id saitek_devices[] = {
179 .driver_data = SAITEK_FIX_PS1000 }, 179 .driver_data = SAITEK_FIX_PS1000 },
180 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), 180 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
181 .driver_data = SAITEK_RELEASE_MODE_RAT7 }, 181 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
182 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
183 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
182 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), 184 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7),
183 .driver_data = SAITEK_RELEASE_MODE_MMO7 }, 185 .driver_data = SAITEK_RELEASE_MODE_MMO7 },
184 { } 186 { }
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 747d54421e73..9c014803b460 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -369,7 +369,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
369static void i2c_hid_get_input(struct i2c_hid *ihid) 369static void i2c_hid_get_input(struct i2c_hid *ihid)
370{ 370{
371 int ret, ret_size; 371 int ret, ret_size;
372 int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); 372 int size = ihid->bufsize;
373 373
374 ret = i2c_master_recv(ihid->client, ihid->inbuf, size); 374 ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
375 if (ret != size) { 375 if (ret != size) {
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ca6849a0121e..04e34b917045 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -278,18 +278,20 @@ static void hid_irq_in(struct urb *urb)
278 usbhid->retry_delay = 0; 278 usbhid->retry_delay = 0;
279 if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open) 279 if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open)
280 break; 280 break;
281 hid_input_report(urb->context, HID_INPUT_REPORT, 281 if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
282 urb->transfer_buffer, 282 hid_input_report(urb->context, HID_INPUT_REPORT,
283 urb->actual_length, 1); 283 urb->transfer_buffer,
284 /* 284 urb->actual_length, 1);
285 * autosuspend refused while keys are pressed 285 /*
286 * because most keyboards don't wake up when 286 * autosuspend refused while keys are pressed
287 * a key is released 287 * because most keyboards don't wake up when
288 */ 288 * a key is released
289 if (hid_check_keys_pressed(hid)) 289 */
290 set_bit(HID_KEYS_PRESSED, &usbhid->iofl); 290 if (hid_check_keys_pressed(hid))
291 else 291 set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
292 clear_bit(HID_KEYS_PRESSED, &usbhid->iofl); 292 else
293 clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
294 }
293 break; 295 break;
294 case -EPIPE: /* stall */ 296 case -EPIPE: /* stall */
295 usbhid_mark_busy(usbhid); 297 usbhid_mark_busy(usbhid);
@@ -688,6 +690,7 @@ int usbhid_open(struct hid_device *hid)
688 goto done; 690 goto done;
689 } 691 }
690 usbhid->intf->needs_remote_wakeup = 1; 692 usbhid->intf->needs_remote_wakeup = 1;
693 set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
691 res = hid_start_in(hid); 694 res = hid_start_in(hid);
692 if (res) { 695 if (res) {
693 if (res != -ENOSPC) { 696 if (res != -ENOSPC) {
@@ -701,6 +704,15 @@ int usbhid_open(struct hid_device *hid)
701 } 704 }
702 } 705 }
703 usb_autopm_put_interface(usbhid->intf); 706 usb_autopm_put_interface(usbhid->intf);
707
708 /*
709 * In case events are generated while nobody was listening,
710 * some are released when the device is re-opened.
711 * Wait 50 msec for the queue to empty before allowing events
712 * to go through hid.
713 */
714 msleep(50);
715 clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
704 } 716 }
705done: 717done:
706 mutex_unlock(&hid_open_mut); 718 mutex_unlock(&hid_open_mut);
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index f633c24ce28b..807922b49aa4 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -52,6 +52,7 @@ struct usb_interface *usbhid_find_interface(int minor);
52#define HID_STARTED 8 52#define HID_STARTED 8
53#define HID_KEYS_PRESSED 10 53#define HID_KEYS_PRESSED 10
54#define HID_NO_BANDWIDTH 11 54#define HID_NO_BANDWIDTH 11
55#define HID_RESUME_RUNNING 12
55 56
56/* 57/*
57 * USB-specific HID struct, to be pointed to 58 * USB-specific HID struct, to be pointed to
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 8593047bb726..b6bcd251c4a8 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -70,22 +70,15 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
70static int wacom_open(struct input_dev *dev) 70static int wacom_open(struct input_dev *dev)
71{ 71{
72 struct wacom *wacom = input_get_drvdata(dev); 72 struct wacom *wacom = input_get_drvdata(dev);
73 int retval;
74
75 mutex_lock(&wacom->lock);
76 retval = hid_hw_open(wacom->hdev);
77 mutex_unlock(&wacom->lock);
78 73
79 return retval; 74 return hid_hw_open(wacom->hdev);
80} 75}
81 76
82static void wacom_close(struct input_dev *dev) 77static void wacom_close(struct input_dev *dev)
83{ 78{
84 struct wacom *wacom = input_get_drvdata(dev); 79 struct wacom *wacom = input_get_drvdata(dev);
85 80
86 mutex_lock(&wacom->lock);
87 hid_hw_close(wacom->hdev); 81 hid_hw_close(wacom->hdev);
88 mutex_unlock(&wacom->lock);
89} 82}
90 83
91/* 84/*
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 586b2405b0d4..7cf998cdd011 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -3026,6 +3026,7 @@ const struct hid_device_id wacom_ids[] = {
3026 { USB_DEVICE_WACOM(0x4004) }, 3026 { USB_DEVICE_WACOM(0x4004) },
3027 { USB_DEVICE_WACOM(0x5000) }, 3027 { USB_DEVICE_WACOM(0x5000) },
3028 { USB_DEVICE_WACOM(0x5002) }, 3028 { USB_DEVICE_WACOM(0x5002) },
3029 { USB_DEVICE_LENOVO(0x6004) },
3029 3030
3030 { USB_DEVICE_WACOM(HID_ANY_ID) }, 3031 { USB_DEVICE_WACOM(HID_ANY_ID) },
3031 { } 3032 { }
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf941cd..5b1ff6110e25 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -312,10 +312,6 @@ struct hid_item {
312 * Vendor specific HID device groups 312 * Vendor specific HID device groups
313 */ 313 */
314#define HID_GROUP_RMI 0x0100 314#define HID_GROUP_RMI 0x0100
315
316/*
317 * Vendor specific HID device groups
318 */
319#define HID_GROUP_WACOM 0x0101 315#define HID_GROUP_WACOM 0x0101
320 316
321/* 317/*