General Info | |
Interface: Keyboard Files: keyboard.h Last change: 24/11/2002 Author: Luiz Henrique Shigunov |
Description
Structures Configuration |
System Functions | |
0x00 - GetLayout - Get current layout |
0x01 - SetLayout - Set current layout |
User Functions | |
0x02 - UGetLayout - Get current layout |
0x03 - USetLayout - Set current layout |
This page describes the Keyboard interface which provides access to the keyboard.
A module that implements this interface must map scancodes to virtual keys and these virtual keys to characters.
To do so, the module must use mapping tables from a module that implements the KbdLayout interface.
Besides that, the module must control keyboard leds (CapsLock, NumLock, ScrollLock).
typedef struct { unsigned int type; unsigned short charCode; unsigned char vKey; unsigned char reserved; unsigned int flags; unsigned int reserved2[5]; } Keyboard_Event;
type values between 0x00-0x0f are reserved for keyboard.
Currently this types are defined:
Value | Description |
---|---|
0x00 | Key down |
0x01 | Key up |
scancode is the value read from the keyboard, charCode is the character code in Unicode, zero if it doesn't exist and flags has shifts states (ctrl, shift, alt, etc) and will be the sum of:
vKey is a virtual key, which can be:
Value | Code | Description |
---|---|---|
0x00 | Not used | |
0x01 | Keyboard_VK_0 | Number 0 |
0x02 | Keyboard_VK_1 | Number 1 |
0x03 | Keyboard_VK_2 | Number 2 |
0x04 | Keyboard_VK_3 | Number 3 |
0x05 | Keyboard_VK_4 | Number 4 |
0x06 | Keyboard_VK_5 | Number 5 |
0x07 | Keyboard_VK_6 | Number 6 |
0x08 | Keyboard_VK_7 | Number 7 |
0x09 | Keyboard_VK_8 | Number 8 |
0x0a | Keyboard_VK_9 | Number 9 |
0x0b | Keyboard_VK_A | Letter A |
0x0c | Keyboard_VK_B | Letter B |
0x0d | Keyboard_VK_C | Letter C |
0x0e | Keyboard_VK_D | Letter D |
0x0f | Keyboard_VK_E | Letter E |
0x10 | Keyboard_VK_F | Letter F |
0x11 | Keyboard_VK_G | Letter G |
0x12 | Keyboard_VK_H | Letter H |
0x13 | Keyboard_VK_I | Letter I |
0x14 | Keyboard_VK_J | Letter J |
0x15 | Keyboard_VK_K | Letter K |
0x16 | Keyboard_VK_L | Letter L |
0x17 | Keyboard_VK_M | Letter M |
0x18 | Keyboard_VK_N | Letter N |
0x19 | Keyboard_VK_O | Letter O |
0x1a | Keyboard_VK_P | Letter P |
0x1b | Keyboard_VK_Q | Letter Q |
0x1c | Keyboard_VK_R | Letter R |
0x1d | Keyboard_VK_S | Letter S |
0x1e | Keyboard_VK_T | Letter T |
0x1f | Keyboard_VK_U | Letter U |
0x20 | Keyboard_VK_V | Letter V |
0x21 | Keyboard_VK_W | Letter W |
0x22 | Keyboard_VK_X | Letter X |
0x23 | Keyboard_VK_Y | Letter Y |
0x24 | Keyboard_VK_Z | Letter Z |
0x25 | Keyboard_VK_SPACE | Space |
0x26 | Keyboard_VK_KEYPAD0 | Number 0 from keypad |
0x27 | Keyboard_VK_KEYPAD1 | Number 1 from keypad |
0x28 | Keyboard_VK_KEYPAD2 | Number 2 from keypad |
0x29 | Keyboard_VK_KEYPAD3 | Number 3 from keypad |
0x2a | Keyboard_VK_KEYPAD4 | Number 4 from keypad |
0x2b | Keyboard_VK_KEYPAD5 | Number 5 from keypad |
0x2c | Keyboard_VK_KEYPAD6 | Number 6 from keypad |
0x2d | Keyboard_VK_KEYPAD7 | Number 7 from keypad |
0x2e | Keyboard_VK_KEYPAD8 | Number 8 from keypad |
0x2f | Keyboard_VK_KEYPAD9 | Number 9 from keypad |
0x30 | Keyboard_VK_KEYPAD_DIV | / from keypad |
0x31 | Keyboard_VK_KEYPAD_MUL | * from keypad |
0x32 | Keyboard_VK_KEYPAD_MINUS | - from keypad |
0x33 | Keyboard_VK_KEYPAD_PLUS | + from keypad |
0x34 | Keyboard_VK_KEYPAD_DOT | . from keypad |
0x35 | Keyboard_VK_KEYPAD_COMMA | , from keypad |
0x36 | Keyboard_VK_PUNCT0 | Punctuation |
0x37 | Keyboard_VK_PUNCT1 | Punctuation |
0x38 | Keyboard_VK_PUNCT2 | Punctuation |
0x39 | Keyboard_VK_PUNCT3 | Punctuation |
0x3a | Keyboard_VK_PUNCT4 | Punctuation |
0x3b | Keyboard_VK_PUNCT5 | Punctuation |
0x3c | Keyboard_VK_PUNCT6 | Punctuation |
0x3d | Keyboard_VK_PUNCT7 | Punctuation |
0x3e | Keyboard_VK_PUNCT8 | Punctuation |
0x3f | Keyboard_VK_PUNCT9 | Punctuation |
0x40 | Keyboard_VK_PUNCT10 | Punctuation |
0x41 | Keyboard_VK_PUNCT11 | Punctuation |
0x42 | Keyboard_VK_PUNCT12 | Punctuation |
0x43 | Keyboard_VK_PUNCT13 | Punctuation |
0x44 | Keyboard_VK_PUNCT14 | Punctuation |
0x45 | Keyboard_VK_PUNCT15 | Punctuation |
0x46 | Keyboard_VK_PUNCT16 | Punctuation |
0x47 | Keyboard_VK_PUNCT17 | Punctuation |
0x48 | Keyboard_VK_PUNCT18 | Punctuation |
0x49 | Keyboard_VK_PUNCT19 | Punctuation |
0x4a | Keyboard_VK_PUNCT20 | Punctuation |
0x4b | Keyboard_VK_ESC | Escape |
0x4c | Keyboard_VK_BACK | Backspace |
0x4d | Keyboard_VK_TAB | Tab |
0x4e | Keyboard_VK_RETURN | Enter |
0x4f | Keyboard_VK_KEYBAD_RETURN | Enter from keypad |
0x50 | Keyboard_VK_LSHIFT | Left shift |
0x51 | Keyboard_VK_RSHIFT | Right shift |
0x52 | Keyboard_VK_LCTRL | Left ctrl |
0x53 | Keyboard_VK_RCTRL | Right ctrl |
0x54 | Keyboard_VK_LALT | Left alt |
0x55 | Keyboard_VK_RALT | Right alt |
0x56 | Keyboard_VK_PAGEUP | Page up |
0x57 | Keyboard_VK_PAGEDOWN | Page down |
0x58 | Keyboard_VK_HOME | Home |
0x59 | Keyboard_VK_END | End |
0x5a | Keyboard_VK_INSERT | Insert |
0x5b | Keyboard_VK_DELETE | Delete |
0x5c | Keyboard_VK_UP | Up |
0x5d | Keyboard_VK_DOWN | Down |
0x5e | Keyboard_VK_LEFT | Left |
0x5f | Keyboard_VK_RIGHT | Right |
0x60 | Keyboard_VK_NUMLOCK | Numlock |
0x61 | Keyboard_VK_CAPSLOCK | Capslock |
0x62 | Keyboard_VK_SCROLLLOCK | Scrolllock |
0x63 | Keyboard_VK_SYSRQ | SysRq |
0x64 | Keyboard_VK_PAUSE | Pause |
0x65 | Keyboard_VK_F1 | F1 |
0x66 | Keyboard_VK_F2 | F2 |
0x67 | Keyboard_VK_F3 | F3 |
0x68 | Keyboard_VK_F4 | F4 |
0x69 | Keyboard_VK_F5 | F5 |
0x6a | Keyboard_VK_F6 | F6 |
0x6b | Keyboard_VK_F7 | F7 |
0x6c | Keyboard_VK_F8 | F8 |
0x6d | Keyboard_VK_F9 | F9 |
0x6e | Keyboard_VK_F10 | F10 |
0x6f | Keyboard_VK_F11 | F11 |
0x70 | Keyboard_VK_F12 | F12 |
0x71 | Keyboard_VK_F13 | F13 |
0x72 | Keyboard_VK_F14 | F14 |
0x73 | Keyboard_VK_F15 | F15 |
0x74 | Keyboard_VK_F16 | F16 |
0x75 | Keyboard_VK_F17 | F17 |
0x76 | Keyboard_VK_F18 | F18 |
0x77 | Keyboard_VK_F19 | F19 |
0x78 | Keyboard_VK_F20 | F20 |
0x79 | Keyboard_VK_F21 | F21 |
0x7a | Keyboard_VK_F22 | F22 |
0x7b | Keyboard_VK_F23 | F23 |
0x7c | Keyboard_VK_F24 | F24 |
0x7d | Keyboard_VK_LWIN | Left window |
0x7e | Keyboard_VK_RWIN | Right window |
0x7f | Keyboard_VK_MENU | Menu |
0x80 | Keyboard_VK_MACRO | Macro |
0x81-0xff | Not used |
Many virtual keys have a different meaning depending on the keyboard layout.
typedef struct { unsigned short interSize; unsigned short impSize; char names[1]; } Keyboard_LayoutInfo;
Where interSize it's the size of the name of the interface including the terminating zero, impSize it's the size of the name of the implementation including the terminating zero and names it's the area where the names are, first the name of the interface followed by the name of the implementation.
This interface defines the following groups and keys available using the CfgManager interface:
/system/Keyboard | ||
These keys are defined:
Some examples:
|
These functions are exclusive for system modules.
const char *Keyboard_GetLayout(void);
This function gets the name of the implementation of the KbdLayout interface that is been used by the keyboard.
The name of the implementation or NULL in case of error.
int Keyboard_SetLayout(const char *imp);
This function sets the keyboard layout to imp, which is the name of a KbdLayout interface implementation.
These functions were designed for user modules.
int Keyboard_UGetLayout(Keyboard_LayoutInfo *info, unsigned int size);
User modules
This function gets informations about the implementation of the KbdLayout interface that is been used by the keyboard.
size it's the total size of info.
In case of success, info will be filled with the informations.
int Keyboard_USetLayout(const char *imp);
User modules
This function sets the keyboard layout to imp, which is the name of a KbdLayout interface implementation.