Skip to content

Commit e8403b4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: - 3rd generation Wacom Intuos BT device support from Aaron Armstrong Skomra - support for NSG-MR5U and NSG-MR7U devices from Todd Kelner - multitouch Razer Blade Stealth support from Benjamin Tissoires - Elantech touchpad support from Alexandrov Stansilav - a few other scattered-around fixes and cleanups to drivers and generic code * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (31 commits) HID: google: Enable PM Full On mode when adjusting backlight HID: google: add google hammer HID driver HID: core: reset the quirks before calling probe again HID: multitouch: do not set HID_QUIRK_NO_INIT_REPORTS HID: core: remove the need for HID_QUIRK_NO_EMPTY_INPUT HID: use BIT() macro for quirks too HID: use BIT macro instead of plain integers for flags HID: multitouch: remove dead zones of Razer Blade Stealth HID: multitouch: export a quirk for the button handling of touchpads HID: usbhid: extend the polling interval configuration to keyboards HID: ntrig: document sysfs interface HID: wacom: wacom_wac_collection() is local to wacom_wac.c HID: wacom: generic: add the "Report Valid" usage HID: wacom: generic: Support multiple tools per report HID: wacom: Add support for 3rd generation Intuos BT HID: core: rewrite the hid-generic automatic unbind HID: sony: Add touchpad support for NSG-MR5U and NSG-MR7U remotes HID: hid-multitouch: Use true and false for boolean values HID: hid-ntrig: use true and false for boolean values HID: logitech-hidpp: document sysfs interface ...
2 parents e02d37b + 9931753 commit e8403b4

27 files changed

+1180
-253
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
What: /sys/bus/hid/drivers/logitech-hidpp-device/<dev>/range
2+
Date: Jan, 2016
3+
KernelVersion: 4.6
4+
5+
Description:
6+
(RW) This attribute controls the amount of 'turn' permitted in
7+
Logitech G920 wheel. Reading from the file shows the current
8+
range of the steering wheel. Writing a value within the min and
9+
max boundary sets the range of the wheel.
10+
11+
What: /sys/bus/hid/drivers/logitech-hidpp-device/<dev>/builtin_power_supply
12+
Date: Apr, 2017
13+
KernelVersion: 4.12
14+
15+
Description:
16+
Presence of this file indicates that HID++ driver is capable of
17+
handling battery properties in the kernel. This way, upower can
18+
add a udev rule to decide whether or not it should use the
19+
internal unifying support or the generic kernel one.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
What: /sys/bus/hid/drivers/ntrig/<dev>/activate_slack
2+
Date: May, 2010
3+
KernelVersion: 2.6.35
4+
5+
Description:
6+
(RW) Number of contact frames ignored before acknowledging the
7+
start of activity (activating touch).
8+
9+
10+
What: /sys/bus/hid/drivers/ntrig/<dev>/decativate_slack
11+
Date: May, 2010
12+
KernelVersion: 2.6.35
13+
14+
Description:
15+
(RW) Number of empty (no contact) frames ignored before
16+
acknowledging the end of activity (deactivating touch).
17+
18+
When the last finger is removed from the device, it sends a
19+
number of empty frames. By holding off on deactivation for a few
20+
frames false erroneous disconnects can be tolerated, where the
21+
sensor may mistakenly not detect a finger that is still present.
22+
23+
24+
What: /sys/bus/hid/drivers/ntrig/<dev>/activation_width
25+
What: /sys/bus/hid/drivers/ntrig/<dev>/activation_height
26+
Date: May, 2010
27+
KernelVersion: 2.6.35
28+
29+
Description:
30+
Threholds to override activation slack.
31+
32+
activation_width: (RW) Width threshold to immediately
33+
start processing touch events.
34+
35+
activation_height: (RW) Height threshold to immediately
36+
start processing touch events.
37+
38+
39+
What: /sys/bus/hid/drivers/ntrig/<dev>/min_width
40+
What: /sys/bus/hid/drivers/ntrig/<dev>/min_height
41+
Date: May, 2010
42+
KernelVersion: 2.6.35
43+
44+
Description:
45+
Minimum size contact accepted.
46+
47+
min_width: (RW) Minimum touch contact width to decide
48+
activation and activity.
49+
50+
min_height: (RW) Minimum touch contact height to decide
51+
activation and activity.
52+
53+
54+
What: /sys/bus/hid/drivers/ntrig/<dev>/sensor_physical_width
55+
What: /sys/bus/hid/drivers/ntrig/<dev>/sensor_physical_height
56+
Date: May, 2010
57+
KernelVersion: 2.6.35
58+
59+
Description:
60+
(RO) These are internal ranges not used for normal events but
61+
useful for tuning.
62+
63+
64+
What: /sys/bus/hid/drivers/ntrig/<dev>/sensor_logical_width
65+
What: /sys/bus/hid/drivers/ntrig/<dev>/sensor_logical_height
66+
Date: May, 2010
67+
KernelVersion: 2.6.35
68+
69+
Description:
70+
(RO) The range for positions reported during activity.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,9 @@
44564456
usbhid.jspoll=
44574457
[USBHID] The interval which joysticks are to be polled at.
44584458

