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" },