From: Naoki Ueki naoki25519@gmail.com
[ Upstream commit cdcbb8e8d10f656642380ee13516290437b52b36 ]
The ELECOM M-XT3URBK trackball has an additional device ID (0x018F), which shares the same report descriptor as the existing device (0x00FB). However, the driver does not currently recognize this new ID, resulting in only five buttons being functional.
This patch adds the new device ID so that all six buttons work properly.
Signed-off-by: Naoki Ueki naoki25519@gmail.com Signed-off-by: Jiri Kosina jkosina@suse.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
### Comprehensive Analysis
**1. Commit Message Analysis** The commit "HID: elecom: Add support for ELECOM M-XT3URBK (018F)" addresses a specific hardware deficiency where a new revision of the ELECOM M-XT3URBK trackball (ID 0x018F) is not recognized by the driver. This results in the device falling back to a default mode where only five buttons function, instead of the intended six. The commit aims to add the new ID to the existing driver to enable full functionality. The message clearly describes the problem (missing button support) and the solution (adding the ID).
**2. Deep Code Research** - **Code Change Scope:** The patch modifies three files: `drivers/hid/hid-elecom.c`, `drivers/hid/hid-ids.h`, and `drivers/hid/hid-quirks.c`. - **Mechanism:** The patch performs a rename of the existing macro `USB_DEVICE_ID_ELECOM_M_XT3URBK` to `USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB` to differentiate the old revision (0x00FB) from the new one. It then defines the new ID `USB_DEVICE_ID_ELECOM_M_XT3URBK_018F` (0x018F). - **Logic Update:** In `elecom_report_fixup`, the switch statement is updated to apply the existing `mouse_button_fixup` logic to *both* the old and new device IDs. This ensures the 6th button is correctly mapped for the new hardware. - **Safety Verification:** A codebase search confirms that `USB_DEVICE_ID_ELECOM_M_XT3URBK` was only used in the three files modified by the patch. Therefore, the rename is safe and does not break any external dependencies or out-of-tree modules that rely on the standard kernel headers. - **Context:** This uses the existing `hid-elecom` infrastructure. It does not introduce new logic, only new data (IDs).
**3. Stable Kernel Rules Compliance** - **Rule Alignment:** The commit complies with the stable kernel rules requiring fixes to be "obviously correct" and for "real bugs". - **Exception Category:** This falls squarely under the **"NEW DEVICE IDs"** exception detailed in `Documentation/process/stable-kernel- rules.rst`:
"Adding PCI IDs, USB IDs, ACPI IDs, etc. to existing drivers...
These are trivial one-line additions that enable hardware support... Rule: The driver must already exist in stable; only the ID is new" - **Driver Existence:** The `hid-elecom` driver already exists in stable trees.
**4. Risk Assessment** - **Regression Risk:** **Very Low**. The changes are declarative. The existing hardware path remains effectively unchanged (just a renamed macro constant with the same value). The new path reuses existing, tested fixup logic. - **User Impact:** Users with the new revision of this trackball will regain full functionality (the 6th button). Users with the old revision are unaffected.
**5. Conclusion** This commit is a textbook candidate for stable backporting. It fixes a functional regression for users with newer hardware by adding a device ID to an existing driver, which is explicitly permitted and encouraged in stable kernels.
**YES**
drivers/hid/hid-elecom.c | 6 ++++-- drivers/hid/hid-ids.h | 3 ++- drivers/hid/hid-quirks.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c index 69771fd350060..981d1b6e96589 100644 --- a/drivers/hid/hid-elecom.c +++ b/drivers/hid/hid-elecom.c @@ -75,7 +75,8 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, */ mouse_button_fixup(hdev, rdesc, *rsize, 20, 28, 22, 14, 8); break; - case USB_DEVICE_ID_ELECOM_M_XT3URBK: + case USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB: + case USB_DEVICE_ID_ELECOM_M_XT3URBK_018F: case USB_DEVICE_ID_ELECOM_M_XT3DRBK: case USB_DEVICE_ID_ELECOM_M_XT4DRBK: /* @@ -119,7 +120,8 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const struct hid_device_id elecom_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 4b1946eb4e7fc..fb96ded1b4428 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -446,7 +446,8 @@ #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 #define USB_DEVICE_ID_ELECOM_M_XGL20DLBK 0x00e6 -#define USB_DEVICE_ID_ELECOM_M_XT3URBK 0x00fb +#define USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB 0x00fb +#define USB_DEVICE_ID_ELECOM_M_XT3URBK_018F 0x018f #define USB_DEVICE_ID_ELECOM_M_XT3DRBK 0x00fc #define USB_DEVICE_ID_ELECOM_M_XT4DRBK 0x00fd #define USB_DEVICE_ID_ELECOM_M_DT1URBK 0x00fe diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index ffd034566e2e1..0bbb7425b935a 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -408,7 +408,8 @@ static const struct hid_device_id hid_have_special_driver[] = { #if IS_ENABLED(CONFIG_HID_ELECOM) { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) },