diff options
| author | Benjamin Tissoires <bentiss@kernel.org> | 2025-08-21 16:38:13 +0200 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2025-09-12 17:11:55 +0200 |
| commit | 4e411a3f7bba10579bbeec3af77ae2a05c9e4259 (patch) | |
| tree | d5a702bf91deaf4c5cc5661ecde0e9991b3ff100 | |
| parent | Merge tag 'hid-for-linus-2025082901' of git://git.kernel.org/pub/scm/linux/ke... (diff) | |
| download | linux-4e411a3f7bba10579bbeec3af77ae2a05c9e4259.tar.gz linux-4e411a3f7bba10579bbeec3af77ae2a05c9e4259.zip | |
HID: core: factor out hid_set_group()
When we load a bpf, we can change the report descriptor. However, the
current implementation doesn't change the group meaning that we can not
rebind a device from hid-generic to hid-multitouch.
This is a preparatory patch to force a rescan of the device after the
bpf has been loaded.
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
| -rw-r--r-- | drivers/hid/hid-core.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 5419a6c10907..cf68fdffe058 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2708,6 +2708,20 @@ static bool hid_check_device_match(struct hid_device *hdev, return !hid_ignore_special_drivers && !(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER); } +static void hid_set_group(struct hid_device *hdev) +{ + int ret; + + if (hid_ignore_special_drivers) { + hdev->group = HID_GROUP_GENERIC; + } else if (!hdev->group && + !(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) { + ret = hid_scan_report(hdev); + if (ret) + hid_warn(hdev, "bad device descriptor (%d)\n", ret); + } +} + static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv) { const struct hid_device_id *id; @@ -2903,14 +2917,7 @@ int hid_add_device(struct hid_device *hdev) /* * Scan generic devices for group information */ - if (hid_ignore_special_drivers) { - hdev->group = HID_GROUP_GENERIC; - } else if (!hdev->group && - !(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) { - ret = hid_scan_report(hdev); - if (ret) - hid_warn(hdev, "bad device descriptor (%d)\n", ret); - } + hid_set_group(hdev); hdev->id = atomic_inc_return(&id); |
