Korean English toggle key(HanYeong) not work.

Korean keyboard have HanYeong(korean english toggle key, generally called Hangul) and hanja(korean chiness convesion key) keys.
In PS/2 keyboard, HanYeong has scancode 0xF2, and hanja has scancode 0xF1 and don't have release keys.

Firstly, I saw the kernel's source code. There is kdbmux and atkbd (and ukbd).
In atkdb, there are three mode k_RAW, K_CODE. and K_XLATE.

Code:
#define K_RAW        0        /* keyboard returns scancodes    */
#define K_XLATE        1        /* keyboard returns ascii     */
#define K_CODE        2        /* keyboard returns keycodes     */


K_RAW just return scancode and K_CODE return (keycode | (scancode & 0x80)); and K_XLATE return ascii. and K_XLATE return ascii code. in console, K_XLATE seems like default mode.
(In console,) key is recognized by genkbd_keyaction. like this.
action = genkbd_keyaction(kbd, keycode, scancode & 0x80, &state->ks_state, &state->ks_accents);
Because 0xF2 is over 0x80, Hanyeong key is interpreted as release key and just ignored.
However, It is not a real problem because X receives as RAW scancode and does not inherit console keymap and there is no IME in console mode.

So it is real question. How can I set HanYeong and hanja keys in bsdkbdmap.c or whaterver? Or I miss guess?

For USB keyboard I can't sure but it might works correctly. (They are same key with EISU and KANA)
 
Thanks for your reply. However, there is a fundamental problem that can not be solved with the proposed solution.
For vt console, it must be hacked somewhere but it's not usefull at all, I'll ignore it for now.

What I want to know is how to recognize Hangul and Hanja keys In Xorg. They are not printed by xev. It seems should use xmodmap or something...
 
Just to note, scim is pretty old and not developed much anymore, if at all. It seems there is an fcitx-hangul port and I'd recommend it as it makes input, at least for Japanese, trivial, and probably would for Korean as well. I realize this isn't answering your question, but it takes about 3 minutes to set up and after that, in X, you can switch back and forth between Korean and English with clt+Windows (or select another key)

There doesn't seem to be an fcitx-fbterm port, which is too bad, becase that allows you to use it in console. Anyway, my Japanese page describes using fcitx with FreeBSD, and though it's for Japanese, if you change your fonts and obviosly, the port from fcitx-mozc to fcitx-hangul, it should work. Again I know you're doing something else, but this does make it trivial. http://srobb.net/jpninpt.html
 
Back
Top