Skip to content

Commit 4e411a3

Browse files
Benjamin TissoiresJiri Kosina
authored andcommitted
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>
1 parent 02d6eee commit 4e411a3

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

drivers/hid/hid-core.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,20 @@ static bool hid_check_device_match(struct hid_device *hdev,
27082708
return !hid_ignore_special_drivers && !(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER);
27092709
}
27102710

2711+
static void hid_set_group(struct hid_device *hdev)
2712+
{
2713+
int ret;
2714+
2715+
if (hid_ignore_special_drivers) {
2716+
hdev->group = HID_GROUP_GENERIC;
2717+
} else if (!hdev->group &&
2718+
!(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) {
2719+
ret = hid_scan_report(hdev);
2720+
if (ret)
2721+
hid_warn(hdev, "bad device descriptor (%d)\n", ret);
2722+
}
2723+
}
2724+
27112725
static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
27122726
{
27132727
const struct hid_device_id *id;
@@ -2903,14 +2917,7 @@ int hid_add_device(struct hid_device *hdev)
29032917
/*
29042918
* Scan generic devices for group information
29052919
*/
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-
}
2920+
hid_set_group(hdev);
29142921

29152922
hdev->id = atomic_inc_return(&id);
29162923

0 commit comments

Comments
 (0)