From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"André Barata" <andretiagob@protonmail.com>,
"Jiri Kosina" <jkosina@suse.com>,
"Sasha Levin" <sashal@kernel.org>,
jikos@kernel.org, bentiss@kernel.org,
linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 6.17-6.6] HID: hid-input: Extend Elan ignore battery quirk to USB
Date: Mon, 24 Nov 2025 03:06:23 -0500 [thread overview]
Message-ID: <20251124080644.3871678-9-sashal@kernel.org> (raw)
In-Reply-To: <20251124080644.3871678-1-sashal@kernel.org>
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
[ Upstream commit 534ca75e8e3b713514b3f2da85dab96831cf5b2a ]
USB Elan devices have the same problem as the I2C ones with a fake
battery device showing up.
Reviewed-by: Hans de Goede <hansg@kernel.org>
Reported-by: André Barata <andretiagob@protonmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220722
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
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: hid-input: Extend Elan ignore battery quirk to USB"
addresses a specific hardware compatibility issue where Elan USB
touchscreens incorrectly report a battery device to the OS.
- **Problem:** Users see a non-existent or "fake" battery in their
system tray/power settings, which can cause confusion and interfere
with power management logic.
- **Context:** The message notes that "USB Elan devices have the same
problem as the I2C ones," referencing a known issue.
- **References:** It links to a specific bug report (Bugzilla #220722)
and has a `Reviewed-by` tag from the subsystem maintainer (Hans de
Goede).
### 2. Deep Code Research
- **Code Change:** The patch modifies `drivers/hid/hid-input.c` by
adding a single line to the `hid_battery_quirks` table:
```c
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID),
HID_BATTERY_QUIRK_IGNORE },
```
- **Historical Context:** This change mirrors commit `bcc31692a1d1e`
(August 2024), which applied the same `HID_ANY_ID` catch-all quirk for
**I2C** Elan devices. That previous commit was successfully backported
to stable trees.
- **Mechanism:** The `hid-input` driver checks connected devices against
the `hid_battery_quirks` table. When a match is found with
`HID_BATTERY_QUIRK_IGNORE`, the function `hidinput_setup_battery()`
returns early, preventing the creation of the bogus power supply
device in `/sys/class/power_supply/`.
- **Precedent:** The file already contains specific quirks for some Elan
USB devices (e.g., ASUS UX550). This commit generalizes the fix to all
Elan USB devices, cleaning up the approach.
### 3. Stable Kernel Rules Assessment
- **Fixes a Real Bug:** Yes. It prevents the kernel from exposing false
hardware information to userspace.
- **Quirks and Workarounds Exception:** This falls strictly under the
"QUIRKS and WORKAROUNDS" exception category allowed in stable kernels
("Hardware-specific quirks for broken/buggy devices").
- **Small and Contained:** The change is surgical—one line of code added
to a static array. It has no logic complexity or dependencies.
- **Regression Risk:** Extremely Low. It simply disables battery
reporting for a specific vendor's input devices. Since the battery
reporting is known to be broken (always 0% or 1%), ignoring it
restores correct behavior.
- **Mainline Status:** Reviewed by maintainers and tested by the
reporter.
### 4. Conclusion
This commit is an ideal candidate for backporting. It is a one-line
hardware quirk that fixes a user-visible annoyance (fake battery
devices). It follows a pattern already established and backported for
I2C devices, ensuring consistency across different bus types for the
same hardware vendor.
**YES**
drivers/hid/hid-input.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 2c743e35c1d33..bc7de9ef45ecd 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -386,10 +386,11 @@ static const struct hid_device_id hid_battery_quirks[] = {
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_CHROMEBOOK_TROGDOR_POMPOM),
HID_BATTERY_QUIRK_AVOID_QUERY },
/*
- * Elan I2C-HID touchscreens seem to all report a non present battery,
- * set HID_BATTERY_QUIRK_IGNORE for all Elan I2C-HID devices.
+ * Elan HID touchscreens seem to all report a non present battery,
+ * set HID_BATTERY_QUIRK_IGNORE for all Elan I2C and USB HID devices.
*/
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_IGNORE },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_IGNORE },
{}
};
--
2.51.0
next prev parent reply other threads:[~2025-11-24 8:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251124080644.3871678-1-sashal@kernel.org>
2025-11-24 8:06 ` [PATCH AUTOSEL 6.17-5.15] HID: elecom: Add support for ELECOM M-XT3URBK (018F) Sasha Levin
2025-11-24 8:06 ` Sasha Levin [this message]
2025-11-24 8:06 ` [PATCH AUTOSEL 6.17] HID: lenovo: fixup Lenovo Yoga Slim 7x Keyboard rdesc Sasha Levin
2025-11-24 8:06 ` [PATCH AUTOSEL 6.17-6.1] HID: apple: Add SONiX AK870 PRO to non_apple_keyboards quirk list Sasha Levin
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=20251124080644.3871678-9-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andretiagob@protonmail.com \
--cc=bentiss@kernel.org \
--cc=hansg@kernel.org \
--cc=jikos@kernel.org \
--cc=jkosina@suse.com \
--cc=linux-input@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=superm1@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).