Skip to content

ps2: Japanese (JIS) keyboard support - #187

Merged
techomancer merged 1 commit into
techomancer:mainfrom
vic485:jis-keyboard
Oct 8, 2026
Merged

techomancer merged 1 commit into
techomancer:mainfrom
vic485:jis-keyboard

Conversation

@vic485

@vic485 vic485 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

With the PROM set to the Japanese layout, ] typed \, } typed | and _ typed nothing.

IRIX and the PROM read the keyboard in scancode set 3. There, an SGI keyboard sends 0x5C for the ANSI \| key and 0x53 for the key left of Enter on ISO/JIS boards (JIS ]}). The host reports both as KeyCode::Backslash, so iris always sent 0x5C, which the JP table reads as the yen key. IntlRo, IntlYen, NonConvert, Convert and KanaMode had no mapping in any set.

  • keyboard = "ansi" | "iso" | "jis" in the config (--keyboard on the command line) gives the host keyboard's physical shape. iso/jis send 0x53 for Backslash in set 3. ansi (the default) is unchanged.
  • The JIS keys map in sets 1, 2 and 3. Set-3 codes are from xkeyboard-config sgi_vndr/indy(jp106) (X keycode = set-3 code + 8): ro 0x51, yen 0x5C, muhenkan/henkan/kana 0x85/0x86/0x87.
  • iris-gui: a Keyboard selector on the Display tab sets it; release (bundled) builds can't import iris.toml, so this is the only way there.
  • iris-gui: egui has no Key for the JIS-only keys, so they arrive with only a logical key. A physical-less \ or | is sent as IntlYen. Yen works, ro types \ (never _), and the conversion keys stay dead in the GUI.

Tested with a real JIS keyboard and the PROM on the Japanese layout, at the PROM command monitor:

  • standalone iris window (--keyboard jis): ], } and _ now type correctly.
  • iris-gui (Display > Keyboard: JIS): ] and } type correctly, yen and ro type \, and Shift+ro and the conversion keys do nothing, as expected. A new unit test (jis_keys_set3) checks the set-3 codes, and the ps2 and config tests pass. The workspace builds.

Partially fixes #185, fully fixing the gui would require egui-winit patches.

With the PROM set to the Japanese layout, `]` typed `\`, `}` typed `|`
and `_` typed nothing.

IRIX and the PROM read the keyboard in scancode set 3. There, an SGI
keyboard sends 0x5C for the ANSI `\|` key and 0x53 for the key left of
Enter on ISO/JIS boards (JIS `]}`). The host reports both as
KeyCode::Backslash, so iris always sent 0x5C, which the JP table reads
as the yen key. IntlRo, IntlYen, NonConvert, Convert and KanaMode had no
mapping in any set.

- keyboard = "ansi" | "iso" | "jis" in the config (--keyboard on the
  command line) gives the host keyboard's physical shape. iso/jis send
  0x53 for Backslash in set 3. ansi (the default) is unchanged.
- The JIS keys map in sets 1, 2 and 3. Set-3 codes are from
  xkeyboard-config sgi_vndr/indy(jp106) (X keycode = set-3 code + 8):
  ro 0x51, yen 0x5C, muhenkan/henkan/kana 0x85/0x86/0x87.
- iris-gui: a Keyboard selector on the Display tab sets it; release
  (bundled) builds can't import iris.toml, so this is the only way there.
- iris-gui: egui has no Key for the JIS-only keys, so they arrive with
  only a logical key. A physical-less `\` or `|` is sent as IntlYen. Yen
  works, ro types `\` (never `_`), and the conversion keys stay dead in
  the GUI.

Tested with a real JIS keyboard and the PROM on the Japanese layout, at
the PROM command monitor:
- standalone iris window (--keyboard jis): `]`, `}` and `_` now type
  correctly.
- iris-gui (Display > Keyboard: JIS): `]` and `}` type correctly, yen
  and ro type `\`, and Shift+ro and the conversion keys do nothing, as
  expected.
A new unit test (jis_keys_set3) checks the set-3 codes, and the ps2 and
config tests pass. The workspace builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/dev/ps2.rs
KeyCode::BracketRight => Some(ScancodeSet3::RBracket),
// Sets 1 and 2 give the ANSI `\|` key and the ISO/JIS key left of
// Enter one code; set 3 does not, and the host can't tell them apart.
KeyCode::Backslash if self.layout.load(Ordering::Relaxed) != KeyboardLayout::Ansi as u8 =>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm not sure if we should touch iso here, but we from the layouts i see most national euro keyboars have # there. so lets see if we get complaints ;-)

@techomancer
techomancer merged commit 8e7ebd5 into techomancer:main Oct 8, 2026
@techomancer

Copy link
Copy Markdown
Owner

@vic485 thanks!

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.

Some keys incorrect or missing with Japanese (JP) layout selected.

2 participants