From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: April Grimoire <april@aprilg.moe>, 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.1] HID: apple: Add SONiX AK870 PRO to non_apple_keyboards quirk list
Date: Mon, 24 Nov 2025 03:06:34 -0500 [thread overview]
Message-ID: <20251124080644.3871678-20-sashal@kernel.org> (raw)
In-Reply-To: <20251124080644.3871678-1-sashal@kernel.org>
From: April Grimoire <april@aprilg.moe>
[ Upstream commit 743c81cdc98fd4fef62a89eb70efff994112c2d9 ]
SONiX AK870 PRO keyboard pretends to be an apple keyboard by VID:PID,
rendering function keys not treated properly. Despite being a
SONiX USB DEVICE, it uses a different name, so adding it to the list.
Signed-off-by: April Grimoire <april@aprilg.moe>
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: apple: Add SONiX AK870 PRO to non_apple_keyboards quirk
list" addresses a specific hardware compatibility issue. The SONiX AK870
PRO keyboard incorrectly identifies itself using Apple's Vendor ID (VID)
and Product ID (PID). This causes the `hid-apple` driver to mistakenly
apply Apple-specific function key behavior (where F1-F12 act as
media/special keys by default, requiring the Fn key to access standard
F-key functions).
The commit has no "Cc: stable" tag or "Fixes:" tag, but clearly
describes a hardware quirk fix.
### 2. Deep Code Research & Mechanism
The change modifies `drivers/hid/hid-apple.c` by adding a single entry
to the `non_apple_keyboards` array.
**The Mechanism:**
The `hid-apple` driver contains a function
`apple_is_non_apple_keyboard()` which iterates through the
`non_apple_keyboards` list:
```c
static const struct apple_non_apple_keyboard non_apple_keyboards[] = {
{ "SONiX USB DEVICE" },
{ "SONiX AK870 PRO" }, /* Added by this commit */
/* ... other existing entries like Keychron, GANSS ... */
};
static bool apple_is_non_apple_keyboard(struct hid_device *hdev)
{
/* ... iterates array and checks strncmp(hdev->name, ...) ... */
}
```
When a device matches an entry in this list, the driver sets the
`APPLE_IS_NON_APPLE` quirk. This flag fundamentally alters how the
driver processes input, specifically preventing the swapping of function
keys and Option/Command keys that is typical for genuine Apple hardware.
**Code Context:**
This infrastructure was introduced specifically to handle the growing
number of mechanical keyboards that use Apple's protocols/IDs for
compatibility but have PC physical layouts. The commit adds one string
literal to this existing, stable lookup table.
### 3. Feature vs. Bug Fix Classification
While technically "adding" a device ID string, this falls squarely under
the **Quirks and Workarounds** exception in the stable kernel rules.
- **The Bug:** Users of this specific keyboard currently experience
broken function key behavior (F1-F12 do not work as expected for a PC
layout).
- **The Fix:** A hardware-specific quirk that restores correct
functionality.
### 4. Risk and Impact Assessment
- **Impact:** High for owners of this device (restores usability). Zero
for everyone else.
- **Regression Risk:** **Negligible.** The change is a string addition
to a static array. The logic uses `strncmp` against the device name.
It is physically impossible for this change to affect any device that
does not report its name starting with "SONiX AK870 PRO".
- **Mainline Status:** The commit was merged recently (late October
2025). The pattern is well-established and has been used for other
keyboards (e.g., Keychron, Hailuck) without incident.
### 5. Stable Kernel Rules Compliance
- **Fixes a real bug?** Yes, function key behavior is incorrect without
it.
- **No new features?** Yes, it simply enables correct existing driver
behavior for this hardware.
- **Small and contained?** Yes, one line of code.
- **Valid Exception?** Yes, explicitly allowed under "Hardware-specific
quirks for broken/buggy devices."
### Conclusion
This is a textbook candidate for a stable backport. It fixes a user-
visible hardware regression (incorrect key mapping) using a low-risk,
established quirk mechanism. The lack of a "Cc: stable" tag is likely an
oversight common with trivial hardware ID additions, but it fully
qualifies under stable maintenance rules.
**YES**
drivers/hid/hid-apple.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 61404d7a43ee1..57da4f86a9fa7 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -355,6 +355,7 @@ static const struct apple_key_translation swapped_fn_leftctrl_keys[] = {
static const struct apple_non_apple_keyboard non_apple_keyboards[] = {
{ "SONiX USB DEVICE" },
+ { "SONiX AK870 PRO" },
{ "Keychron" },
{ "AONE" },
{ "GANSS" },
--
2.51.0
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 ` [PATCH AUTOSEL 6.17-6.6] HID: hid-input: Extend Elan ignore battery quirk to USB Sasha Levin
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 ` Sasha Levin [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=20251124080644.3871678-20-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=april@aprilg.moe \
--cc=bentiss@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 \
/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).