Summary: | hidraw(4) lacks support for USB_GET_DEVICEINFO | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Michael Gmelin <grembo> | ||||||
Component: | kern | Assignee: | Vladimir Kondratyev <wulf> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | markj | ||||||
Priority: | --- | Flags: | linimon:
mfc-stable13?
|
||||||
Version: | 13.1-RELEASE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
See Also: | https://reviews.freebsd.org/D41639 | ||||||||
Attachments: |
|
Description
Michael Gmelin
2022-06-23 10:51:02 UTC
Created attachment 236789 [details]
HIDRAW_DEVINFO ioctl support
Please test attached patch
Created attachment 236791 [details]
HIDRAW_GET_DEVICEINFO.patch
Actually, uhid(4) uses USB_DEVINFO alias called USB_GET_DEVICEINFO rather than USB_DEVINFO itself.
Patch updated.
Is retrieving of vendor and product name in distinct fields strictly necessary? Evdev device name which is exposed as USB_GET_DEVICEINFO`s product name in this patch is a composition of both USB vendor and product strings. (In reply to Vladimir Kondratyev from comment #3) It would be really helpful if it was possible (since the vendor/product distinction is very common and not having it means hacky patches like "Vendor=FreeBSD Product=Some Manufcaturer's device called XYZ" (In reply to Michael Gmelin from comment #4) The patch exposes HID device name as USB_GET_DEVICEINFO's product name. In usbhid(4) case device name is a concatenation of vendor string and product string. See line 745 of sys/dev/usb/input/usbhid.c. That means that hidraw(4) and uhid(4) exports the same data but uses different format hidraw format: Product: USB vendor string + USB product string Vendor: device_nameunit() uhid format: Product: USB product string Vendor: USB vendor string I can add support for uhid style USB_GET_DEVICEINFO product/vendor format for Yubico devices through direct call to ugen_fill_deviceinfo() for compatibility reasons, but I see no reasons to do that for all USB devices. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f1d955be2a7367ef755d70257c381f83b8367288 commit f1d955be2a7367ef755d70257c381f83b8367288 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2023-08-06 11:51:08 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2023-08-06 11:51:08 +0000 hidraw(4): Implement HIDRAW_GET_DEVICEINFO ioctl In commit c77bfaa75051 uhid(4) gained support for ioctl from USB_GET_DEVICEINFO. This is used in libraries like libfido2 to retrieve information about a device. This commit adds binary compatible version to hidraw(4). PR: 264843 MFC after: 1 month Requested by: grembo share/man/man4/hidraw.4 | 5 ++++- sys/dev/hid/hidraw.c | 28 +++++++++++++++++++++++----- sys/dev/hid/hidraw.h | 15 +++++++++++++++ sys/dev/usb/usb_ioctl.h | 3 ++- 4 files changed, 44 insertions(+), 7 deletions(-) Is there anything left to do for this PR? ^Triage: now see https://reviews.freebsd.org/D41639 . Leaving open only for MFC possibility. A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2e009b460fe5ddbac96e12a9c3ca05bae11817bf commit 2e009b460fe5ddbac96e12a9c3ca05bae11817bf Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2023-08-06 11:51:08 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2024-02-09 20:59:37 +0000 hidraw(4): Implement HIDRAW_GET_DEVICEINFO ioctl In commit c77bfaa75051 uhid(4) gained support for ioctl from USB_GET_DEVICEINFO. This is used in libraries like libfido2 to retrieve information about a device. This commit adds binary compatible version to hidraw(4). PR: 264843 (cherry picked from commit f1d955be2a7367ef755d70257c381f83b8367288) share/man/man4/hidraw.4 | 5 ++++- sys/dev/hid/hidraw.c | 28 +++++++++++++++++++++++----- sys/dev/hid/hidraw.h | 15 +++++++++++++++ sys/dev/usb/usb_ioctl.h | 3 ++- 4 files changed, 44 insertions(+), 7 deletions(-) I have no intention to implement exact copy of USB_GET_DEVICEINFO ioctl in hidraw. It will be done in separate u2f driver. See https://reviews.freebsd.org/D41639 |