BadUSB: Add Japanese (JIS) keyboard layout#4373
Open
Ytz-Ichi wants to merge 2 commits into
Open
Conversation
USAGE_MAXIMUM was capped at HID_KEYBOARD_APPLICATION (0x65), so International1..5 (0x87-0x8B) keys were silently dropped by the host. Raise LOGICAL_MAXIMUM and USAGE_MAXIMUM to 0xFF on both USB and BLE descriptors so layouts can target JIS keys (yen, ro, henkan, etc.).
Maps ASCII to JIS 109-key positions, using International3 (0x89) for backslash and pipe, and International1 (0x87) for underscore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's new
ja-JP.klfor the Japanese 109-key (JIS) keyboard layout.key codes (0x87-0x8B) reach the host. The previous
USAGE_MAXIMUMofHID_KEYBOARD_APPLICATION(0x65) caused reports containing these keys tobe dropped by the OS, so a layout-only change could not cover JIS. The new
range is a strict superset of the previous one, so existing layouts are
unaffected.
JIS layout uses International3 (yen key) for
\and|, and International1(ro key) for
_.Verification
./fbt firmware_all flash_usbto build and flash. The new layout isbundled with the resources.
In the BadUSB app, open the Config menu and select
ja-JPas the layout.On the host PC, switch the keyboard layout to Japanese (JIS) and open
Notepad.
Run a BadUSB script that prints the printable ASCII range, e.g.:
All characters should appear as typed. The previously broken set
(
\|_@[]{}`~^:"') nowproduces the printed characters.
\renders as ¥ on Japanese Windowsbecause of Shift-JIS font mapping; the byte sent is still ASCII 0x5C.
Checklist (For Reviewer)