From: Amit Chaudhari amitchaudhari@mac.com
[ Upstream commit 831f70a5b93bd2d9e858ced2c12fab5766ede5e7 ]
Add support for missing hotkey keycodes affecting Asus PX13 and PX16 families so userspace can use them.
Signed-off-by: Amit Chaudhari amitchaudhari@mac.com Signed-off-by: Jiri Kosina jkosina@suse.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
## Backport Analysis
**Backport Status: YES**
### Comprehensive Analysis
After extensive investigation of this commit, the code changes, git history, and related patterns, this commit is an excellent candidate for backporting to stable kernel trees.
#### What the Commit Does
The commit adds three new HID usage code mappings for Asus keyboard function keys in `drivers/hid/hid-asus.c:964-997`:
1. **`case 0x4e: KEY_FN_ESC`** - Maps Fn+Esc key functionality 2. **`case 0x7e: KEY_EMOJI_PICKER`** - Maps emoji picker key 3. **`case 0x8b: KEY_PROG1`** - Maps ProArt Creator Hub key (with explicit comment)
These mappings are added to the existing switch statement that handles `HID_UP_ASUSVENDOR` usage codes, enabling previously non-functional hardware keys on Asus PX13 and PX16 laptop families.
#### Why This Should Be Backported
**1. Fixes User-Visible Bug** - Without this patch, hardware function keys on PX13/PX16 laptops don't work - This is a clear hardware support regression affecting real users - Users cannot access important laptop functionality (Fn keys, Creator Hub)
**2. Minimal and Contained Change** - Only 3 lines added to a single switch statement - No architectural changes or complex logic - Changes are confined to `drivers/hid/hid-asus.c` - Pattern: Simple addition of case labels with direct key mappings
**3. Very Low Regression Risk** - Adding new key mappings cannot break existing functionality - Keys were previously ignored (returned -1 by default case) - No existing code paths are modified - Driver-specific change only affects Asus keyboard users
**4. No Problematic Dependencies** - `KEY_FN_ESC`: Present since Linux 2.6.11 (ancient, available everywhere) - `KEY_EMOJI_PICKER`: Added in v5.12 (April 2021, commit 7b229b13d78d, already backported to stable) - `KEY_PROG1`: Standard key code, very old - All dependencies satisfied in stable kernel trees v5.12+
**5. Follows Established Patterns** - Similar commit `5ec4596a0ba9a` ("HID: asus: add ROG Ally N-Key ID and keycodes") was successfully backported to stable (signed by Sasha Levin) - Multiple historical commits adding Asus keycodes have been backported (e.g., `73920f615159`, `74e47b2c52ed`) - This driver has a strong track record of accepting simple keycode additions in stable
**6. Meets Stable Kernel Rules** - Important bugfix (missing hardware support) - Obviously correct (just mapping hardware codes to standard keycodes) - Tested in mainline (in v6.17 since August 2025) - No known issues or reverts
#### Code Change Analysis
The changes are in `drivers/hid/hid-asus.c` at the `asus_input_mapping()` function. The function checks if the HID usage page matches `HID_UP_ASUSVENDOR`, then maps vendor-specific usage codes to standard Linux input key codes using a switch statement.
The three new cases are inserted logically: - `0x4e` and `0x7e` are placed together near other standard function keys - `0x8b` is placed with a comment identifying it as ProArt-specific, positioned before the other special function keys (ROG key, touchpad toggle, etc.)
The macro `asus_map_key_clear()` is used consistently with all other mappings in the driver, ensuring proper registration and clearing of the key mapping.
#### Target Stable Kernels
This commit should be backported to: - **All stable kernels v5.12+** (where KEY_EMOJI_PICKER is available) - Primary focus: v6.1.x (LTS), v6.6.x (LTS), v6.12.x, v6.15.x stable trees
Users of Asus PX13/PX16 laptops on these kernel versions will immediately benefit from functional hardware keys.
drivers/hid/hid-asus.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index d27dcfb2b9e4e..8db9d4e7c3b0b 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -974,7 +974,10 @@ static int asus_input_mapping(struct hid_device *hdev, case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break; case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break; case 0xc7: asus_map_key_clear(KEY_KBDILLUMTOGGLE); break; + case 0x4e: asus_map_key_clear(KEY_FN_ESC); break; + case 0x7e: asus_map_key_clear(KEY_EMOJI_PICKER); break;
+ case 0x8b: asus_map_key_clear(KEY_PROG1); break; /* ProArt Creator Hub key */ case 0x6b: asus_map_key_clear(KEY_F21); break; /* ASUS touchpad toggle */ case 0x38: asus_map_key_clear(KEY_PROG1); break; /* ROG key */ case 0xba: asus_map_key_clear(KEY_PROG2); break; /* Fn+C ASUS Splendid */