4459+
usbhid.kbpoll=
4460+
[USBHID] The interval which keyboards are to be polled at.
4461+
44594462
usb-storage.delay_use=
44604463
[UMS] The delay in seconds before a new device is
44614464
scanned for Logical Units (default 1).

drivers/hid/Kconfig

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,23 @@ config HID_EMS_FF
274274
Currently the following devices are known to be supported:
275275
- Trio Linker Plus II
276276

277+
config HID_ELAN
278+
tristate "ELAN USB Touchpad Support"
279+
depends on LEDS_CLASS && USB_HID
280+
---help---
281+
Say Y to enable support for the USB ELAN touchpad
282+
Currently the following devices are known to be supported:
283+
- HP Pavilion X2 10-p0XX.
284+
277285
config HID_ELECOM
278286
tristate "ELECOM HID devices"
279287
depends on HID
280288
---help---
281289
Support for ELECOM devices:
282290
- BM084 Bluetooth Mouse
283-
- EX-G Trackball (Wired and wireless)
284-
- DEFT Trackball (Wired and wireless)
285-
- HUGE Trackball (Wired and wireless)
291+
- EX-G Trackballs (M-XT3DRBK, M-XT3URBK)
292+
- DEFT Trackballs (M-DT1DRBK, M-DT1URBK, M-DT2DRBK, M-DT2URBK)
293+
- HUGE Trackballs (M-HT1DRBK, M-HT1URBK)
286294

287295
config HID_ELO
288296
tristate "ELO USB 4000/4500 touchscreen"
@@ -331,6 +339,12 @@ config HOLTEK_FF
331339
Say Y here if you have a Holtek On Line Grip based game controller
332340
and want to have force feedback support for it.
333341

342+
config HID_GOOGLE_HAMMER
343+
tristate "Google Hammer Keyboard"
344+
depends on USB_HID && LEDS_CLASS
345+
---help---
346+
Say Y here if you have a Google Hammer device.
347+
334348
config HID_GT683R
335349
tristate "MSI GT68xR LED support"
336350
depends on LEDS_CLASS && USB_HID

drivers/hid/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ obj-$(CONFIG_HID_CP2112) += hid-cp2112.o
3939
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
4040
obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o
4141
obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
42+
obj-$(CONFIG_HID_ELAN) += hid-elan.o
4243
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
4344
obj-$(CONFIG_HID_ELO) += hid-elo.o
4445
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
4546
obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
4647
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
48+
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
4749
obj-$(CONFIG_HID_GT683R) += hid-gt683r.o
4850
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
4951
obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o

