Skip to content

Commit 54ba6d9

Browse files
committed
Merge tag 'hid-for-linus-2025093001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Benjamin Tissoires: - haptic touchpad support (Angela Czubak and Jonathan Denose) - support for audio jack handling on DualSense Playstation controllers (Cristian Ciocaltea) - allow HID-BPF to rebind a driver to hid-multitouch (Benjamin Tissoires) - rework hidraw ioctls to make them safer (and tested) (Benjamin Tissoires) - various PIDFF and universal-PIDFF fixes/improvements (Tomasz Pakuła) - better configuration of Intel QuickI2C through ACPI (Xinpeng Sun) - other assorted cleanups and fixes * tag 'hid-for-linus-2025093001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (58 commits) HID: playstation: Switch to scoped_guard() in {dualsense|dualshock4}_output_worker() HID: playstation: Silence sparse warnings for locking context imbalances HID: playstation: Update SP preamp gain comment line HID: intel-thc-hid: intel-quicki2c: support ACPI config for advanced features HID: core: Change hid_driver to use a const char* for name HID: hidraw: tighten ioctl command parsing selftests/hid: hidraw: forge wrong ioctls and tests them selftests/hid: hidraw: add more coverage for hidraw ioctls selftests/hid: update vmtest.sh for virtme-ng HID: playstation: Support DualSense audio jack event reporting HID: playstation: Support DualSense audio jack hotplug detection HID: playstation: Redefine DualSense input report status field HID: playstation: Prefer kzalloc(sizeof(*buf)...) HID: playstation: Document spinlock_t usage HID: playstation: Fix all alignment and line length issues HID: playstation: Correct spelling in comment sections HID: playstation: Replace uint{32,16,8}_t with u{32,16,8} HID: playstation: Simplify locking with guard() and scoped_guard() HID: playstation: Add spaces around arithmetic operators HID: playstation: Make use of bitfield macros ...
2 parents b664517 + cd37706 commit 54ba6d9

File tree

34 files changed

+3116
-1267
lines changed

34 files changed

+3116
-1267
lines changed

Documentation/input/event-codes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,20 @@ can report through the rotational axes (absolute and/or relative rx, ry, rz).
400400
All other axes retain their meaning. A device must not mix
401401
regular directional axes and accelerometer axes on the same event node.
402402

403+
INPUT_PROP_HAPTIC_TOUCHPAD
404+
--------------------------
405+
406+
The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that device:
407+
- supports simple haptic auto and manual triggering
408+
- can differentiate between at least 5 fingers
409+
- uses correct resolution for the X/Y (units and value)
410+
- reports correct force per touch, and correct units for them (newtons or grams)
411+
- follows the MT protocol type B
412+
413+
Summing up, such devices follow the MS spec for input devices in
414+
Win8 and Win8.1, and in addition support the Simple haptic controller HID table,
415+
and report correct units for the pressure.
416+
403417
Guidelines
404418
==========
405419

drivers/hid/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ config HID_GENERIC
9292

9393
If unsure, say Y.
9494

95+
config HID_HAPTIC
96+
tristate "Haptic touchpad support"
97+
default n
98+
help
99+
Support for touchpads with force sensors and haptic actuators instead of a
100+
traditional button.
101+
Adds extra parsing and FF device for the hid multitouch driver.
102+
It can be used for Elan 2703 haptic touchpad.
103+
104+
If unsure, say N.
105+
95106
menu "Special HID drivers"
96107

97108
config HID_A4TECH

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
hid-y := hid-core.o hid-input.o hid-quirks.o
66
hid-$(CONFIG_DEBUG_FS) += hid-debug.o
7+
hid-$(CONFIG_HID_HAPTIC) += hid-haptic.o
78

89
obj-$(CONFIG_HID_BPF) += bpf/
910

drivers/hid/hid-asus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,6 @@ static const struct hid_device_id asus_devices[] = {
13871387
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
13881388
USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
13891389
QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
1390-
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
1391-
USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3),
1392-
QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
13931390
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
13941391
USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR),
13951392
QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
@@ -1419,6 +1416,9 @@ static const struct hid_device_id asus_devices[] = {
14191416
* Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard
14201417
* part, while letting hid-multitouch.c handle the touchpad.
14211418
*/
1419+
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
1420+
USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_Z13_FOLIO),
1421+
QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
14221422
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
14231423
USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
14241424
{ }

drivers/hid/hid-core.c

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,15 @@ static int hid_scan_report(struct hid_device *hid)
943943
parser->device = hid;
944944
hid->group = HID_GROUP_GENERIC;
945945

946+
/*
947+
* In case we are re-scanning after a BPF has been loaded,
948+
* we need to use the bpf report descriptor, not the original one.
949+
*/
950+
if (hid->bpf_rdesc && hid->bpf_rsize) {
951+
start = hid->bpf_rdesc;
952+
end = start + hid->bpf_rsize;
953+
}
954+
946955
/*
947956
* The parsing is simpler than the one in hid_open_report() as we should
948957
* be robust against hid errors. Those errors will be raised by
@@ -2708,12 +2717,32 @@ static bool hid_check_device_match(struct hid_device *hdev,
27082717
return !hid_ignore_special_drivers && !(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER);
27092718
}
27102719

2720+
static void hid_set_group(struct hid_device *hdev)
2721+
{
2722+
int ret;
2723+
2724+
if (hid_ignore_special_drivers) {
2725+
hdev->group = HID_GROUP_GENERIC;
2726+
} else if (!hdev->group &&
2727+
!(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) {
2728+
ret = hid_scan_report(hdev);
2729+
if (ret)
2730+
hid_warn(hdev, "bad device descriptor (%d)\n", ret);
2731+
}
2732+
}
2733+
27112734
static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
27122735
{
27132736
const struct hid_device_id *id;
27142737
int ret;
27152738

27162739
if (!hdev->bpf_rsize) {
2740+
/* we keep a reference to the currently scanned report descriptor */
2741+
const __u8 *original_rdesc = hdev->bpf_rdesc;
2742+
2743+
if (!original_rdesc)
2744+
original_rdesc = hdev->dev_rdesc;
2745+
27172746
/* in case a bpf program gets detached, we need to free the old one */
27182747
hid_free_bpf_rdesc(hdev);
27192748

@@ -2723,6 +2752,12 @@ static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
27232752
/* call_hid_bpf_rdesc_fixup will always return a valid pointer */
27242753
hdev->bpf_rdesc = call_hid_bpf_rdesc_fixup(hdev, hdev->dev_rdesc,
27252754
&hdev->bpf_rsize);
2755+
2756+
/* the report descriptor changed, we need to re-scan it */
2757+
if (original_rdesc != hdev->bpf_rdesc) {
2758+
hdev->group = 0;
2759+
hid_set_group(hdev);
2760+
}
27262761
}
27272762

27282763
if (!hid_check_device_match(hdev, hdrv, &id))
@@ -2903,14 +2938,7 @@ int hid_add_device(struct hid_device *hdev)
29032938
/*
29042939
* Scan generic devices for group information
29052940
*/
2906-
if (hid_ignore_special_drivers) {
2907-
hdev->group = HID_GROUP_GENERIC;
2908-
} else if (!hdev->group &&
2909-
!(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) {
2910-
ret = hid_scan_report(hdev);
2911-
if (ret)
2912-
hid_warn(hdev, "bad device descriptor (%d)\n", ret);
2913-
}
2941+
hid_set_group(hdev);
29142942

29152943
hdev->id = atomic_inc_return(&id);
29162944

0 commit comments

Comments
 (0)