Changeset 801579fe in mainline
- Timestamp:
- 2006-09-07T19:46:23Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 253f35a1
- Parents:
- 9141377
- Location:
- uspace/kbd
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/kbd/arch/ia32/include/kbd.h
r9141377 r801579fe 37 37 */ 38 38 39 #ifndef __ia32_KBD_H__40 #define __ia32_KBD_H__39 #ifndef KBD_ia32_KBD_H_ 40 #define KBD_ia32_KBD_H_ 41 41 42 #include <key_buffer.h>43 42 #include <ddi.h> 44 43 #include <libarch/ddi.h> … … 74 73 } 75 74 76 int kbd_arch_init(void);77 78 75 #endif 79 76 … … 81 78 * @} 82 79 */ 83 -
uspace/kbd/arch/ia32/src/kbd.c
r9141377 r801579fe 42 42 #include <kbd.h> 43 43 #include <keys.h> 44 #include <genarch/kbd.h> 44 45 45 46 /* Interesting bits for status register */ … … 63 64 #define MOUSE_ACK 0xfa 64 65 65 66 #define SPECIAL 25567 66 #define KEY_RELEASE 0x80 68 69 /**70 * These codes read from i8042 data register are silently ignored.71 */72 #define IGNORE_CODE 0x7f73 74 #define PRESSED_SHIFT (1<<0)75 #define PRESSED_CAPSLOCK (1<<1)76 #define LOCKED_CAPSLOCK (1<<0)77 78 /** Scancodes. */79 #define SC_ESC 0x0180 #define SC_BACKSPACE 0x0e81 #define SC_LSHIFT 0x2a82 #define SC_RSHIFT 0x3683 #define SC_CAPSLOCK 0x3a84 #define SC_SPEC_ESCAPE 0xe085 #define SC_LEFTARR 0x4b86 #define SC_RIGHTARR 0x4d87 #define SC_UPARR 0x4888 #define SC_DOWNARR 0x5089 #define SC_DELETE 0x5390 #define SC_HOME 0x4791 #define SC_END 0x4f92 93 #define FUNCTION_KEYS 0x10094 67 95 68 static volatile int keyflags; /**< Tracking of multiple keypresses. */ 96 69 static volatile int lockflags; /**< Tracking of multiple keys lockings. */ 97 98 /** Primary meaning of scancodes. */99 static int sc_primary_map[] = {100 SPECIAL, /* 0x00 */101 SPECIAL, /* 0x01 - Esc */102 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',103 '\b', /* 0x0e - Backspace */104 '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',105 SPECIAL, /* 0x1d - LCtrl */106 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'',107 '`',108 SPECIAL, /* 0x2a - LShift */109 '\\',110 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',111 SPECIAL, /* 0x36 - RShift */112 '*',113 SPECIAL, /* 0x38 - LAlt */114 ' ',115 SPECIAL, /* 0x3a - CapsLock */116 (FUNCTION_KEYS | 1), /* 0x3b - F1 */117 (FUNCTION_KEYS | 2), /* 0x3c - F2 */118 (FUNCTION_KEYS | 3), /* 0x3d - F3 */119 (FUNCTION_KEYS | 4), /* 0x3e - F4 */120 (FUNCTION_KEYS | 5), /* 0x3f - F5 */121 (FUNCTION_KEYS | 6), /* 0x40 - F6 */122 (FUNCTION_KEYS | 7), /* 0x41 - F7 */123 (FUNCTION_KEYS | 8), /* 0x42 - F8 */124 (FUNCTION_KEYS | 9), /* 0x43 - F9 */125 (FUNCTION_KEYS | 10), /* 0x44 - F10 */126 SPECIAL, /* 0x45 - NumLock */127 SPECIAL, /* 0x46 - ScrollLock */128 '7', '8', '9', '-',129 '4', '5', '6', '+',130 '1', '2', '3',131 '0', '.',132 SPECIAL, /* 0x54 - Alt-SysRq */133 SPECIAL, /* 0x55 - F11/F12/PF1/FN */134 SPECIAL, /* 0x56 - unlabelled key next to LAlt */135 (FUNCTION_KEYS | 11), /* 0x57 - F11 */136 (FUNCTION_KEYS | 12), /* 0x58 - F12 */137 SPECIAL, /* 0x59 */138 SPECIAL, /* 0x5a */139 SPECIAL, /* 0x5b */140 SPECIAL, /* 0x5c */141 SPECIAL, /* 0x5d */142 SPECIAL, /* 0x5e */143 SPECIAL, /* 0x5f */144 SPECIAL, /* 0x60 */145 SPECIAL, /* 0x61 */146 SPECIAL, /* 0x62 */147 SPECIAL, /* 0x63 */148 SPECIAL, /* 0x64 */149 SPECIAL, /* 0x65 */150 SPECIAL, /* 0x66 */151 SPECIAL, /* 0x67 */152 SPECIAL, /* 0x68 */153 SPECIAL, /* 0x69 */154 SPECIAL, /* 0x6a */155 SPECIAL, /* 0x6b */156 SPECIAL, /* 0x6c */157 SPECIAL, /* 0x6d */158 SPECIAL, /* 0x6e */159 SPECIAL, /* 0x6f */160 SPECIAL, /* 0x70 */161 SPECIAL, /* 0x71 */162 SPECIAL, /* 0x72 */163 SPECIAL, /* 0x73 */164 SPECIAL, /* 0x74 */165 SPECIAL, /* 0x75 */166 SPECIAL, /* 0x76 */167 SPECIAL, /* 0x77 */168 SPECIAL, /* 0x78 */169 SPECIAL, /* 0x79 */170 SPECIAL, /* 0x7a */171 SPECIAL, /* 0x7b */172 SPECIAL, /* 0x7c */173 SPECIAL, /* 0x7d */174 SPECIAL, /* 0x7e */175 SPECIAL, /* 0x7f */176 };177 178 /** Secondary meaning of scancodes. */179 static int sc_secondary_map[] = {180 SPECIAL, /* 0x00 */181 0x1b, /* 0x01 - Esc */182 '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',183 SPECIAL, /* 0x0e - Backspace */184 '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n',185 SPECIAL, /* 0x1d - LCtrl */186 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"',187 '~',188 SPECIAL, /* 0x2a - LShift */189 '|',190 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',191 SPECIAL, /* 0x36 - RShift */192 '*',193 SPECIAL, /* 0x38 - LAlt */194 ' ',195 SPECIAL, /* 0x3a - CapsLock */196 SPECIAL, /* 0x3b - F1 */197 SPECIAL, /* 0x3c - F2 */198 SPECIAL, /* 0x3d - F3 */199 SPECIAL, /* 0x3e - F4 */200 SPECIAL, /* 0x3f - F5 */201 SPECIAL, /* 0x40 - F6 */202 SPECIAL, /* 0x41 - F7 */203 SPECIAL, /* 0x42 - F8 */204 SPECIAL, /* 0x43 - F9 */205 SPECIAL, /* 0x44 - F10 */206 SPECIAL, /* 0x45 - NumLock */207 SPECIAL, /* 0x46 - ScrollLock */208 '7', '8', '9', '-',209 '4', '5', '6', '+',210 '1', '2', '3',211 '0', '.',212 SPECIAL, /* 0x54 - Alt-SysRq */213 SPECIAL, /* 0x55 - F11/F12/PF1/FN */214 SPECIAL, /* 0x56 - unlabelled key next to LAlt */215 SPECIAL, /* 0x57 - F11 */216 SPECIAL, /* 0x58 - F12 */217 SPECIAL, /* 0x59 */218 SPECIAL, /* 0x5a */219 SPECIAL, /* 0x5b */220 SPECIAL, /* 0x5c */221 SPECIAL, /* 0x5d */222 SPECIAL, /* 0x5e */223 SPECIAL, /* 0x5f */224 SPECIAL, /* 0x60 */225 SPECIAL, /* 0x61 */226 SPECIAL, /* 0x62 */227 SPECIAL, /* 0x63 */228 SPECIAL, /* 0x64 */229 SPECIAL, /* 0x65 */230 SPECIAL, /* 0x66 */231 SPECIAL, /* 0x67 */232 SPECIAL, /* 0x68 */233 SPECIAL, /* 0x69 */234 SPECIAL, /* 0x6a */235 SPECIAL, /* 0x6b */236 SPECIAL, /* 0x6c */237 SPECIAL, /* 0x6d */238 SPECIAL, /* 0x6e */239 SPECIAL, /* 0x6f */240 SPECIAL, /* 0x70 */241 SPECIAL, /* 0x71 */242 SPECIAL, /* 0x72 */243 SPECIAL, /* 0x73 */244 SPECIAL, /* 0x74 */245 SPECIAL, /* 0x75 */246 SPECIAL, /* 0x76 */247 SPECIAL, /* 0x77 */248 SPECIAL, /* 0x78 */249 SPECIAL, /* 0x79 */250 SPECIAL, /* 0x7a */251 SPECIAL, /* 0x7b */252 SPECIAL, /* 0x7c */253 SPECIAL, /* 0x7d */254 SPECIAL, /* 0x7e */255 SPECIAL, /* 0x7f */256 };257 70 258 71 irq_cmd_t i8042_cmds[2] = { … … 265 78 i8042_cmds 266 79 }; 267 268 static void key_released(keybuffer_t *keybuffer, unsigned char key)269 {270 switch (key) {271 case SC_LSHIFT:272 case SC_RSHIFT:273 keyflags &= ~PRESSED_SHIFT;274 break;275 case SC_CAPSLOCK:276 keyflags &= ~PRESSED_CAPSLOCK;277 if (lockflags & LOCKED_CAPSLOCK)278 lockflags &= ~LOCKED_CAPSLOCK;279 else280 lockflags |= LOCKED_CAPSLOCK;281 break;282 default:283 break;284 }285 }286 287 static void key_pressed(keybuffer_t *keybuffer, unsigned char key)288 {289 int *map = sc_primary_map;290 int ascii = sc_primary_map[key];291 int shift, capslock;292 int letter = 0;293 294 static int esc_count=0;295 296 297 if ( key == SC_ESC ) {298 esc_count++;299 if ( esc_count == 3 ) {300 __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);301 }302 } else {303 esc_count=0;304 }305 306 307 308 switch (key) {309 case SC_LSHIFT:310 case SC_RSHIFT:311 keyflags |= PRESSED_SHIFT;312 break;313 case SC_CAPSLOCK:314 keyflags |= PRESSED_CAPSLOCK;315 break;316 case SC_SPEC_ESCAPE:317 break;318 /* case SC_LEFTARR:319 if (keybuffer_available(keybuffer) >= 3) {320 keybuffer_push(keybuffer, 0x1b);321 keybuffer_push(keybuffer, 0x5b);322 keybuffer_push(keybuffer, 0x44);323 }324 break;325 case SC_RIGHTARR:326 if (keybuffer_available(keybuffer) >= 3) {327 keybuffer_push(keybuffer, 0x1b);328 keybuffer_push(keybuffer, 0x5b);329 keybuffer_push(keybuffer, 0x43);330 }331 break;332 case SC_UPARR:333 if (keybuffer_available(keybuffer) >= 3) {334 keybuffer_push(keybuffer, 0x1b);335 keybuffer_push(keybuffer, 0x5b);336 keybuffer_push(keybuffer, 0x41);337 }338 break;339 case SC_DOWNARR:340 if (keybuffer_available(keybuffer) >= 3) {341 keybuffer_push(keybuffer, 0x1b);342 keybuffer_push(keybuffer, 0x5b);343 keybuffer_push(keybuffer, 0x42);344 }345 break;346 case SC_HOME:347 if (keybuffer_available(keybuffer) >= 3) {348 keybuffer_push(keybuffer, 0x1b);349 keybuffer_push(keybuffer, 0x4f);350 keybuffer_push(keybuffer, 0x48);351 }352 break;353 case SC_END:354 if (keybuffer_available(keybuffer) >= 3) {355 keybuffer_push(keybuffer, 0x1b);356 keybuffer_push(keybuffer, 0x4f);357 keybuffer_push(keybuffer, 0x46);358 }359 break;360 case SC_DELETE:361 if (keybuffer_available(keybuffer) >= 4) {362 keybuffer_push(keybuffer, 0x1b);363 keybuffer_push(keybuffer, 0x5b);364 keybuffer_push(keybuffer, 0x33);365 keybuffer_push(keybuffer, 0x7e);366 }367 break;368 */ default:369 letter = ((ascii >= 'a') && (ascii <= 'z'));370 capslock = (keyflags & PRESSED_CAPSLOCK) || (lockflags & LOCKED_CAPSLOCK);371 shift = keyflags & PRESSED_SHIFT;372 if (letter && capslock)373 shift = !shift;374 if (shift)375 map = sc_secondary_map;376 if (map[key] != SPECIAL)377 keybuffer_push(keybuffer, map[key]);378 break;379 }380 }381 382 80 383 81 static void wait_ready(void) { … … 462 160 int scan_code = IPC_GET_ARG2(*call); 463 161 464 if (scan_code != IGNORE_CODE) { 465 if (scan_code & KEY_RELEASE) 466 key_released(keybuffer, scan_code ^ KEY_RELEASE); 467 else 468 key_pressed(keybuffer, scan_code); 469 } 162 if (scan_code & KEY_RELEASE) 163 key_released(keybuffer, scan_code ^ KEY_RELEASE); 164 else 165 key_pressed(keybuffer, scan_code); 470 166 return 1; 471 167 } … … 474 170 * @} 475 171 */ 476 -
uspace/kbd/arch/ia64/include/kbd.h
r9141377 r801579fe 35 35 */ 36 36 37 38 #ifndef __ia64_KBD_H__ 39 #define __ia64_KBD_H__ 40 41 #include <key_buffer.h> 42 43 int kbd_arch_init(void); 37 #ifndef KBD_ia64_KBD_H_ 38 #define KBD_ia64_KBD_H_ 44 39 45 40 #endif -
uspace/kbd/arch/ia64/src/kbd.c
r9141377 r801579fe 54 54 #define KEY_F12 0x7e34325b1b 55 55 56 57 56 #define FUNCTION_KEYS 0x100 58 57 … … 91 90 int scan_code = IPC_GET_ARG2(*call); 92 91 93 94 92 /* 95 93 * Please preserve this code (it can be used to determine scancodes) … … 105 103 } else { 106 104 107 108 105 if (buf == 0x1b) { 109 106 esc_count++; … … 119 116 } else { 120 117 switch (buf) { 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 118 case KEY_F1: 119 keybuffer_push(keybuffer, FUNCTION_KEYS | 1); 120 break; 121 case KEY_F2: 122 keybuffer_push(keybuffer, FUNCTION_KEYS | 2); 123 break; 124 case KEY_F3: 125 keybuffer_push(keybuffer, FUNCTION_KEYS | 3); 126 break; 127 case KEY_F4: 128 keybuffer_push(keybuffer, FUNCTION_KEYS | 4); 129 break; 130 case KEY_F5: 131 keybuffer_push(keybuffer, FUNCTION_KEYS | 5); 132 break; 133 case KEY_F6: 134 keybuffer_push(keybuffer, FUNCTION_KEYS | 6); 135 break; 136 case KEY_F7: 137 keybuffer_push(keybuffer, FUNCTION_KEYS | 7); 138 break; 139 case KEY_F8: 140 keybuffer_push(keybuffer, FUNCTION_KEYS | 8); 141 break; 142 case KEY_F9: 143 keybuffer_push(keybuffer, FUNCTION_KEYS | 9); 144 break; 145 case KEY_F10: 146 keybuffer_push(keybuffer, FUNCTION_KEYS | 10); 147 break; 148 case KEY_F11: 149 keybuffer_push(keybuffer, FUNCTION_KEYS | 11); 150 break; 151 case KEY_F12: 152 keybuffer_push(keybuffer, FUNCTION_KEYS | 12); 153 break; 157 154 } 158 155 } -
uspace/kbd/arch/mips32/include/kbd.h
r9141377 r801579fe 35 35 */ 36 36 37 #ifndef __mips32_KBD_H__ 38 #define __mips32_KBD_H__ 39 40 #include <key_buffer.h> 41 42 int kbd_arch_init(void); 37 #ifndef KBD_mips32_KBD_H_ 38 #define KBD_mips32_KBD_H_ 43 39 44 40 #endif -
uspace/kbd/arch/mips32/src/kbd.c
r9141377 r801579fe 53 53 #define MSIM_KEY_F12 0x34325b1bL 54 54 55 56 55 #define GXEMUL_KEY_F1 0x504f5b1bL 57 56 #define GXEMUL_KEY_F2 0x514f5b1bL … … 67 66 #define GXEMUL_KEY_F12 0x34325b1bL 68 67 69 70 68 #define FUNCTION_KEYS 0x100 71 72 69 73 70 irq_cmd_t msim_cmds[1] = { … … 86 83 int kbd_arch_init(void) 87 84 { 88 fb_fb =sysinfo_value("fb.kind")==1;85 fb_fb = (sysinfo_value("fb.kind") == 1); 89 86 ipc_register_irq(2, &msim_kbd); 90 87 return 0; … … 105 102 { 106 103 107 static unsigned long buf=0; 108 static int count=0; 109 104 static unsigned long buf = 0; 105 static int count = 0; 110 106 111 107 /* Please preserve this code (it can be used to determine scancodes) … … 119 115 */ 120 116 121 if(scan_code==0x7e) 122 { 123 switch (buf){ 124 case MSIM_KEY_F5: 125 keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); 126 buf=count=0; 127 return 1; 128 case MSIM_KEY_F6: 129 keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); 130 buf=count=0; 131 return 1; 132 case MSIM_KEY_F7: 133 keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); 134 buf=count=0; 135 return 1; 136 case MSIM_KEY_F8: 137 keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); 138 buf=count=0; 139 return 1; 140 141 case MSIM_KEY_F9: 142 keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); 143 buf=count=0; 144 return 1; 145 case MSIM_KEY_F10: 146 keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); 147 buf=count=0; 148 return 1; 149 150 case MSIM_KEY_F11: 151 keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); 152 buf=count=0; 153 return 1; 154 case MSIM_KEY_F12: 155 keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); 156 buf=count=0; 157 return 1; 158 default: 159 keybuffer_push(keybuffer, buf & 0xff ); 160 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 161 keybuffer_push(keybuffer, (buf >> 16) &0xff ); 162 keybuffer_push(keybuffer, (buf >> 24) &0xff ); 163 keybuffer_push(keybuffer, scan_code ); 164 buf=count=0; 165 return 1; 166 117 if(scan_code == 0x7e) { 118 switch (buf) { 119 case MSIM_KEY_F5: 120 keybuffer_push(keybuffer,FUNCTION_KEYS | 5); 121 buf = count = 0; 122 return 1; 123 case MSIM_KEY_F6: 124 keybuffer_push(keybuffer,FUNCTION_KEYS | 6); 125 buf = count = 0; 126 return 1; 127 case MSIM_KEY_F7: 128 keybuffer_push(keybuffer,FUNCTION_KEYS | 7); 129 buf = count = 0; 130 return 1; 131 case MSIM_KEY_F8: 132 keybuffer_push(keybuffer,FUNCTION_KEYS | 8); 133 buf = count = 0; 134 return 1; 135 case MSIM_KEY_F9: 136 keybuffer_push(keybuffer,FUNCTION_KEYS | 9); 137 buf = count = 0; 138 return 1; 139 case MSIM_KEY_F10: 140 keybuffer_push(keybuffer,FUNCTION_KEYS | 10); 141 buf = count = 0; 142 return 1; 143 case MSIM_KEY_F11: 144 keybuffer_push(keybuffer,FUNCTION_KEYS | 11); 145 buf = count = 0; 146 return 1; 147 case MSIM_KEY_F12: 148 keybuffer_push(keybuffer,FUNCTION_KEYS | 12); 149 buf = count = 0; 150 return 1; 151 default: 152 keybuffer_push(keybuffer, buf & 0xff); 153 keybuffer_push(keybuffer, (buf >> 8) &0xff); 154 keybuffer_push(keybuffer, (buf >> 16) &0xff); 155 keybuffer_push(keybuffer, (buf >> 24) &0xff); 156 keybuffer_push(keybuffer, scan_code); 157 buf = count = 0; 158 return 1; 167 159 } 168 160 } 169 161 170 buf|=((unsigned long) scan_code)<<(8*(count++)); 171 172 173 if((buf & 0xff)!= (MSIM_KEY_F1 & 0xff)) { 174 175 keybuffer_push(keybuffer,buf ); 176 buf=count=0; 177 return 1; 178 } 179 180 if ( count <= 1 ) 181 return 1; 182 183 if( (buf & 0xffff) != (MSIM_KEY_F1 & 0xffff) 184 && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) { 185 186 keybuffer_push(keybuffer, buf & 0xff ); 187 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 188 buf=count=0; 189 return 1; 190 } 191 192 if ( count <= 2) 193 return 1; 194 195 switch (buf){ 196 case MSIM_KEY_F1: 197 keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); 198 buf=count=0; 199 return 1; 200 case MSIM_KEY_F2: 201 keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); 202 buf=count=0; 203 return 1; 204 case MSIM_KEY_F3: 205 keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); 206 buf=count=0; 207 return 1; 208 case MSIM_KEY_F4: 209 keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); 210 buf=count=0; 211 return 1; 212 } 213 214 215 if( (buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff) 216 && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff) ) { 217 218 keybuffer_push(keybuffer, buf & 0xff ); 219 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 220 keybuffer_push(keybuffer, (buf >> 16) &0xff ); 221 buf=count=0; 222 return 1; 223 } 224 225 if ( count <= 3 ) 226 return 1; 227 228 229 230 231 switch (buf){ 232 case MSIM_KEY_F5: 233 case MSIM_KEY_F6: 234 case MSIM_KEY_F7: 235 case MSIM_KEY_F8: 236 case MSIM_KEY_F9: 237 case MSIM_KEY_F10: 238 case MSIM_KEY_F11: 239 case MSIM_KEY_F12: 240 return 1; 241 default: 242 keybuffer_push(keybuffer, buf & 0xff ); 243 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 244 keybuffer_push(keybuffer, (buf >> 16) &0xff ); 245 keybuffer_push(keybuffer, (buf >> 24) &0xff ); 246 buf=count=0; 247 return 1; 248 249 } 162 buf |= ((unsigned long) scan_code)<<(8*(count++)); 163 164 if((buf & 0xff) != (MSIM_KEY_F1 & 0xff)) { 165 keybuffer_push(keybuffer, buf); 166 buf = count = 0; 167 return 1; 168 } 169 170 if (count <= 1) 171 return 1; 172 173 if ((buf & 0xffff) != (MSIM_KEY_F1 & 0xffff) 174 && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) { 175 176 keybuffer_push(keybuffer, buf & 0xff); 177 keybuffer_push(keybuffer, (buf >> 8) &0xff); 178 buf = count = 0; 179 return 1; 180 } 181 182 if (count <= 2) 183 return 1; 184 185 switch (buf) { 186 case MSIM_KEY_F1: 187 keybuffer_push(keybuffer,FUNCTION_KEYS | 1); 188 buf = count = 0; 189 return 1; 190 case MSIM_KEY_F2: 191 keybuffer_push(keybuffer,FUNCTION_KEYS | 2); 192 buf = count = 0; 193 return 1; 194 case MSIM_KEY_F3: 195 keybuffer_push(keybuffer,FUNCTION_KEYS | 3); 196 buf = count = 0; 197 return 1; 198 case MSIM_KEY_F4: 199 keybuffer_push(keybuffer,FUNCTION_KEYS | 4); 200 buf = count = 0; 201 return 1; 202 } 203 204 205 if((buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff) 206 && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff)) { 207 208 keybuffer_push(keybuffer, buf & 0xff); 209 keybuffer_push(keybuffer, (buf >> 8) & 0xff); 210 keybuffer_push(keybuffer, (buf >> 16) & 0xff); 211 buf=count=0; 212 return 1; 213 } 214 215 if (count <= 3) 216 return 1; 217 218 switch (buf) { 219 case MSIM_KEY_F5: 220 case MSIM_KEY_F6: 221 case MSIM_KEY_F7: 222 case MSIM_KEY_F8: 223 case MSIM_KEY_F9: 224 case MSIM_KEY_F10: 225 case MSIM_KEY_F11: 226 case MSIM_KEY_F12: 227 return 1; 228 default: 229 keybuffer_push(keybuffer, buf & 0xff); 230 keybuffer_push(keybuffer, (buf >> 8) &0xff); 231 keybuffer_push(keybuffer, (buf >> 16) &0xff); 232 keybuffer_push(keybuffer, (buf >> 24) &0xff); 233 buf = count = 0; 234 return 1; 235 } 250 236 return 1; 251 237 } … … 255 241 static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code) 256 242 { 257 258 static unsigned long buf=0; 259 static int count=0; 260 243 static unsigned long buf = 0; 244 static int count = 0; 261 245 262 246 /* Please preserve this code (it can be used to determine scancodes) … … 270 254 */ 271 255 272 if ( scan_code == '\r' ) 273 scan_code = '\n' ; 274 275 buf|=((unsigned long) scan_code)<<(8*(count++)); 276 277 278 if((buf & 0xff)!= (GXEMUL_KEY_F1 & 0xff)) { 279 280 keybuffer_push(keybuffer,buf ); 281 buf=count=0; 282 return 1; 283 } 284 285 if ( count <= 1 ) 286 return 1; 287 288 if( (buf & 0xffff) != (GXEMUL_KEY_F1 & 0xffff) ) { 289 290 keybuffer_push(keybuffer, buf & 0xff ); 291 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 292 buf=count=0; 293 return 1; 294 } 295 296 if ( count <= 2) 297 return 1; 298 299 300 if( (buf & 0xffffff) != (GXEMUL_KEY_F1 & 0xffffff) 301 && (buf & 0xffffff) != (GXEMUL_KEY_F5 & 0xffffff) 302 && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff) ) { 303 256 if (scan_code == '\r') 257 scan_code = '\n'; 258 259 buf |= ((unsigned long) scan_code)<<(8*(count++)); 260 261 262 if ((buf & 0xff) != (GXEMUL_KEY_F1 & 0xff)) { 263 keybuffer_push(keybuffer, buf); 264 buf = count = 0; 265 return 1; 266 } 267 268 if (count <= 1) 269 return 1; 270 271 if ((buf & 0xffff) != (GXEMUL_KEY_F1 & 0xffff)) { 272 keybuffer_push(keybuffer, buf & 0xff); 273 keybuffer_push(keybuffer, (buf >> 8) &0xff); 274 buf = count = 0; 275 return 1; 276 } 277 278 if (count <= 2) 279 return 1; 280 281 282 if ((buf & 0xffffff) != (GXEMUL_KEY_F1 & 0xffffff) 283 && (buf & 0xffffff) != (GXEMUL_KEY_F5 & 0xffffff) 284 && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff)) { 285 286 keybuffer_push(keybuffer, buf & 0xff); 287 keybuffer_push(keybuffer, (buf >> 8) & 0xff); 288 keybuffer_push(keybuffer, (buf >> 16) & 0xff); 289 buf = count = 0; 290 return 1; 291 } 292 293 if ( count <= 3 ) 294 return 1; 295 296 297 switch (buf) { 298 case GXEMUL_KEY_F1: 299 keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); 300 buf=count=0; 301 return 1; 302 case GXEMUL_KEY_F2: 303 keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); 304 buf=count=0; 305 return 1; 306 case GXEMUL_KEY_F3: 307 keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); 308 buf=count=0; 309 return 1; 310 case GXEMUL_KEY_F4: 311 keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); 312 buf=count=0; 313 return 1; 314 case GXEMUL_KEY_F5: 315 keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); 316 buf=count=0; 317 return 1; 318 case GXEMUL_KEY_F6: 319 keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); 320 buf=count=0; 321 return 1; 322 case GXEMUL_KEY_F7: 323 keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); 324 buf=count=0; 325 return 1; 326 case GXEMUL_KEY_F8: 327 keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); 328 buf=count=0; 329 return 1; 330 case GXEMUL_KEY_F9: 331 keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); 332 buf=count=0; 333 return 1; 334 case GXEMUL_KEY_F10: 335 keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); 336 buf=count=0; 337 return 1; 338 case GXEMUL_KEY_F11: 339 keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); 340 buf=count=0; 341 return 1; 342 case GXEMUL_KEY_F12: 343 keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); 344 buf=count=0; 345 return 1; 346 default: 304 347 keybuffer_push(keybuffer, buf & 0xff ); 305 348 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 306 349 keybuffer_push(keybuffer, (buf >> 16) &0xff ); 307 buf=count=0; 308 return 1; 309 } 310 311 if ( count <= 3 ) 312 return 1; 313 314 315 switch (buf){ 316 317 case GXEMUL_KEY_F1: 318 keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); 319 buf=count=0; 320 return 1; 321 case GXEMUL_KEY_F2: 322 keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); 323 buf=count=0; 324 return 1; 325 case GXEMUL_KEY_F3: 326 keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); 327 buf=count=0; 328 return 1; 329 case GXEMUL_KEY_F4: 330 keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); 331 buf=count=0; 332 return 1; 333 case GXEMUL_KEY_F5: 334 keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); 335 buf=count=0; 336 return 1; 337 case GXEMUL_KEY_F6: 338 keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); 339 buf=count=0; 340 return 1; 341 case GXEMUL_KEY_F7: 342 keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); 343 buf=count=0; 344 return 1; 345 case GXEMUL_KEY_F8: 346 keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); 347 buf=count=0; 348 return 1; 349 case GXEMUL_KEY_F9: 350 keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); 351 buf=count=0; 352 return 1; 353 case GXEMUL_KEY_F10: 354 keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); 355 buf=count=0; 356 return 1; 357 case GXEMUL_KEY_F11: 358 keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); 359 buf=count=0; 360 return 1; 361 case GXEMUL_KEY_F12: 362 keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); 363 buf=count=0; 364 return 1; 365 366 default: 367 keybuffer_push(keybuffer, buf & 0xff ); 368 keybuffer_push(keybuffer, (buf >> 8) &0xff ); 369 keybuffer_push(keybuffer, (buf >> 16) &0xff ); 370 keybuffer_push(keybuffer, (buf >> 24) &0xff ); 371 buf=count=0; 372 return 1; 373 374 } 350 keybuffer_push(keybuffer, (buf >> 24) &0xff ); 351 buf=count=0; 352 return 1; 353 } 375 354 return 1; 376 355 } … … 381 360 static int esc_count=0; 382 361 383 384 if ( scan_code == 0x1b ) { 362 if (scan_code == 0x1b) { 385 363 esc_count++; 386 if ( esc_count == 3 ) {364 if (esc_count == 3) 387 365 __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); 388 }389 366 } else { 390 367 esc_count=0; 391 368 } 392 369 393 if(fb_fb) return kbd_arch_process_fb(keybuffer, scan_code); 370 if (fb_fb) 371 return kbd_arch_process_fb(keybuffer, scan_code); 372 394 373 return kbd_arch_process_no_fb(keybuffer, scan_code); 395 396 return 0;397 374 } 398 375 /** @} -
uspace/kbd/arch/ppc32/include/kbd.h
r9141377 r801579fe 35 35 */ 36 36 37 #ifndef __ppc32_KBD_H__ 38 #define __ppc32_KBD_H__ 39 40 #include <key_buffer.h> 41 42 int kbd_arch_init(void); 37 #ifndef KBD_ppc32_KBD_H_ 38 #define KBD_ppc32_KBD_H_ 43 39 44 40 #endif -
uspace/kbd/arch/ppc64/include/kbd.h
r9141377 r801579fe 35 35 */ 36 36 37 #ifndef __ppc64_KBD_H__ 38 #define __ppc64_KBD_H__ 39 40 #include <key_buffer.h> 41 42 int kbd_arch_init(void); 37 #ifndef KBD_ppc64_KBD_H_ 38 #define KBD_ppc64_KBD_H_ 43 39 44 40 #endif -
uspace/kbd/include/kbd.h
r9141377 r801579fe 35 35 */ 36 36 37 #ifndef __KBD_H__38 #define __KBD_H__37 #ifndef KBD_KBD_H_ 38 #define KBD_KBD_H_ 39 39 40 40 #include <key_buffer.h> 41 41 42 int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call); 43 int mouse_arch_process(int phoneid, ipc_call_t *call); 42 extern int kbd_arch_init(void); 43 extern int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call); 44 extern int mouse_arch_process(int phoneid, ipc_call_t *call); 44 45 45 46 #endif -
uspace/kbd/include/keys.h
r9141377 r801579fe 31 31 * @{ 32 32 */ 33 34 35 33 /** 34 * @file 35 */ 36 36 37 37 #ifndef _KBD_KEYS_H_
Note:
See TracChangeset
for help on using the changeset viewer.