From e3c982ee44cff38bd764fbb6ab94972cf868a10a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 8 Dec 2019 12:27:00 +0100 Subject: Working text input! --- src/kernel/syscall/actions/sys_read.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/kernel/syscall/actions/sys_read.c') diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index 761eec7..673d2d9 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -1,21 +1,16 @@ -#include +#include #include -#include -#include #include -#include +#include +#include -uint32_t sys_read() +uint32_t sys_read(char *buf) { - serial_write("CALL\n"); - keyboard_clear_buffer(); - while (keyboard_buffer[strlen(keyboard_buffer) - 1] != '\n') { - { - timer_wait(1); // IDK why? - } + keyboard_char_buffer = 0; + while (keyboard_char_buffer != '\n') { + getch(); } - serial_write(keyboard_buffer); - serial_write("\n"); - return (uint32_t) keyboard_buffer; + memcpy(buf, keyboard_buffer, strlen(keyboard_buffer)); + return strlen(buf); } \ No newline at end of file -- cgit v1.2.3