summaryrefslogtreecommitdiff
path: root/kernel/keyboard.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-10-21 19:08:03 +0200
committerMichal Idziorek <m.i@gmx.at>2014-10-21 19:08:03 +0200
commitd25834310293c8a30b4a31418ff4ffd8fad8ef24 (patch)
tree97ae696211f7709002d80ecbfb8595123611d3c1 /kernel/keyboard.c
parent5b9ea685dfd12415774e4e97ad387c601dd2b43b (diff)
started implementing our first fool-shell.
Diffstat (limited to 'kernel/keyboard.c')
-rw-r--r--kernel/keyboard.c67
1 files changed, 23 insertions, 44 deletions
diff --git a/kernel/keyboard.c b/kernel/keyboard.c
index c70a03f..083e553 100644
--- a/kernel/keyboard.c
+++ b/kernel/keyboard.c
@@ -8,19 +8,15 @@
/// keyboard driver ////
+
void keyboard_handle(uint8_t in)
{
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_FINE,"scancode 0x%x",in);
-
- int i=0;
- //
- //print_hex(int_count);
uint8_t make_codes[]={
0x1e, // A
0x30, // B
0x2e, // C
- 0x20, // s/OSDev19.htmlD
+ 0x20, // D
0x12, // E
0x21, // F
0x22, // G
@@ -78,51 +74,32 @@ void keyboard_handle(uint8_t in)
uint8_t break_key_space=0xb9;
uint8_t break_key_backspace=0x8e;
- //if(last_code==*int_count)return;
-/*
- for(i=0;i<26;i++)
- {
- if(make_codes[i]==in)
- {
-// print_char_col(cursor,20,'A'+i,0xf);
-// scr_put_char('A'+i);
- }
- }
- */
+ char ascii;
- if(break_key_space==in)
- {
- scr_put_char(' ');
- shell_put(' ');
- return;
- }
+ // optimize this!
+ if(break_key_space==in)ascii=' ';
+ else if(break_key_backspace==in)ascii='x';
+ else if(break_key_enter==in)ascii='\n';
- if(break_key_backspace==in)
+ else for(int i=0;i<26;i++)
{
- scr_backspace();
- shell_backspace();
- return;
- }
-
- if(break_key_enter==in)
- {
- scr_nextline();
- shell_execute();
- return;
- }
-
- for(i=0;i<26;i++)
- {
- if(break_alpha[i]==in)
+ if(break_alpha[i]==in)
{
- //print_char_col(cursor++,20,'a'+i,SCR_RED);
- scr_put_char('A'+i);
- shell_put('A'+i);
- return;
+ ascii=('A'+i);
+ break;
+ }
+ if(i==25)
+ {
+ return;
}
}
-// last_code=in;
+
+ PutConsoleChar(ascii,0b1111100000011111);
+
+
+ if(!ringbuffer_put(ascii))
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"ringbuffer full..");
}
@@ -134,6 +111,8 @@ void int_kb_handler()
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