about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp3
-rw-r--r--src/pOS/arch/x86/libc/stdio/getc.cpp9
-rw-r--r--src/pOS/include/libc/stdio.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp b/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp
index c32cbdb..c8088e3 100644
--- a/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp
+++ b/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp
@@ -9,6 +9,5 @@ void keyboard_handler(struct regs *r)
 
     //dbgprintf("Sc: %d\n", scancode);
 
-    if(!KB_BUF::scan(scancode))
-        putc(KB_BUF::keyboard_dequeue());
+    KB_BUF::scan(scancode);
 }
diff --git a/src/pOS/arch/x86/libc/stdio/getc.cpp b/src/pOS/arch/x86/libc/stdio/getc.cpp
new file mode 100644
index 0000000..e0d1b09
--- /dev/null
+++ b/src/pOS/arch/x86/libc/stdio/getc.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include "../../kernel/drivers/keyboard/include/kbbuf.h"
+
+char getc(void)
+{
+    char result;
+    while((result = KB_BUF::keyboard_dequeue()) == 0); //Sleep
+    return result;
+}
diff --git a/src/pOS/include/libc/stdio.h b/src/pOS/include/libc/stdio.h
index 844c817..7b5f144 100644
--- a/src/pOS/include/libc/stdio.h
+++ b/src/pOS/include/libc/stdio.h
@@ -14,6 +14,8 @@ int sprintf(char* buf, const char* format, ...);
 int print(const char* str);
 int putc(const char c);
 
+char getc(void); //for now void
+
 class Debug
 {
 public: