* [PATCH 1/4] HID: i2c-hid: Use wVersionID for device version
2026-03-13 17:56 [PATCH 0/4] HID: Use wVersionID for device version Daniel Schaefer
@ 2026-03-13 17:56 ` Daniel Schaefer
2026-03-13 17:56 ` [PATCH 2/4] HID: goodix-spi: Use version_id " Daniel Schaefer
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Daniel Schaefer @ 2026-03-13 17:56 UTC (permalink / raw)
To: linux-input; +Cc: Daniel Schaefer, Jiri Kosina, Benjamin Tissoires, linux
Use wVersionID instead of bcdVersion for hid->version. Per the HID
over I2C Protocol Specification (Rev 1.0, Section 4.2), the HID
descriptor contains two version fields with distinct purposes:
- bcdVersion: HID specification version (always 0x0100 for HID 1.0)
- wVersionID: Device-specific version number
The current code incorrectly uses bcdVersion, which always reports
the HID spec version rather than the actual device/firmware version.
This change aligns I2C HID behavior with USB HID, which correctly
uses bcdDevice (the device version) for hid->version.
Currently wVersionID is not exposed to userspace at all. It is useful
because some firmwares use this as their firmware version. It's not
possible to check those device's firmware version on Linux, only
Windows.
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org
Cc: linux@frame.work
Signed-off-by: Daniel Schaefer <dhs@frame.work>
---
drivers/hid/i2c-hid/i2c-hid-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 5a183af3d5c6..41327e32f359 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -1056,7 +1056,7 @@ static int __i2c_hid_core_probe(struct i2c_hid *ihid)
return ret;
}
- hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
+ hid->version = le16_to_cpu(ihid->hdesc.wVersionID);
hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
hid->product = le16_to_cpu(ihid->hdesc.wProductID);
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] HID: goodix-spi: Use version_id for device version
2026-03-13 17:56 [PATCH 0/4] HID: Use wVersionID for device version Daniel Schaefer
2026-03-13 17:56 ` [PATCH 1/4] HID: i2c-hid: " Daniel Schaefer
@ 2026-03-13 17:56 ` Daniel Schaefer
2026-03-13 17:56 ` [PATCH 3/4] HID: surface: Use device version instead of HID spec version Daniel Schaefer
2026-03-13 17:56 ` [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent Daniel Schaefer
3 siblings, 0 replies; 7+ messages in thread
From: Daniel Schaefer @ 2026-03-13 17:56 UTC (permalink / raw)
To: linux-input
Cc: Daniel Schaefer, Charles Wang, Jiri Kosina, Benjamin Tissoires
Use version_id instead of bcd_version for hid->version. The HID
descriptor contains two version fields:
- bcd_version: HID specification version (e.g., 0x0100 for HID 1.0)
- version_id: Device-specific version number
The current code incorrectly uses bcd_version, which reports the HID
spec version rather than the actual device/firmware version.
Cc: Charles Wang <charles.goodix@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Daniel Schaefer <dhs@frame.work>
---
drivers/hid/hid-goodix-spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c
index 80c0288a3a38..cbe95e0f6ce4 100644
--- a/drivers/hid/hid-goodix-spi.c
+++ b/drivers/hid/hid-goodix-spi.c
@@ -653,7 +653,7 @@ static int goodix_hid_init(struct goodix_ts_data *ts)
hid->bus = BUS_SPI;
hid->dev.parent = &ts->spi->dev;
- hid->version = le16_to_cpu(ts->hid_desc.bcd_version);
+ hid->version = le16_to_cpu(ts->hid_desc.version_id);
hid->vendor = le16_to_cpu(ts->hid_desc.vendor_id);
hid->product = le16_to_cpu(ts->hid_desc.product_id);
snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", "hid-gdix",
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] HID: surface: Use device version instead of HID spec version
2026-03-13 17:56 [PATCH 0/4] HID: Use wVersionID for device version Daniel Schaefer
2026-03-13 17:56 ` [PATCH 1/4] HID: i2c-hid: " Daniel Schaefer
2026-03-13 17:56 ` [PATCH 2/4] HID: goodix-spi: Use version_id " Daniel Schaefer
@ 2026-03-13 17:56 ` Daniel Schaefer
2026-03-13 17:56 ` [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent Daniel Schaefer
3 siblings, 0 replies; 7+ messages in thread
From: Daniel Schaefer @ 2026-03-13 17:56 UTC (permalink / raw)
To: linux-input
Cc: Daniel Schaefer, Maximilian Luz, Jiri Kosina, Benjamin Tissoires
Use attrs.version instead of hid_desc.hid_version for hid->version.
The driver has two structures with version information:
- hid_desc.hid_version: HID specification version
- attrs.version: Device-specific version number
The current code incorrectly uses hid_version from the HID descriptor,
which reports the HID spec version rather than the actual device
version. This change aligns with how other HID drivers report device
version and matches the attrs structure which already provides vendor
and product IDs.
Cc: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Daniel Schaefer <dhs@frame.work>
---
drivers/hid/surface-hid/surface_hid_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/surface-hid/surface_hid_core.c b/drivers/hid/surface-hid/surface_hid_core.c
index 6690c24f28f0..e31d6597bc9b 100644
--- a/drivers/hid/surface-hid/surface_hid_core.c
+++ b/drivers/hid/surface-hid/surface_hid_core.c
@@ -206,7 +206,7 @@ int surface_hid_device_add(struct surface_hid_device *shid)
shid->hid->bus = BUS_HOST;
shid->hid->vendor = get_unaligned_le16(&shid->attrs.vendor);
shid->hid->product = get_unaligned_le16(&shid->attrs.product);
- shid->hid->version = get_unaligned_le16(&shid->hid_desc.hid_version);
+ shid->hid->version = get_unaligned_le16(&shid->attrs.version);
shid->hid->country = shid->hid_desc.country_code;
snprintf(shid->hid->name, sizeof(shid->hid->name), "Microsoft Surface %04X:%04X",
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent
2026-03-13 17:56 [PATCH 0/4] HID: Use wVersionID for device version Daniel Schaefer
` (2 preceding siblings ...)
2026-03-13 17:56 ` [PATCH 3/4] HID: surface: Use device version instead of HID spec version Daniel Schaefer
@ 2026-03-13 17:56 ` Daniel Schaefer
2026-03-13 17:59 ` Mario Limonciello
3 siblings, 1 reply; 7+ messages in thread
From: Daniel Schaefer @ 2026-03-13 17:56 UTC (permalink / raw)
To: linux-input
Cc: Daniel Schaefer, Richard Hughes, Mario Limonciello, Jiri Kosina,
Benjamin Tissoires, linux
Expose the HID device version to userspace via the new
HID_FIRMWARE_VERSION uevent property. This enables userspace tools
(such as fwupd and hidapi) to retrieve device firmware version
information, providing parity with Windows HidD_GetAttributes() API
which returns VID, PID, and VersionNumber.
The version is exported as a 4-digit uppercase hexadecimal value
(e.g., "0100" for version 1.0), consistent with how USB devices
report bcdDevice.
fwupd can handle this since:
https://github.com/fwupd/fwupd/commit/fb0d4cc98abe253003ea0e1837277fd42971e0de
But the kernel hasn't yet exposed this.
hidapi patch is in-flight: https://github.com/libusb/hidapi/pull/777
Cc: Richard Hughes <richard@hughsie.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: linux@frame.work
Signed-off-by: Daniel Schaefer <dhs@frame.work>
---
drivers/hid/hid-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index da57cbf0af26..c2075d5b40c3 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2884,6 +2884,9 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq))
return -ENOMEM;
+ if (add_uevent_var(env, "HID_FIRMWARE_VERSION=%04X", hdev->version))
+ return -ENOMEM;
+
if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
hdev->bus, hdev->group, hdev->vendor, hdev->product))
return -ENOMEM;
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent
2026-03-13 17:56 ` [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent Daniel Schaefer
@ 2026-03-13 17:59 ` Mario Limonciello
2026-03-13 18:20 ` Daniel Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Mario Limonciello @ 2026-03-13 17:59 UTC (permalink / raw)
To: Daniel Schaefer, linux-input
Cc: Richard Hughes, Jiri Kosina, Benjamin Tissoires, linux
On 3/13/2026 12:56 PM, Daniel Schaefer wrote:
> Expose the HID device version to userspace via the new
> HID_FIRMWARE_VERSION uevent property. This enables userspace tools
> (such as fwupd and hidapi) to retrieve device firmware version
> information, providing parity with Windows HidD_GetAttributes() API
> which returns VID, PID, and VersionNumber.
>
> The version is exported as a 4-digit uppercase hexadecimal value
> (e.g., "0100" for version 1.0), consistent with how USB devices
> report bcdDevice.
>
> fwupd can handle this since:
> https://github.com/fwupd/fwupd/commit/fb0d4cc98abe253003ea0e1837277fd42971e0de
> But the kernel hasn't yet exposed this.
>
> hidapi patch is in-flight: https://github.com/libusb/hidapi/pull/777
>
> Cc: Richard Hughes <richard@hughsie.com>
> Cc: Mario Limonciello <mario.limonciello@amd.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <bentiss@kernel.org>
> Cc: linux@frame.work
> Signed-off-by: Daniel Schaefer <dhs@frame.work>
> ---
> drivers/hid/hid-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index da57cbf0af26..c2075d5b40c3 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2884,6 +2884,9 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
> if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq))
> return -ENOMEM;
>
> + if (add_uevent_var(env, "HID_FIRMWARE_VERSION=%04X", hdev->version))
> + return -ENOMEM;
> +
> if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
> hdev->bus, hdev->group, hdev->vendor, hdev->product))
> return -ENOMEM;
Isn't this in
hid.git#for-7.1/lenovo-v2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] HID: core: Export device version via HID_FIRMWARE_VERSION uevent
2026-03-13 17:59 ` Mario Limonciello
@ 2026-03-13 18:20 ` Daniel Schaefer
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Schaefer @ 2026-03-13 18:20 UTC (permalink / raw)
To: Mario Limonciello
Cc: linux-input, Richard Hughes, Jiri Kosina, Benjamin Tissoires,
linux
> Isn't this in
> hid.git#for-7.1/lenovo-v2
Oh yes okay, I with this already in place, I should make my patches
set hdev->firmware_version instead of hdev->version.
Will send another series and drop my last patch in favor of yours:
https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?h=for-7.1/lenovo-v2&id=6ca9029c823b7853e980585e757343e0e84227cd
On Sat, Mar 14, 2026 at 2:00 AM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
>
>
> On 3/13/2026 12:56 PM, Daniel Schaefer wrote:
> > Expose the HID device version to userspace via the new
> > HID_FIRMWARE_VERSION uevent property. This enables userspace tools
> > (such as fwupd and hidapi) to retrieve device firmware version
> > information, providing parity with Windows HidD_GetAttributes() API
> > which returns VID, PID, and VersionNumber.
> >
> > The version is exported as a 4-digit uppercase hexadecimal value
> > (e.g., "0100" for version 1.0), consistent with how USB devices
> > report bcdDevice.
> >
> > fwupd can handle this since:
> > https://github.com/fwupd/fwupd/commit/fb0d4cc98abe253003ea0e1837277fd42971e0de
> > But the kernel hasn't yet exposed this.
> >
> > hidapi patch is in-flight: https://github.com/libusb/hidapi/pull/777
> >
> > Cc: Richard Hughes <richard@hughsie.com>
> > Cc: Mario Limonciello <mario.limonciello@amd.com>
> > Cc: Jiri Kosina <jikos@kernel.org>
> > Cc: Benjamin Tissoires <bentiss@kernel.org>
> > Cc: linux@frame.work
> > Signed-off-by: Daniel Schaefer <dhs@frame.work>
> > ---
> > drivers/hid/hid-core.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> > index da57cbf0af26..c2075d5b40c3 100644
> > --- a/drivers/hid/hid-core.c
> > +++ b/drivers/hid/hid-core.c
> > @@ -2884,6 +2884,9 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
> > if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq))
> > return -ENOMEM;
> >
> > + if (add_uevent_var(env, "HID_FIRMWARE_VERSION=%04X", hdev->version))
> > + return -ENOMEM;
> > +
> > if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
> > hdev->bus, hdev->group, hdev->vendor, hdev->product))
> > return -ENOMEM;
>
> Isn't this in
>
> hid.git#for-7.1/lenovo-v2
^ permalink raw reply [flat|nested] 7+ messages in thread