Re: [PATCH v3 1/4] HID: generic: Respect specialized drivers match callbacks
From: Vas Zayarskiy
Date: Tue Sep 15 2026 - 01:23:27 EST
Hi Guenter,
> That was from 2022 and seems to have been abandoned, making me wonder
> if it is still broken for Logitech devices or if another solution
> was found.
The 2022 ->match() change was proposed to repair the fallback problem exposed by wildcard enrollment of Logitech Bluetooth devices. Maintainers instead reverted that wildcard enrollment in a9d9e46c755a, restoring the previous explicit device matching (https://github.com/torvalds/linux/commit/a9d9e46c755a189ccb44d91b8cf737742a975de8). The way I understand it, the wildcard enrollment was reverted, and that's why the ->match() change simply was not needed anymore.
In the hwmon-next base used for this series, Bluetooth devices are still selected through explicit entries in hidpp_devices[], and hid-logitech-hidpp has no match callback. So the Logitech regression was resolved without adopting the generic matching change.
For AMPINEL, the reason for patch 1 is to leave its separate keyboard interface bound to hid-generic, so it can issue e.g. shutdown commands on abnormal readings. Both interfaces match the hwmon driver's ID table. The existing __check_hid_generic() therefore rejects the keyboard even when the hwmon match callback declines that interface. The hwmon fixes and sensor readings do not depend on this HID change; it is needed by this design to preserve the keyboard's generic binding.
Jiri, Benjamin: is there a preferred way to express this per-interface selection while retaining hid-generic for the keyboard? I would welcome guidance on whether this callback check is the appropriate approach.
Thanks,
Vas
On Tuesday, September 15th, 2026 at 7:31 AM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> On 9/14/26 16:37, Vas Zayarskiy wrote:
> > A driver can reject an interface in its match callback even when its ID
> > table matches. hid-generic currently yields based on the ID table alone,
> > leaving such an interface without a driver.
> >
> > Consult the callback after matching the ID table so hid-generic can keep
> > interfaces declined by specialized drivers. This allows the AMPINEL
> > hwmon driver to leave the separate keyboard interface to hid-generic.
> >
> > The same callback check was proposed previously for Logitech devices:
> >
> > Link: https://lkml.iu.edu/hypermail/linux/kernel/2212.0/06724.html
>
> That was from 2022 and seems to have been abandoned, making me wonder
> if it is still broken for Logitech devices or if another solution
> was found.
>
> Guenter
>
> >
> > Assisted-by: LLM sparse
> > Signed-off-by: Vas Zayarskiy <contact@xxxxxxxxx>
> > ---
> > drivers/hid/hid-generic.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-generic.c b/drivers/hid/hid-generic.c
> > index c2de91674..ebc38ae76 100644
> > --- a/drivers/hid/hid-generic.c
> > +++ b/drivers/hid/hid-generic.c
> > @@ -31,7 +31,13 @@ static int __check_hid_generic(struct device_driver *drv, void *data)
> > if (hdrv == &hid_generic)
> > return 0;
> >
> > - return hid_match_device(hdev, hdrv) != NULL;
> > + if (!hid_match_device(hdev, hdrv))
> > + return 0;
> > +
> > + if (hdrv->match)
> > + return hdrv->match(hdev, false);
> > +
> > + return 1;
> > }
> >
> > static bool hid_generic_match(struct hid_device *hdev,
>
>