diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-11-26 23:17:55 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-11-26 23:17:55 +0100 |
| commit | 7393db6692c861bc66164c0dd9b83f23a554775b (patch) | |
| tree | d60c9deb33630d5fb6117c7c1bbc098e62a66f28 /kernel/keyboard.c | |
| parent | 9c8cfc2e52b0446f7cab14325028075760869b45 (diff) | |
changes, improvements and cleanup
Diffstat (limited to 'kernel/keyboard.c')
| -rw-r--r-- | kernel/keyboard.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/kernel/keyboard.c b/kernel/keyboard.c index 32f28f0..0274748 100644 --- a/kernel/keyboard.c +++ b/kernel/keyboard.c @@ -1,16 +1,15 @@ #define FOOLOS_MODULE_NAME "keyboard" -#include "kernel.h" -#include "console.h" #include "x86.h" +#include "console.h" #include "lib/buffer/ringbuffer.h" #include "lib/logger/log.h" // logger facilities -#include "lib/bool/bool.h" /// keyboard driver //// // http://www.computer-engineering.org/ps2keyboard/scancodes1.html +static bool ctrl_l=false; static bool shift_l=false; static bool shift_r=false; static bool capslock=false; @@ -108,12 +107,18 @@ void keyboard_handle(uint8_t in) uint8_t break_caps_lock=0xba; uint8_t break_slash=0xb5; + uint8_t make_ctrl_l=0x1d; + uint8_t break_ctrl_l=0x9d; + if(make_key_shift_l==in)shift_l=true; if(break_key_shift_l==in)shift_l=false;; if(make_key_shift_r==in)shift_r=true; if(break_key_shift_r==in)shift_r=false;; + if(make_ctrl_l==in)ctrl_l=true; + if(break_ctrl_l==in)ctrl_l=false; + if(break_caps_lock==in)capslock=!capslock; @@ -121,12 +126,20 @@ void keyboard_handle(uint8_t in) bool match=false; // optimize this! + if(ctrl_l) + { + if(in==0xa0) + { + ascii=4; //end of transmission ctrl-d + match=true; + } + } if(break_slash==in) { ascii='/'; match=true; } - if(break_key_space==in) + else if(break_key_space==in) { ascii=' '; match=true; @@ -163,7 +176,7 @@ void keyboard_handle(uint8_t in) } else if(break_key_backspace==in) { - ascii='x'; + ascii=0x08; match=true; } @@ -175,6 +188,7 @@ void keyboard_handle(uint8_t in) else for(int i=0;i<26;i++) { + if(match)break; if(break_alpha[i]==in) { ascii=('a'+i); @@ -201,8 +215,6 @@ void keyboard_handle(uint8_t in) if(match) { -// PutConsoleChar(ascii,0b1111100000011111); - console_put_char(ascii); if(!ringbuffer_put(ascii)) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"ringbuffer full.."); @@ -210,19 +222,5 @@ void keyboard_handle(uint8_t in) } -void int_kb_handler() -{ - - X86_IRQ_BEGIN - - static uint8_t kb_in; - __asm__("in $0x60, %al"); - __asm__("mov %%al, %0"::"m" (kb_in)); - //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"scancode 0x%x",kb_in); - keyboard_handle(kb_in); - - X86_IRQ_END - -} |
