about the console keyboard

在console上有三種主要的鍵盤呈現, 分別是:
scancode( raw code), keycode, keychar.
scancode就是硬體所送出的數位訊息, 隨pc, mac, …不同的硬體平台而不同.
keycode則是由程式所定義的鍵盤事件, linux kernel有定義, Xwindow也有另一個定義.
keychar就是我們熟知的ASCII字碼, 是一致不變的.
在console擷取鍵盤事件, 需要透過一些低階的I/O技巧,才能取得類似像Ctrl+Space這一類的鍵盤事件.
這裡有一篇很棒的Console Programming Howto:
http://devel.linvision.com/doc/fbh/current/
在4th section對keystroke有很好的指導.

There there major different keystroke representation:
scancode( raw code), keycode, keychar.
1.scancode is the hardware from the keyboad, varies from different hardware platform, for exam , PC, Mac,…
2. keycode is keyboard event defined by the specific programs, linuxer kernel has one definition, and Xwindow also has its own definition, IIIMF has, too.
3. keychar just is the ASCII code. It’s consistent between different platform.

To catch the keystrokes event in console needs some low level I/O skill, especially for special keyevnet such as “Ctrl+Space” “Ctrl+Shift”.

Here is a excellent document for console programming:
http://devel.linvision.com/doc/fbh/current/
and the 4th section is a good guide for keystroke event handling.

Leave a Reply

Your email address will not be published. Required fields are marked *