Commit 3ee420ba authored by Jiri Kosina's avatar Jiri Kosina

Merge branches 'for-3.18/upstream-fixes' and 'for-3.19/upstream' into for-linus

Conflicts:
	drivers/hid/hid-input.c
...@@ -629,7 +629,7 @@ config HID_ROCCAT ...@@ -629,7 +629,7 @@ config HID_ROCCAT
support for its special functionalities. support for its special functionalities.
config HID_SAITEK config HID_SAITEK
tristate "Saitek non-fully HID-compliant devices" tristate "Saitek (Mad Catz) non-fully HID-compliant devices"
depends on HID depends on HID
---help--- ---help---
Support for Saitek devices that are not fully compliant with the Support for Saitek devices that are not fully compliant with the
...@@ -637,6 +637,7 @@ config HID_SAITEK ...@@ -637,6 +637,7 @@ config HID_SAITEK
Supported devices: Supported devices:
- PS1000 Dual Analog Pad - PS1000 Dual Analog Pad
- R.A.T.9 Gaming Mouse
- R.A.T.7 Gaming Mouse - R.A.T.7 Gaming Mouse
- M.M.O.7 Gaming Mouse - M.M.O.7 Gaming Mouse
......
...@@ -779,16 +779,6 @@ static int hid_scan_report(struct hid_device *hid) ...@@ -779,16 +779,6 @@ static int hid_scan_report(struct hid_device *hid)
(hid->group == HID_GROUP_MULTITOUCH)) (hid->group == HID_GROUP_MULTITOUCH))
hid->group = HID_GROUP_MULTITOUCH_WIN_8; hid->group = HID_GROUP_MULTITOUCH_WIN_8;
/*
* Vendor specific handlings
*/
if ((hid->vendor == USB_VENDOR_ID_SYNAPTICS) &&
(hid->group == HID_GROUP_GENERIC) &&
/* only bind to the mouse interface of composite USB devices */
(hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
/* hid-rmi should take care of them, not hid-generic */
hid->group = HID_GROUP_RMI;
/* /*
* Vendor specific handlings * Vendor specific handlings
*/ */
...@@ -796,6 +786,13 @@ static int hid_scan_report(struct hid_device *hid) ...@@ -796,6 +786,13 @@ static int hid_scan_report(struct hid_device *hid)
case USB_VENDOR_ID_WACOM: case USB_VENDOR_ID_WACOM:
hid->group = HID_GROUP_WACOM; hid->group = HID_GROUP_WACOM;
break; break;
case USB_VENDOR_ID_SYNAPTICS:
if ((hid->group == HID_GROUP_GENERIC) &&
(hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
/* hid-rmi should only bind to the mouse interface of
* composite USB devices */
hid->group = HID_GROUP_RMI;
break;
} }
vfree(parser); vfree(parser);
...@@ -1910,6 +1907,7 @@ static const struct hid_device_id hid_have_special_driver[] = { ...@@ -1910,6 +1907,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
#endif #endif
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, { 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,7 +2537,8 @@ int hid_add_device(struct hid_device *hdev)
* Scan generic devices for group information * Scan generic devices for group information
*/ */
if (hid_ignore_special_drivers || if (hid_ignore_special_drivers ||
!hid_match_id(hdev, hid_have_special_driver)) { (!hdev->group &&
!hid_match_id(hdev, hid_have_special_driver))) {
ret = hid_scan_report(hdev); ret = hid_scan_report(hdev);
if (ret) if (ret)
hid_warn(hdev, "bad device descriptor (%d)\n", ret); hid_warn(hdev, "bad device descriptor (%d)\n", ret);
......
...@@ -621,6 +621,7 @@ ...@@ -621,6 +621,7 @@
#define USB_VENDOR_ID_MADCATZ 0x0738 #define USB_VENDOR_ID_MADCATZ 0x0738
#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
#define USB_DEVICE_ID_MADCATZ_RAT9 0x1709
#define USB_VENDOR_ID_MCC 0x09db #define USB_VENDOR_ID_MCC 0x09db
#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
......
...@@ -872,7 +872,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -872,7 +872,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;
default: goto ignore; default: map_key_clear(KEY_UNKNOWN);
} }
break; break;
......
...@@ -46,6 +46,7 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile) ...@@ -46,6 +46,7 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile)
static void kone_profile_report(struct kone_device *kone, uint new_profile) static void kone_profile_report(struct kone_device *kone, uint new_profile)
{ {
struct kone_roccat_report roccat_report; struct kone_roccat_report roccat_report;
roccat_report.event = kone_mouse_event_switch_profile; roccat_report.event = kone_mouse_event_switch_profile;
roccat_report.value = new_profile; roccat_report.value = new_profile;
roccat_report.key = 0; roccat_report.key = 0;
...@@ -163,6 +164,7 @@ static int kone_set_settings(struct usb_device *usb_dev, ...@@ -163,6 +164,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
struct kone_settings const *settings) struct kone_settings const *settings)
{ {
int retval; int retval;
retval = kone_send(usb_dev, kone_command_settings, retval = kone_send(usb_dev, kone_command_settings,
settings, sizeof(struct kone_settings)); settings, sizeof(struct kone_settings));
if (retval) if (retval)
...@@ -387,7 +389,7 @@ static struct bin_attribute bin_attr_profile##number = { \ ...@@ -387,7 +389,7 @@ static struct bin_attribute bin_attr_profile##number = { \
.read = kone_sysfs_read_profilex, \ .read = kone_sysfs_read_profilex, \
.write = kone_sysfs_write_profilex, \ .write = kone_sysfs_write_profilex, \
.private = &profile_numbers[number-1], \ .private = &profile_numbers[number-1], \
}; }
PROFILE_ATTR(1); PROFILE_ATTR(1);
PROFILE_ATTR(2); PROFILE_ATTR(2);
PROFILE_ATTR(3); PROFILE_ATTR(3);
...@@ -456,6 +458,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev, ...@@ -456,6 +458,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
static int kone_tcu_command(struct usb_device *usb_dev, int number) static int kone_tcu_command(struct usb_device *usb_dev, int number)
{ {
unsigned char value; unsigned char value;
value = number; value = number;
return kone_send(usb_dev, kone_command_calibrate, &value, 1); return kone_send(usb_dev, kone_command_calibrate, &value, 1);
} }
...@@ -697,10 +700,8 @@ static int kone_init_specials(struct hid_device *hdev) ...@@ -697,10 +700,8 @@ static int kone_init_specials(struct hid_device *hdev)
== USB_INTERFACE_PROTOCOL_MOUSE) { == USB_INTERFACE_PROTOCOL_MOUSE) {
kone = kzalloc(sizeof(*kone), GFP_KERNEL); kone = kzalloc(sizeof(*kone), GFP_KERNEL);
if (!kone) { if (!kone)
hid_err(hdev, "can't alloc device descriptor\n");
return -ENOMEM; return -ENOMEM;
}
hid_set_drvdata(hdev, kone); hid_set_drvdata(hdev, kone);
retval = kone_init_kone_device_struct(usb_dev, kone); retval = kone_init_kone_device_struct(usb_dev, kone);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* (This module is based on "hid-ortek".) * (This module is based on "hid-ortek".)
* Copyright (c) 2012 Andreas Hübner * Copyright (c) 2012 Andreas Hübner
* *
* R.A.T.7, M.M.O.7 (USB gaming mice): * R.A.T.7, R.A.T.9, M.M.O.7 (USB gaming mice):
* Fixes the mode button which cycles through three constantly pressed * Fixes the mode button which cycles through three constantly pressed
* buttons. All three press events are mapped to one button and the * buttons. All three press events are mapped to one button and the
* missing release event is generated immediately. * missing release event is generated immediately.
...@@ -179,6 +179,8 @@ static const struct hid_device_id saitek_devices[] = { ...@@ -179,6 +179,8 @@ static const struct hid_device_id saitek_devices[] = {
.driver_data = SAITEK_FIX_PS1000 }, .driver_data = SAITEK_FIX_PS1000 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
.driver_data = SAITEK_RELEASE_MODE_RAT7 }, .driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7),
.driver_data = SAITEK_RELEASE_MODE_MMO7 }, .driver_data = SAITEK_RELEASE_MODE_MMO7 },
{ } { }
......
...@@ -369,7 +369,7 @@ static int i2c_hid_hwreset(struct i2c_client *client) ...@@ -369,7 +369,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
static void i2c_hid_get_input(struct i2c_hid *ihid) static void i2c_hid_get_input(struct i2c_hid *ihid)
{ {
int ret, ret_size; int ret, ret_size;
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); int size = ihid->bufsize;
ret = i2c_master_recv(ihid->client, ihid->inbuf, size); ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
if (ret != size) { if (ret != size) {
......
...@@ -278,18 +278,20 @@ static void hid_irq_in(struct urb *urb) ...@@ -278,18 +278,20 @@ static void hid_irq_in(struct urb *urb)
usbhid->retry_delay = 0; usbhid->retry_delay = 0;
if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open) if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open)
break; break;
hid_input_report(urb->context, HID_INPUT_REPORT, if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
urb->transfer_buffer, hid_input_report(urb->context, HID_INPUT_REPORT,
urb->actual_length, 1); urb->transfer_buffer,
/* urb->actual_length, 1);
* autosuspend refused while keys are pressed /*
* because most keyboards don't wake up when * autosuspend refused while keys are pressed
* a key is released * because most keyboards don't wake up when
*/ * a key is released
if (hid_check_keys_pressed(hid)) */
set_bit(HID_KEYS_PRESSED, &usbhid->iofl); if (hid_check_keys_pressed(hid))
else set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
clear_bit(HID_KEYS_PRESSED, &usbhid->iofl); else
clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
}
break; break;
case -EPIPE: /* stall */ case -EPIPE: /* stall */
usbhid_mark_busy(usbhid); usbhid_mark_busy(usbhid);
...@@ -688,6 +690,7 @@ int usbhid_open(struct hid_device *hid) ...@@ -688,6 +690,7 @@ int usbhid_open(struct hid_device *hid)
goto done; goto done;
} }
usbhid->intf->needs_remote_wakeup = 1; usbhid->intf->needs_remote_wakeup = 1;
set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
res = hid_start_in(hid); res = hid_start_in(hid);
if (res) { if (res) {
if (res != -ENOSPC) { if (res != -ENOSPC) {
...@@ -701,6 +704,15 @@ int usbhid_open(struct hid_device *hid) ...@@ -701,6 +704,15 @@ int usbhid_open(struct hid_device *hid)
} }
} }
usb_autopm_put_interface(usbhid->intf); usb_autopm_put_interface(usbhid->intf);
/*
* In case events are generated while nobody was listening,
* some are released when the device is re-opened.
* Wait 50 msec for the queue to empty before allowing events
* to go through hid.
*/
msleep(50);
clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
} }
done: done:
mutex_unlock(&hid_open_mut); mutex_unlock(&hid_open_mut);
......
...@@ -52,6 +52,7 @@ struct usb_interface *usbhid_find_interface(int minor); ...@@ -52,6 +52,7 @@ struct usb_interface *usbhid_find_interface(int minor);
#define HID_STARTED 8 #define HID_STARTED 8
#define HID_KEYS_PRESSED 10 #define HID_KEYS_PRESSED 10
#define HID_NO_BANDWIDTH 11 #define HID_NO_BANDWIDTH 11
#define HID_RESUME_RUNNING 12
/* /*
* USB-specific HID struct, to be pointed to * USB-specific HID struct, to be pointed to
......
...@@ -70,22 +70,15 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, ...@@ -70,22 +70,15 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
static int wacom_open(struct input_dev *dev) static int wacom_open(struct input_dev *dev)
{ {
struct wacom *wacom = input_get_drvdata(dev); struct wacom *wacom = input_get_drvdata(dev);
int retval;
mutex_lock(&wacom->lock);
retval = hid_hw_open(wacom->hdev);
mutex_unlock(&wacom->lock);
return retval; return hid_hw_open(wacom->hdev);
} }
static void wacom_close(struct input_dev *dev) static void wacom_close(struct input_dev *dev)
{ {
struct wacom *wacom = input_get_drvdata(dev); struct wacom *wacom = input_get_drvdata(dev);
mutex_lock(&wacom->lock);
hid_hw_close(wacom->hdev); hid_hw_close(wacom->hdev);
mutex_unlock(&wacom->lock);
} }
/* /*
......
...@@ -3026,6 +3026,7 @@ const struct hid_device_id wacom_ids[] = { ...@@ -3026,6 +3026,7 @@ const struct hid_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x4004) }, { USB_DEVICE_WACOM(0x4004) },
{ USB_DEVICE_WACOM(0x5000) }, { USB_DEVICE_WACOM(0x5000) },
{ USB_DEVICE_WACOM(0x5002) }, { USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_LENOVO(0x6004) },
{ USB_DEVICE_WACOM(HID_ANY_ID) }, { USB_DEVICE_WACOM(HID_ANY_ID) },
{ } { }
......
...@@ -312,10 +312,6 @@ struct hid_item { ...@@ -312,10 +312,6 @@ struct hid_item {
* Vendor specific HID device groups * Vendor specific HID device groups
*/ */
#define HID_GROUP_RMI 0x0100 #define HID_GROUP_RMI 0x0100
/*
* Vendor specific HID device groups
*/
#define HID_GROUP_WACOM 0x0101 #define HID_GROUP_WACOM 0x0101
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment