Skip to content

Commit c101e9b

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: - Logitech HID++ protocol support improvement from Filipe Laíns - probe fix for Logitech-G* devices from Hans de Goede - a few other small code cleanups and support for new device IDs * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: rmi: Simplify an error handling path in 'rmi_hid_read_block()' HID: intel-ish-hid: hbm.h: Replace zero-length array with flexible-array member HID: intel-ish-hid: ishtp-dev.h: Replace zero-length array with flexible-array member HID: Add driver fixing Glorious PC Gaming Race mouse report descriptor HID: lg-g15: Do not fail the probe when we fail to disable F# emulation HID: appleir: Use devm_kzalloc() instead of kzalloc() HID: appleir: Remove unnecessary goto label HID: logitech-dj: add support for the static device in the Powerplay mat/receiver HID: mcp2221: add usb to i2c-smbus host bridge HID: logitech-dj: add debug msg when exporting a HID++ report descriptors HID: quirks: Remove ITE 8595 entry from hid_have_special_driver
2 parents 69c1fd9 + 4f8a21a commit c101e9b

File tree

13 files changed

+878
-18
lines changed

13 files changed

+878
-18
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10295,6 +10295,13 @@ F: drivers/net/can/m_can/m_can.c
1029510295
F: drivers/net/can/m_can/m_can.h
1029610296
F: drivers/net/can/m_can/m_can_platform.c
1029710297

10298+
MCP2221A MICROCHIP USB-HID TO I2C BRIDGE DRIVER
10299+
M: Rishi Gupta <[email protected]>
10300+
10301+
10302+
S: Maintained
10303+
F: drivers/hid/hid-mcp2221.c
10304+
1029810305
MCP4018 AND MCP4531 MICROCHIP DIGITAL POTENTIOMETER DRIVERS
1029910306
M: Peter Rosin <[email protected]>
1030010307

drivers/hid/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ config HID_GFRM
362362
---help---
363363
Support for Google Fiber TV Box remote controls
364364

365+
config HID_GLORIOUS
366+
tristate "Glorious PC Gaming Race mice"
367+
depends on HID
368+
help
369+
Support for Glorious PC Gaming Race mice such as
370+
the Glorious Model O, O- and D.
371+
365372
config HID_HOLTEK
366373
tristate "Holtek HID devices"
367374
depends on USB_HID
@@ -1145,6 +1152,16 @@ config HID_ALPS
11451152
Say Y here if you have a Alps touchpads over i2c-hid or usbhid
11461153
and want support for its special functionalities.
11471154

1155+
config HID_MCP2221
1156+
tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support"
1157+
depends on USB_HID && I2C
1158+
---help---
1159+
Provides I2C and SMBUS host adapter functionality over USB-HID
1160+
through MCP2221 device.
1161+
1162+
To compile this driver as a module, choose M here: the module
1163+
will be called hid-mcp2221.ko.
1164+
11481165
endmenu
11491166

11501167
endif # HID

drivers/hid/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ obj-$(CONFIG_HID_ELO) += hid-elo.o
4848
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
4949
obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
5050
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
51+
obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o
5152
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
5253
obj-$(CONFIG_HID_GT683R) += hid-gt683r.o
5354
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
@@ -70,6 +71,7 @@ obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o
7071
obj-$(CONFIG_HID_MACALLY) += hid-macally.o
7172
obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
7273
obj-$(CONFIG_HID_MALTRON) += hid-maltron.o
74+
obj-$(CONFIG_HID_MCP2221) += hid-mcp2221.o
7375
obj-$(CONFIG_HID_MAYFLASH) += hid-mf.o
7476
obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
7577
obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o

drivers/hid/hid-appleir.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,9 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
283283
int ret;
284284
struct appleir *appleir;
285285

286-
appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL);
287-
if (!appleir) {
288-
ret = -ENOMEM;
289-
goto allocfail;
290-
}
286+
appleir = devm_kzalloc(&hid->dev, sizeof(struct appleir), GFP_KERNEL);
287+
if (!appleir)
288+
return -ENOMEM;
291289

292290
appleir->hid = hid;
293291

@@ -313,8 +311,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
313311

314312
return 0;
315313
fail:
316-
kfree(appleir);
317-
allocfail:
314+
devm_kfree(&hid->dev, appleir);
318315
return ret;
319316
}
320317

@@ -323,7 +320,6 @@ static void appleir_remove(struct hid_device *hid)
323320
struct appleir *appleir = hid_get_drvdata(hid);
324321
hid_hw_stop(hid);
325322
del_timer_sync(&appleir->key_up_timer);
326-
kfree(appleir);
327323
}
328324

329325
static const struct hid_device_id appleir_devices[] = {

drivers/hid/hid-glorious.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* USB HID driver for Glorious PC Gaming Race
4+
* Glorious Model O, O- and D mice.
5+
*
6+
* Copyright (c) 2020 Samuel Čavoj <[email protected]>
7+
*/
8+
9+
/*
10+
*/
11+
12+
#include <linux/hid.h>
13+
#include <linux/module.h>
14+
15+
#include "hid-ids.h"
16+
17+
MODULE_AUTHOR("Samuel Čavoj <[email protected]>");
18+
MODULE_DESCRIPTION("HID driver for Glorious PC Gaming Race mice");
19+
20+
/*
21+
* Glorious Model O and O- specify the const flag in the consumer input
22+
* report descriptor, which leads to inputs being ignored. Fix this
23+
* by patching the descriptor.
24+
*/
25+
static __u8 *glorious_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26+
unsigned int *rsize)
27+
{
28+
if (*rsize == 213 &&
29+
rdesc[84] == 129 && rdesc[112] == 129 && rdesc[140] == 129 &&
30+
rdesc[85] == 3 && rdesc[113] == 3 && rdesc[141] == 3) {
31+
hid_info(hdev, "patching Glorious Model O consumer control report descriptor\n");
32+
rdesc[85] = rdesc[113] = rdesc[141] = \
33+
HID_MAIN_ITEM_VARIABLE | HID_MAIN_ITEM_RELATIVE;
34+
}
35+
return rdesc;
36+
}
37+
38+
static void glorious_update_name(struct hid_device *hdev)
39+
{
40+
const char *model = "Device";
41+
42+
switch (hdev->product) {
43+
case USB_DEVICE_ID_GLORIOUS_MODEL_O:
44+
model = "Model O"; break;
45+
case USB_DEVICE_ID_GLORIOUS_MODEL_D:
46+
model = "Model D"; break;
47+
}
48+
49+
snprintf(hdev->name, sizeof(hdev->name), "%s %s", "Glorious", model);
50+
}
51+
52+
static int glorious_probe(struct hid_device *hdev,
53+
const struct hid_device_id *id)
54+
{
55+
int ret;
56+
57+
hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
58+
59+
ret = hid_parse(hdev);
60+
if (ret)
61+
return ret;
62+
63+
glorious_update_name(hdev);
64+
65+
return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
66+
}
67+
68+
static const struct hid_device_id glorious_devices[] = {
69+
{ HID_USB_DEVICE(USB_VENDOR_ID_GLORIOUS,
70+
USB_DEVICE_ID_GLORIOUS_MODEL_O) },
71+
{ HID_USB_DEVICE(USB_VENDOR_ID_GLORIOUS,
72+
USB_DEVICE_ID_GLORIOUS_MODEL_D) },
73+
{ }
74+
};
75+
MODULE_DEVICE_TABLE(hid, glorious_devices);
76+
77+
static struct hid_driver glorious_driver = {
78+
.name = "glorious",
79+
.id_table = glorious_devices,
80+
.probe = glorious_probe,
81+
.report_fixup = glorious_report_fixup
82+
};
83+
84+
module_hid_driver(glorious_driver);
85+
86+
MODULE_LICENSE("GPL");

drivers/hid/hid-ids.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@
464464
#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a
465465
#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100
466466

467+
#define USB_VENDOR_ID_GLORIOUS 0x258a
468+
#define USB_DEVICE_ID_GLORIOUS_MODEL_D 0x0033
469+
#define USB_DEVICE_ID_GLORIOUS_MODEL_O 0x0036
470+
467471
#define I2C_VENDOR_ID_GOODIX 0x27c6
468472
#define I2C_DEVICE_ID_GOODIX_01F0 0x01f0
469473

@@ -821,6 +825,7 @@
821825
#define USB_DEVICE_ID_PICK16F1454 0x0042
822826
#define USB_DEVICE_ID_PICK16F1454_V2 0xf2f7
823827
#define USB_DEVICE_ID_LUXAFOR 0xf372
828+
#define USB_DEVICE_ID_MCP2221 0x00dd
824829

825830
#define USB_VENDOR_ID_MICROSOFT 0x045e
826831
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b

drivers/hid/hid-lg-g15.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,10 @@ static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id)
803803
}
804804

805805
if (ret < 0) {
806-
hid_err(hdev, "Error disabling keyboard emulation for the G-keys\n");
807-
goto error_hw_stop;
806+
hid_err(hdev, "Error %d disabling keyboard emulation for the G-keys, falling back to generic hid-input driver\n",
807+
ret);
808+
hid_set_drvdata(hdev, NULL);
809+
return 0;
808810
}
809811

810812
/* Get initial brightness levels */

drivers/hid/hid-logitech-dj.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#include <asm/unaligned.h>
1717
#include "hid-ids.h"
1818

19-
#define DJ_MAX_PAIRED_DEVICES 6
19+
#define DJ_MAX_PAIRED_DEVICES 7
2020
#define DJ_MAX_NUMBER_NOTIFS 8
2121
#define DJ_RECEIVER_INDEX 0
2222
#define DJ_DEVICE_INDEX_MIN 1
23-
#define DJ_DEVICE_INDEX_MAX 6
23+
#define DJ_DEVICE_INDEX_MAX 7
2424

2525
#define DJREPORT_SHORT_LENGTH 15
2626
#define DJREPORT_LONG_LENGTH 32
@@ -980,6 +980,11 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev,
980980
break;
981981
}
982982

983+
/* custom receiver device (eg. powerplay) */
984+
if (hidpp_report->device_index == 7) {
985+
workitem.reports_supported |= HIDPP;
986+
}
987+
983988
if (workitem.type == WORKITEM_TYPE_EMPTY) {
984989
hid_warn(hdev,
985990
"unusable device of type %s (0x%02x) connected on slot %d",
@@ -1368,6 +1373,8 @@ static int logi_dj_ll_parse(struct hid_device *hid)
13681373
}
13691374

13701375
if (djdev->reports_supported & HIDPP) {
1376+
dbg_hid("%s: sending a HID++ descriptor, reports_supported: %llx\n",
1377+
__func__, djdev->reports_supported);
13711378
rdcat(rdesc, &rsize, hidpp_descriptor,
13721379
sizeof(hidpp_descriptor));
13731380
}

0 commit comments

Comments
 (0)