public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schaefer <dhs@frame.work>
To: linux-input@vger.kernel.org
Cc: Daniel Schaefer <dhs@frame.work>, Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	linux@frame.work
Subject: [PATCH 1/4] HID: i2c-hid: Use wVersionID for device version
Date: Sat, 14 Mar 2026 01:56:56 +0800	[thread overview]
Message-ID: <20260313175659.268094-2-dhs@frame.work> (raw)
In-Reply-To: <20260313175659.268094-1-dhs@frame.work>

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


  reply	other threads:[~2026-03-13 17:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 17:56 [PATCH 0/4] HID: Use wVersionID for device version Daniel Schaefer
2026-03-13 17:56 ` Daniel Schaefer [this message]
2026-03-13 17:56 ` [PATCH 2/4] HID: goodix-spi: Use version_id " 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
2026-03-13 17:59   ` Mario Limonciello
2026-03-13 18:20     ` Daniel Schaefer

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=20260313175659.268094-2-dhs@frame.work \
    --to=dhs@frame.work \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux@frame.work \
    /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