Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matteo Bruni" <mbruni@codeweavers.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 1/2] HID: core: include product version in the uevent
Date: Thu, 26 Nov 2026 15:50:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-235847@kernel.org> (raw)
In-Reply-To: <20261126153925.9488-1-mbruni@codeweavers.com>

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

      parent reply	other threads:[~2026-11-26 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-235847@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mbruni@codeweavers.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox