Skip to content

BadUSB: Add Japanese (JIS) keyboard layout#4373

Open
Ytz-Ichi wants to merge 2 commits into
flipperdevices:devfrom
Ytz-Ichi:Ytz/badusb_jp_layout
Open

BadUSB: Add Japanese (JIS) keyboard layout#4373
Ytz-Ichi wants to merge 2 commits into
flipperdevices:devfrom
Ytz-Ichi:Ytz/badusb_jp_layout

Conversation

@Ytz-Ichi
Copy link
Copy Markdown

What's new

  • Add ja-JP.kl for the Japanese 109-key (JIS) keyboard layout.
  • Extend the HID keyboard report descriptor (USB and BLE) so International1..5
    key codes (0x87-0x8B) reach the host. The previous USAGE_MAXIMUM of
    HID_KEYBOARD_APPLICATION (0x65) caused reports containing these keys to
    be 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

  1. ./fbt firmware_all flash_usb to build and flash. The new layout is
    bundled with the resources.

  2. In the BadUSB app, open the Config menu and select ja-JP as the layout.

  3. On the host PC, switch the keyboard layout to Japanese (JIS) and open
    Notepad.

  4. Run a BadUSB script that prints the printable ASCII range, e.g.:

    STRING ASCII test: !"#$%&'()*+,-./0123456789:;<=>?@ABCXYZabcxyz[\]^_`{|}~
    STRINGLN
    STRING Backslash and pipe: \\ ||
    
  5. All characters should appear as typed. The previously broken set
    (\ | _ @ [ ] { } ` ~ ^ : " ') now
    produces the printed characters. \ renders as ¥ on Japanese Windows
    because of Shift-JIS font mapping; the byte sent is still ASCII 0x5C.

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

Ytz-Ichi added 2 commits May 21, 2026 09:26
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant