* [PATCH 1/2] HID: core: include product version in the uevent
@ 2026-11-26 15:39 Matteo Bruni
2026-11-26 15:39 ` [PATCH 2/2] samples: uhid: use a non-zero version Matteo Bruni
2026-11-26 15:50 ` [PATCH 1/2] HID: core: include product version in the uevent sashiko-bot
0 siblings, 2 replies; 4+ messages in thread
From: Matteo Bruni @ 2026-11-26 15:39 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, David Rheinsberg; +Cc: linux-input
Currently userspace can't really recover the device version for UHID
devices. Compared to e.g. a USB game controller, starting from the HID
device, one can recover the version from the PRODUCT uevent of the
parent USB node; there's no such parent for a UHID device.
This is going to be used by Wine, to be able to report the HID device
version for UHID devices. You can find the corresponding Wine patch at
https://gitlab.winehq.org/Mystral/wine/-/commit/5c2d90f7a4d13c92b10b5c4d82171d22951ea32b
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
---
drivers/hid/hid-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4a47deb9d..918db22e8 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -3004,6 +3004,10 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
return -ENOMEM;
}
+ if (add_uevent_var(env, "PRODUCT=%x/%x/%x/%x",
+ hdev->bus, hdev->vendor, hdev->product, hdev->version))
+ return -ENOMEM;
+
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] samples: uhid: use a non-zero version
2026-11-26 15:39 [PATCH 1/2] HID: core: include product version in the uevent Matteo Bruni
@ 2026-11-26 15:39 ` Matteo Bruni
2026-11-26 15:43 ` sashiko-bot
2026-11-26 15:50 ` [PATCH 1/2] HID: core: include product version in the uevent sashiko-bot
1 sibling, 1 reply; 4+ messages in thread
From: Matteo Bruni @ 2026-11-26 15:39 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, David Rheinsberg; +Cc: linux-input
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
---
samples/uhid/uhid-example.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/uhid/uhid-example.c b/samples/uhid/uhid-example.c
index 015cb06a2..1aa5667ed 100644
--- a/samples/uhid/uhid-example.c
+++ b/samples/uhid/uhid-example.c
@@ -185,7 +185,7 @@ static int create(int fd)
ev.u.create.bus = BUS_USB;
ev.u.create.vendor = 0x15d9;
ev.u.create.product = 0x0a37;
- ev.u.create.version = 0;
+ ev.u.create.version = 0x100;
ev.u.create.country = 0;
return uhid_write(fd, &ev);
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] samples: uhid: use a non-zero version
2026-11-26 15:39 ` [PATCH 2/2] samples: uhid: use a non-zero version Matteo Bruni
@ 2026-11-26 15:43 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-26 15:43 UTC (permalink / raw)
To: Matteo Bruni; +Cc: linux-input, dmitry.torokhov
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] samples: uhid: missing commit message body explaining version
change
--
commit b598874f0c3fc14bd39419791a866f90fe35b69e
Author: Matteo Bruni <mbruni@codeweavers.com>
> samples: uhid: use a non-zero version
>
> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
[Severity: Low]
The commit message body is empty. Could a short description be added
explaining why create() sets ev.u.create.version to 0x100 instead of 0?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126153925.9488-1-mbruni@codeweavers.com?part=2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] HID: core: include product version in the uevent
2026-11-26 15:39 [PATCH 1/2] HID: core: include product version in the uevent Matteo Bruni
2026-11-26 15:39 ` [PATCH 2/2] samples: uhid: use a non-zero version Matteo Bruni
@ 2026-11-26 15:50 ` sashiko-bot
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-26 15:50 UTC (permalink / raw)
To: Matteo Bruni; +Cc: linux-input, dmitry.torokhov
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: core: redundant unprefixed PRODUCT uevent in
hid_uevent()
--
commit f1a7bbe068e7bfcbcd219202f30241d7b9e0e8bc
Author: Matteo Bruni <mbruni@codeweavers.com>
HID: core: include product version in the uevent
This commit adds a PRODUCT variable containing the bus, vendor, product,
and version fields to the HID device uevent environment.
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 64ac7606927ca..6b71104aa3319 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -3003,6 +3003,10 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
> return -ENOMEM;
> }
>
> + if (add_uevent_var(env, "PRODUCT=%x/%x/%x/%x",
> + hdev->bus, hdev->vendor, hdev->product, hdev->version))
> + return -ENOMEM;
[Severity: Medium]
Does adding an unprefixed four-field PRODUCT variable to hid_uevent()
conflict with the parent USB device's PRODUCT uevent while duplicating
existing HID sysfs and uevent attributes?
For USB HID devices, usb_uevent() on the parent USB node emits a
three-field PRODUCT=%x/%x/%x (idVendor/idProduct/bcdDevice), whereas
usbhid_parse() sets hid->version to hdesc->bcdHID (the HID specification
version) before the HID device uevent is emitted. Consumers or udev rules
walking up parent devices from hidraw looking for USB's three-field
PRODUCT variable will hit this four-field bus/vendor/product/bcdHID value
on the child HID device first and misparse the fields.
In addition, other variables in hid_uevent() use the HID_ prefix (with
HID_ID already exporting bus, vendor, and product), and commit
cdf826a94e0f ("HID: core: Expose id attributes in sysfs") already exposes
hdev->version for all HID and UHID devices via the id/version sysfs
attribute.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126153925.9488-1-mbruni@codeweavers.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-26 15:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 15:39 [PATCH 1/2] HID: core: include product version in the uevent Matteo Bruni
2026-11-26 15:39 ` [PATCH 2/2] samples: uhid: use a non-zero version Matteo Bruni
2026-11-26 15:43 ` sashiko-bot
2026-11-26 15:50 ` [PATCH 1/2] HID: core: include product version in the uevent sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox