Japanese Keyboard Support

Discussion of keyboards, gamepads, joysticks and other input related peripherals.
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Japanese Keyboard Support

Unread post by pgimeno »

I've recently bought a Japanese keyboard from eBay (this one in particular), in order to make the necessary tests to make the missing keys work with MiSTer. The keyboard is here, the tests have been done (this is the map of the Linux event keycodes that the keyboard generates: http://www.formauri.es/personal/pgimeno ... -codes.png according to my findings) and with the invaluable help of this page: http://hp.vector.co.jp/authors/VA003720 ... kbdjpn.htm which let me know the set-2 codes for these keys, the patch is ready. It applies to this repository: https://github.com/MiSTer-devel/Main_MiSTer. It's five new keys in total.

Code: Select all

From 7345e03daf2212b1c3b17871525fb36902bc4d53 Mon Sep 17 00:00:00 2001
From: Pedro Gimeno <pgimeno@users.noreply.notabug.org>
Date: Fri, 8 Apr 2022 00:29:19 +0200
Subject: [PATCH] Add Japanese-exclusive keys support

---
 input.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/input.cpp b/input.cpp
index 00836cc..4194bd5 100644
--- a/input.cpp
+++ b/input.cpp
@@ -388,12 +388,12 @@ static const int ev2ps2[] =
 	0x61, //86  KEY_102ND
 	0x78, //87  KEY_F11
 	0x07, //88  KEY_F12
-	NONE, //89  KEY_RO
+	0x51, //89  KEY_RO
 	NONE, //90  KEY_KATAKANA
 	NONE, //91  KEY_HIRAGANA
-	NONE, //92  KEY_HENKAN
-	NONE, //93  KEY_KATAKANA
-	NONE, //94  KEY_MUHENKAN
+	0x64, //92  KEY_HENKAN
+	0x13, //93  KEY_KATAKANAHIRAGANA
+	0x67, //94  KEY_MUHENKAN
 	NONE, //95  KEY_KPJPCOMMA
 	EXT | 0x5a, //96  KEY_KPENTER
 	RCTRL | EXT | 0x14, //97  KEY_RIGHTCTRL
@@ -423,7 +423,7 @@ static const int ev2ps2[] =
 	NONE, //121 KEY_KPCOMMA
 	NONE, //122 KEY_HANGEUL
 	NONE, //123 KEY_HANJA
-	NONE, //124 KEY_YEN
+	0x6A, //124 KEY_YEN
 	LGUI | EXT | 0x1f, //125 KEY_LEFTMETA
 	RGUI | EXT | 0x27, //126 KEY_RIGHTMETA
 	NONE, //127 KEY_COMPOSE
-- 
2.11.0
Important: This patch only allows Main to generate the PS/2 set-2 scancodes that correspond to the missing keys. In addition to this, cores need to add support for using or translating these scancodes. They are standard, so if anyone anticipated PS/2 set-2 support, it will work out of the box. That's the case for ao486, which already implements full set-2 to set-1 translation, thus making the keys visible to applications, but I'm not sure for other cores, particularly of Japanese machines (PC88, PC98, X68000 most prominently, maybe others).

Help wanted: The problem now is that I left Github to not return, but that's the place to submit patches to, therefore someone with Git skills needs to submit a PR with the above changes, and hope for the patch to get accepted.

Help wanted: To Japanese users: are there any keys missing from the list above that are not yet supported?
puu
Core Developer
Posts: 113
Joined: Mon May 25, 2020 9:20 am
Location: Japan
Has thanked: 2 times
Been thanked: 151 times
Contact:

Re: Japanese Keyboard Support

Unread post by puu »

Thank you very much for the patch. I will try it soon.
Post Reply