00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00038 #include <kbd.h>
00039 #include <io/console.h>
00040 #include <io/keycode.h>
00041 #include <kbd_ctl.h>
00042
00043 #define KBD_KEY_RELEASE 0x80
00044 #define KBD_ALL_KEYS_UP 0x7f
00045
00046 static int scanmap_simple[];
00047
00048 int kbd_ctl_init(void)
00049 {
00050 return 0;
00051 }
00052
00053 void kbd_ctl_parse_scancode(int scancode)
00054 {
00055 console_ev_type_t type;
00056 unsigned int key;
00057
00058 if (scancode < 0 || scancode >= 0x100)
00059 return;
00060
00061 if (scancode == KBD_ALL_KEYS_UP)
00062 return;
00063
00064 if (scancode & KBD_KEY_RELEASE) {
00065 scancode &= ~KBD_KEY_RELEASE;
00066 type = KEY_RELEASE;
00067 } else {
00068 type = KEY_PRESS;
00069 }
00070
00071 key = scanmap_simple[scancode];
00072 if (key != 0)
00073 kbd_push_ev(type, key);
00074 }
00075
00076 void kbd_ctl_set_ind(unsigned mods)
00077 {
00078 (void) mods;
00079 }
00080
00082 static int scanmap_simple[] = {
00083 [0x00] = 0,
00084 [0x01] = 0,
00085 [0x02] = 0,
00086 [0x03] = 0,
00087 [0x04] = 0,
00088 [0x05] = KC_F1,
00089 [0x06] = KC_F2,
00090 [0x07] = KC_F10,
00091 [0x08] = KC_F3,
00092 [0x09] = KC_F11,
00093 [0x0a] = KC_F4,
00094 [0x0b] = KC_F12,
00095 [0x0c] = KC_F5,
00096 [0x0d] = KC_RALT,
00097 [0x0e] = KC_F6,
00098 [0x0f] = 0,
00099 [0x10] = KC_F7,
00100 [0x11] = KC_F8,
00101 [0x12] = KC_F9,
00102 [0x13] = KC_LALT,
00103 [0x14] = KC_UP,
00104 [0x15] = KC_PAUSE,
00105 [0x16] = 0,
00106 [0x17] = KC_SCROLL_LOCK,
00107 [0x18] = KC_LEFT,
00108 [0x19] = 0,
00109 [0x1a] = 0,
00110 [0x1b] = KC_DOWN,
00111 [0x1c] = KC_RIGHT,
00112 [0x1d] = KC_ESCAPE,
00113 [0x1e] = KC_1,
00114 [0x1f] = KC_2,
00115 [0x20] = KC_3,
00116 [0x21] = KC_4,
00117 [0x22] = KC_5,
00118 [0x23] = KC_6,
00119 [0x24] = KC_7,
00120 [0x25] = KC_8,
00121 [0x26] = KC_9,
00122 [0x27] = KC_0,
00123 [0x28] = KC_MINUS,
00124 [0x29] = KC_EQUALS,
00125 [0x2a] = KC_BACKTICK,
00126 [0x2b] = KC_BACKSPACE,
00127 [0x2c] = KC_INSERT,
00128 [0x2d] = 0,
00129 [0x2e] = KC_NSLASH,
00130 [0x2f] = KC_NTIMES,
00131 [0x30] = 0,
00132 [0x31] = 0,
00133 [0x32] = KC_NPERIOD,
00134 [0x33] = 0,
00135 [0x34] = KC_HOME,
00136 [0x35] = KC_TAB,
00137 [0x36] = KC_Q,
00138 [0x37] = KC_W,
00139 [0x38] = KC_E,
00140 [0x39] = KC_R,
00141 [0x3a] = KC_T,
00142 [0x3b] = KC_Y,
00143 [0x3c] = KC_U,
00144 [0x3d] = KC_I,
00145 [0x3e] = KC_O,
00146 [0x3f] = KC_P,
00147 [0x40] = KC_LBRACKET,
00148 [0x41] = KC_RBRACKET,
00149 [0x42] = KC_DELETE,
00150 [0x43] = 0,
00151 [0x44] = KC_N7,
00152 [0x45] = KC_N8,
00153 [0x46] = KC_N9,
00154 [0x47] = KC_NMINUS,
00155 [0x48] = 0,
00156 [0x49] = 0,
00157 [0x4a] = KC_END,
00158 [0x4b] = 0,
00159 [0x4c] = KC_LCTRL,
00160 [0x4d] = KC_A,
00161 [0x4e] = KC_S,
00162 [0x4f] = KC_D,
00163 [0x50] = KC_F,
00164 [0x51] = KC_G,
00165 [0x52] = KC_H,
00166 [0x53] = KC_J,
00167 [0x54] = KC_K,
00168 [0x55] = KC_L,
00169 [0x56] = KC_SEMICOLON,
00170 [0x57] = KC_QUOTE,
00171 [0x58] = KC_BACKSLASH,
00172 [0x59] = KC_ENTER,
00173 [0x5a] = KC_NENTER,
00174 [0x5b] = KC_N4,
00175 [0x5c] = KC_N5,
00176 [0x5d] = KC_N6,
00177 [0x5e] = KC_N0,
00178 [0x5f] = 0,
00179 [0x60] = KC_PAGE_UP,
00180 [0x61] = 0,
00181 [0x62] = KC_NUM_LOCK,
00182 [0x63] = KC_LSHIFT,
00183 [0x64] = KC_Z,
00184 [0x65] = KC_X,
00185 [0x66] = KC_C,
00186 [0x67] = KC_V,
00187 [0x68] = KC_B,
00188 [0x69] = KC_N,
00189 [0x6a] = KC_M,
00190 [0x6b] = KC_COMMA,
00191 [0x6c] = KC_PERIOD,
00192 [0x6d] = KC_SLASH,
00193 [0x6e] = KC_RSHIFT,
00194 [0x6f] = 0,
00195 [0x70] = KC_N1,
00196 [0x71] = KC_N2,
00197 [0x72] = KC_N3,
00198 [0x73] = 0,
00199 [0x74] = 0,
00200 [0x75] = 0,
00201 [0x76] = 0,
00202 [0x77] = KC_CAPS_LOCK,
00203 [0x78] = 0,
00204 [0x79] = KC_SPACE,
00205 [0x7a] = 0,
00206 [0x7b] = KC_PAGE_DOWN,
00207 [0x7c] = 0,
00208 [0x7d] = KC_NPLUS,
00209 [0x7e] = 0,
00210 [0x7f] = 0
00211 };
00212