drivers/hid/hid-asus.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,9 @@ static int asus_input_mapping(struct hid_device *hdev,
570570
static int asus_start_multitouch(struct hid_device *hdev)
571571
{
572572
int ret;
573-
const unsigned char buf[] = { FEATURE_REPORT_ID, 0x00, 0x03, 0x01, 0x00 };
573+
static const unsigned char buf[] = {
574+
FEATURE_REPORT_ID, 0x00, 0x03, 0x01, 0x00
575+
};
574576
unsigned char *dmabuf = kmemdup(buf, sizeof(buf), GFP_KERNEL);
575577

576578
if (!dmabuf) {
@@ -644,8 +646,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
644646
* All functionality is on a single HID interface and for
645647
* userspace the touchpad must be a separate input_dev.
646648
*/
647-
hdev->quirks |= HID_QUIRK_MULTI_INPUT |
648-
HID_QUIRK_NO_EMPTY_INPUT;
649+
hdev->quirks |= HID_QUIRK_MULTI_INPUT;
649650
drvdata->tp = &asus_t100chi_tp;
650651
}
651652

drivers/hid/hid-core.c

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
13651365
* of implement() working on 8 byte chunks
13661366
*/
13671367

1368-
int len = hid_report_len(report) + 7;
1368+
u32 len = hid_report_len(report) + 7;
13691369

13701370
return kmalloc(len, flags);
13711371
}
@@ -1430,7 +1430,7 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
14301430
{
14311431
char *buf;
14321432
int ret;
1433-
int len;
1433+
u32 len;
14341434

14351435
buf = hid_alloc_report_buf(report, GFP_KERNEL);
14361436
if (!buf)
@@ -1456,14 +1456,14 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
14561456
}
14571457
EXPORT_SYMBOL_GPL(__hid_request);
14581458

1459-
int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1459+
int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
14601460
int interrupt)
14611461
{
14621462
struct hid_report_enum *report_enum = hid->report_enum + type;
14631463
struct hid_report *report;
14641464
struct hid_driver *hdrv;
14651465
unsigned int a;
1466-
int rsize, csize = size;
1466+
u32 rsize, csize = size;
14671467
u8 *cdata = data;
14681468
int ret = 0;
14691469

@@ -1521,7 +1521,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
15211521
*
15221522
* This is data entry for lower layers.
15231523
*/
1524-
int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
1524+
int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
15251525
{
15261526
struct hid_report_enum *report_enum;
15271527
struct hid_driver *hdrv;
@@ -1966,6 +1966,8 @@ static int hid_device_probe(struct device *dev)
19661966
}
19671967
}
19681968

1969+
/* reset the quirks that has been previously set */
1970+
hdev->quirks = hid_lookup_quirk(hdev);
19691971
hdev->driver = hdrv;
19701972
if (hdrv->probe) {
19711973
ret = hdrv->probe(hdev, id);
@@ -2197,31 +2199,40 @@ void hid_destroy_device(struct hid_device *hdev)
21972199
EXPORT_SYMBOL_GPL(hid_destroy_device);
21982200

21992201

2200-
static int __bus_add_driver(struct device_driver *drv, void *data)
2202+
static int __hid_bus_reprobe_drivers(struct device *dev, void *data)
22012203
{
2202-
struct hid_driver *added_hdrv = data;
2203-
struct hid_driver *hdrv = to_hid_driver(drv);
2204+
struct hid_driver *hdrv = data;
2205+
struct hid_device *hdev = to_hid_device(dev);
22042206

2205-
if (hdrv->bus_add_driver)
2206-
hdrv->bus_add_driver(added_hdrv);
2207+
if (hdev->driver == hdrv &&
2208+
!hdrv->match(hdev, hid_ignore_special_drivers))
2209+
return device_reprobe(dev);
22072210

22082211
return 0;
22092212
}
22102213

2211-
static int __bus_removed_driver(struct device_driver *drv, void *data)
2214+
static int __hid_bus_driver_added(struct device_driver *drv, void *data)
22122215
{
2213-
struct hid_driver *removed_hdrv = data;
22142216
struct hid_driver *hdrv = to_hid_driver(drv);
22152217

2216-
if (hdrv->bus_removed_driver)
2217-
hdrv->bus_removed_driver(removed_hdrv);
2218+
if (hdrv->match) {
2219+
bus_for_each_dev(&hid_bus_type, NULL, hdrv,
2220+
__hid_bus_reprobe_drivers);
2221+
}
22182222

22192223
return 0;
22202224
}
22212225

2226+
static int __bus_removed_driver(struct device_driver *drv, void *data)
2227+
{
2228+
return bus_rescan_devices(&hid_bus_type);
2229+
}
2230+
22222231
int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
22232232
const char *mod_name)
22242233
{
2234+
int ret;
2235+
22252236
hdrv->driver.name = hdrv->name;
22262237
hdrv->driver.bus = &hid_bus_type;
22272238
hdrv->driver.owner = owner;
@@ -2230,9 +2241,13 @@ int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
22302241
INIT_LIST_HEAD(&hdrv->dyn_list);
22312242
spin_lock_init(&hdrv->dyn_lock);
22322243

2233-
bus_for_each_drv(&hid_bus_type, NULL, hdrv, __bus_add_driver);
2244+
ret = driver_register(&hdrv->driver);
2245+
2246+
if (ret == 0)
2247+
bus_for_each_drv(&hid_bus_type, NULL, NULL,
2248+
__hid_bus_driver_added);
22342249

2235-
return driver_register(&hdrv->driver);
2250+
return ret;
22362251
}
22372252
EXPORT_SYMBOL_GPL(__hid_register_driver);
22382253

