Skip to content

Commit b7b8e36

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - fix for some modern devices that return multi-byte battery report, from Grant Likely - fix for devices with Resolution Multiplier, from Peter Hutterer - device probing speed increase, from Dmitry Torokhov - ThinkPad 10 Ultrabook Keyboard support, from Hans de Goede - other small assorted fixes and device ID additions * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: quirks: add NOGET quirk for Logitech GROUP HID: Replace HTTP links with HTTPS ones HID: udraw-ps3: Replace HTTP links with HTTPS ones HID: mcp2221: Replace HTTP links with HTTPS ones HID: input: Fix devices that return multiple bytes in battery report HID: lenovo: Fix spurious F23 key press report during resume from suspend HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard fn_lock support HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support HID: lenovo: Rename fn_lock sysfs attr handlers to make them generic HID: lenovo: Factor out generic parts of the LED code HID: lenovo: Merge tpkbd and cptkbd data structures HID: intel-ish-hid: Replace PCI_DEV_FLAGS_NO_D3 with pci_save_state HID: Wiimote: Treat the d-pad as an analogue stick HID: input: do not run GET_REPORT unless there's a Resolution Multiplier HID: usbhid: remove redundant assignment to variable retval HID: usbhid: do not sleep when opening device
2 parents fc80c51 + e6b6e19 commit b7b8e36

File tree

14 files changed

+404
-150
lines changed

14 files changed

+404
-150
lines changed

drivers/hid/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ config HID
2020
removed from the HID bus by the transport-layer drivers, such as
2121
usbhid (USB_HID) and hidp (BT_HIDP).
2222

23-
For docs and specs, see http://www.usb.org/developers/hidpage/
23+
For docs and specs, see https://www.usb.org/developers/hidpage/
2424

2525
If unsure, say Y.
2626

drivers/hid/hid-cp2112.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* host communicates with the CP2112 via raw HID reports.
1212
*
1313
* Data Sheet:
14-
* http://www.silabs.com/Support%20Documents/TechnicalDocs/CP2112.pdf
14+
* https://www.silabs.com/Support%20Documents/TechnicalDocs/CP2112.pdf
1515
* Programming Interface Specification:
1616
* https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
1717
*/

drivers/hid/hid-ids.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@
724724
#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
725725
#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
726726
#define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049
727+
#define USB_DEVICE_ID_LENOVO_TP10UBKBD 0x6062
727728
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
728729
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
729730
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d
@@ -773,6 +774,7 @@
773774
#define USB_DEVICE_ID_LOGITECH_G27_WHEEL 0xc29b
774775
#define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c
775776
#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
777+
#define USB_DEVICE_ID_LOGITECH_GROUP_AUDIO 0x0882
776778
#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
777779
#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517
778780
#define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512

drivers/hid/hid-input.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ static int hidinput_query_battery_capacity(struct hid_device *dev)
350350
u8 *buf;
351351
int ret;
352352

353-
buf = kmalloc(2, GFP_KERNEL);
353+
buf = kmalloc(4, GFP_KERNEL);
354354
if (!buf)
355355
return -ENOMEM;
356356

357-
ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 2,
357+
ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 4,
358358
dev->battery_report_type, HID_REQ_GET_REPORT);
359-
if (ret != 2) {
359+
if (ret < 2) {
360360
kfree(buf);
361361
return -ENODATA;
362362
}
@@ -1560,21 +1560,12 @@ static bool __hidinput_change_resolution_multipliers(struct hid_device *hid,
15601560
{
15611561
struct hid_usage *usage;
15621562
bool update_needed = false;
1563+
bool get_report_completed = false;
15631564
int i, j;
15641565

15651566
if (report->maxfield == 0)
15661567
return false;
15671568

1568-
/*
1569-
* If we have more than one feature within this report we
1570-
* need to fill in the bits from the others before we can
1571-
* overwrite the ones for the Resolution Multiplier.
1572-
*/
1573-
if (report->maxfield > 1) {
1574-
hid_hw_request(hid, report, HID_REQ_GET_REPORT);
1575-
hid_hw_wait(hid);
1576-
}
1577-
15781569
for (i = 0; i < report->maxfield; i++) {
15791570
__s32 value = use_logical_max ?
15801571
report->field[i]->logical_maximum :
@@ -1593,6 +1584,25 @@ static bool __hidinput_change_resolution_multipliers(struct hid_device *hid,
15931584
if (usage->hid != HID_GD_RESOLUTION_MULTIPLIER)
15941585
continue;
15951586

1587+
/*
1588+
* If we have more than one feature within this
1589+
* report we need to fill in the bits from the
1590+
* others before we can overwrite the ones for the
1591+
* Resolution Multiplier.
1592+
*
1593+
* But if we're not allowed to read from the device,
1594+
* we just bail. Such a device should not exist
1595+
* anyway.
1596+
*/
1597+
if (!get_report_completed && report->maxfield > 1) {
1598+
if (hid->quirks & HID_QUIRK_NO_INIT_REPORTS)
1599+
return update_needed;
1600+
1601+
hid_hw_request(hid, report, HID_REQ_GET_REPORT);
1602+
hid_hw_wait(hid);
1603+
get_report_completed = true;
1604+
}
1605+
15961606
report->field[i]->value[j] = value;
15971607
update_needed = true;
15981608
}

0 commit comments

Comments
 (0)