Skip to content

Commit 3ee420b

Browse files
author
Jiri Kosina
committed
Merge branches 'for-3.18/upstream-fixes' and 'for-3.19/upstream' into for-linus
Conflicts: drivers/hid/hid-input.c
3 parents a32c99e + d1c7e29 + 7bb9d64 commit 3ee420b

File tree

12 files changed

+50
-43
lines changed

12 files changed

+50
-43
lines changed

drivers/hid/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,15 @@ config HID_ROCCAT
629629
support for its special functionalities.
630630

631631
config HID_SAITEK
632-
tristate "Saitek non-fully HID-compliant devices"
632+
tristate "Saitek (Mad Catz) non-fully HID-compliant devices"
633633
depends on HID
634634
---help---
635635
Support for Saitek devices that are not fully compliant with the
636636
HID standard.
637637

638638
Supported devices:
639639
- PS1000 Dual Analog Pad
640+
- R.A.T.9 Gaming Mouse
640641
- R.A.T.7 Gaming Mouse
641642
- M.M.O.7 Gaming Mouse
642643

drivers/hid/hid-core.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,23 +779,20 @@ static int hid_scan_report(struct hid_device *hid)
779779
(hid->group == HID_GROUP_MULTITOUCH))
780780
hid->group = HID_GROUP_MULTITOUCH_WIN_8;
781781

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-
792782
/*
793783
* Vendor specific handlings
794784
*/
795785
switch (hid->vendor) {
796786
case USB_VENDOR_ID_WACOM:
797787
hid->group = HID_GROUP_WACOM;
798788
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;
799796
}
800797

801798
vfree(parser);
@@ -1910,6 +1907,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
19101907
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
19111908
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
19121909
{ 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) },
19131911
#endif
19141912
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
19151913
{ 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)
25392537
* Scan generic devices for group information
25402538
*/
25412539
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))) {
25432542
ret = hid_scan_report(hdev);
25442543
if (ret)
25452544
hid_warn(hdev, "bad device descriptor (%d)\n", ret);

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@
621621

622622
#define USB_VENDOR_ID_MADCATZ 0x0738
623623
#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
624+
#define USB_DEVICE_ID_MADCATZ_RAT9 0x1709
624625

625626
#define USB_VENDOR_ID_MCC 0x09db
626627
#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076

drivers/hid/hid-input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
872872
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;
873873
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;
874874

875-
default: goto ignore;
875+
default: map_key_clear(KEY_UNKNOWN);
876876
}
877877
break;
878878

drivers/hid/hid-roccat-kone.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile)
4646
static void kone_profile_report(struct kone_device *kone, uint new_profile)
4747
{
4848
struct kone_roccat_report roccat_report;
49+
4950
roccat_report.event = kone_mouse_event_switch_profile;
5051
roccat_report.value = new_profile;
5152
roccat_report.key = 0;
@@ -163,6 +164,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
163164
struct kone_settings const *settings)
164165
{
165166
int retval;
167+
166168
retval = kone_send(usb_dev, kone_command_settings,
167169
settings, sizeof(struct kone_settings));
168170
if (retval)
@@ -387,7 +389,7 @@ static struct bin_attribute bin_attr_profile##number = { \
387389
.read = kone_sysfs_read_profilex, \
388390
.write = kone_sysfs_write_profilex, \
389391
.private = &profile_numbers[number-1], \
390-
};
392+
}
391393
PROFILE_ATTR(1);
392394
PROFILE_ATTR(2);
393395
PROFILE_ATTR(3);
@@ -456,6 +458,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
456458
static int kone_tcu_command(struct usb_device *usb_dev, int number)
457459
{
458460
unsigned char value;
461+
459462
value = number;
460463
return kone_send(usb_dev, kone_command_calibrate, &value, 1);
461464
}
@@ -697,10 +700,8 @@ static int kone_init_specials(struct hid_device *hdev)
697700
== USB_INTERFACE_PROTOCOL_MOUSE) {
698701

699702
kone = kzalloc(sizeof(*kone), GFP_KERNEL);
700-
if (!kone) {
701-
hid_err(hdev, "can't alloc device descriptor\n");
703+
if (!kone)
702704
return -ENOMEM;
703-
}
704705
hid_set_drvdata(hdev, kone);
705706

706707
retval = kone_init_kone_device_struct(usb_dev, kone);

drivers/hid/hid-saitek.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* (This module is based on "hid-ortek".)
88
* Copyright (c) 2012 Andreas Hübner
99
*
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):
1111
* Fixes the mode button which cycles through three constantly pressed
1212
* buttons. All three press events are mapped to one button and the
1313
* missing release event is generated immediately.
@@ -179,6 +179,8 @@ static const struct hid_device_id saitek_devices[] = {
179179
.driver_data = SAITEK_FIX_PS1000 },
180180
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
181181
.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 },
182184
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7),
183185
.driver_data = SAITEK_RELEASE_MODE_MMO7 },
184186
{ }

drivers/hid/i2c-hid/i2c-hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
369369
static void i2c_hid_get_input(struct i2c_hid *ihid)
370370
{
371371
int ret, ret_size;
372-
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
372+
int size = ihid->bufsize;
373373

374374
ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
375375
if (ret != size) {

drivers/hid/usbhid/hid-core.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,20 @@ static void hid_irq_in(struct urb *urb)
278278
usbhid->retry_delay = 0;
279279
if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open)
280280
break;
281-
hid_input_report(urb->context, HID_INPUT_REPORT,
282-
urb->transfer_buffer,
283-
urb->actual_length, 1);
284-
/*
285-
* autosuspend refused while keys are pressed
286-
* because most keyboards don't wake up when
287-
* a key is released
288-
*/
289-
if (hid_check_keys_pressed(hid))
290-
set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
291-
else
292-
clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
281+
if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
282+
hid_input_report(urb->context, HID_INPUT_REPORT,
283+
urb->transfer_buffer,
284+
urb->actual_length, 1);
285+
/*
286+
* autosuspend refused while keys are pressed
287+
* because most keyboards don't wake up when
288+
* a key is released
289+
*/
290+
if (hid_check_keys_pressed(hid))
291+
set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
292+
else
293+
clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
294+
}
293295
break;
294296
case -EPIPE: /* stall */
295297
usbhid_mark_busy(usbhid);
@@ -688,6 +690,7 @@ int usbhid_open(struct hid_device *hid)
688690
goto done;
689691
}
690692
usbhid->intf->needs_remote_wakeup = 1;
693+
set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
691694
res = hid_start_in(hid);
692695
if (res) {
693696
if (res != -ENOSPC) {
@@ -701,6 +704,15 @@ int usbhid_open(struct hid_device *hid)
701704
}
702705
}
703706
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);
704716
}
705717
done:
706718
mutex_unlock(&hid_open_mut);

drivers/hid/usbhid/usbhid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct usb_interface *usbhid_find_interface(int minor);
5252
#define HID_STARTED 8
5353
#define HID_KEYS_PRESSED 10
5454
#define HID_NO_BANDWIDTH 11
55+
#define HID_RESUME_RUNNING 12
5556

5657
/*
5758
* USB-specific HID struct, to be pointed to

drivers/hid/wacom_sys.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,15 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
7070
static int wacom_open(struct input_dev *dev)
7171
{
7272
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);
7873

79-
return retval;
74+
return hid_hw_open(wacom->hdev);
8075
}
8176

8277
static void wacom_close(struct input_dev *dev)
8378
{
8479
struct wacom *wacom = input_get_drvdata(dev);
8580

86-
mutex_lock(&wacom->lock);
8781
hid_hw_close(wacom->hdev);
88-
mutex_unlock(&wacom->lock);
8982
}
9083

9184
/*

drivers/hid/wacom_wac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,6 +3026,7 @@ const struct hid_device_id wacom_ids[] = {
30263026
{ USB_DEVICE_WACOM(0x4004) },
30273027
{ USB_DEVICE_WACOM(0x5000) },
30283028
{ USB_DEVICE_WACOM(0x5002) },
3029+
{ USB_DEVICE_LENOVO(0x6004) },
30293030

30303031
{ USB_DEVICE_WACOM(HID_ANY_ID) },
30313032
{ }

include/linux/hid.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,6 @@ struct hid_item {
312312
* Vendor specific HID device groups
313313
*/
314314
#define HID_GROUP_RMI 0x0100
315-
316-
/*
317-
* Vendor specific HID device groups
318-
*/
319315
#define HID_GROUP_WACOM 0x0101
320316

321317
/*

0 commit comments

Comments
 (0)