drivers/hid/hid-corsair.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
* HID driver for Corsair devices
33
*
44
* Supported devices:
5+
* - Vengeance K70 Keyboard
6+
* - K70 RAPIDFIRE Keyboard
57
* - Vengeance K90 Keyboard
68
* - Scimitar PRO RGB Gaming Mouse
79
*
810
* Copyright (c) 2015 Clement Vuchener
911
* Copyright (c) 2017 Oscar Campos
12+
* Copyright (c) 2017 Aaron Bottegal
1013
*/
1114

1215
/*
@@ -673,15 +676,16 @@ static int corsair_input_mapping(struct hid_device *dev,
673676
}
674677

675678
/*
676-
* The report descriptor of Corsair Scimitar RGB Pro gaming mouse is
679+
* The report descriptor of some of the Corsair gaming mice is
677680
* non parseable as they define two consecutive Logical Minimum for
678681
* the Usage Page (Consumer) in rdescs bytes 75 and 77 being 77 0x16
679682
* that should be obviousy 0x26 for Logical Magimum of 16 bits. This
680683
* prevents poper parsing of the report descriptor due Logical
681684
* Minimum being larger than Logical Maximum.
682685
*
683686
* This driver fixes the report descriptor for:
684-
* - USB ID b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
687+
* - USB ID 1b1c:1b34, sold as GLAIVE RGB Gaming mouse
688+
* - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
685689
*/
686690

687691
static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -691,13 +695,14 @@ static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
691695

692696
if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
693697
/*
694-
* Corsair Scimitar RGB Pro report descriptor is broken and
695-
* defines two different Logical Minimum for the Consumer
696-
* Application. The byte 77 should be a 0x26 defining a 16
697-
* bits integer for the Logical Maximum but it is a 0x16
698+
* Corsair GLAIVE RGB and Scimitar RGB Pro report descriptor is
699+
* broken and defines two different Logical Minimum for the
700+
* Consumer Application. The byte 77 should be a 0x26 defining
701+
* a 16 bits integer for the Logical Maximum but it is a 0x16
698702
* instead (Logical Minimum)
699703
*/
700704
switch (hdev->product) {
705+
case USB_DEVICE_ID_CORSAIR_GLAIVE_RGB:
701706
case USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB:
702707
if (*rsize >= 172 && rdesc[75] == 0x15 && rdesc[77] == 0x16
703708
&& rdesc[78] == 0xff && rdesc[79] == 0x0f) {
@@ -715,8 +720,15 @@ static const struct hid_device_id corsair_devices[] = {
715720
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90),
716721
.driver_data = CORSAIR_USE_K90_MACRO |
717722
CORSAIR_USE_K90_BACKLIGHT },
723+
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
724+
USB_DEVICE_ID_CORSAIR_GLAIVE_RGB) },
718725
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
719726
USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
727+
/*
728+
* Vengeance K70 and K70 RAPIDFIRE share product IDs.
729+
*/
730+
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
731+
USB_DEVICE_ID_CORSAIR_K70R) },
720732
{}
721733
};
722734

0 commit comments

Comments
 (0)