Orion
Barry Keyboard/Mouse drivers + POSIX names for structs 1628fcf (3 years, 2 months ago)
diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c
index c65aeaf..94b3fb3 100644
--- a/drivers/tty/tty.c
+++ b/drivers/tty/tty.c
@@ -1,5 +1,5 @@
/*
- * This file contains the implementation of the TTY Device. Generates a device
+ * This file contains the implementation of the TTY Device, generates a device
* /dev/tty, which displays to the default text video output. This file handles
* all the formatting required for a TTY.
*/
@@ -230,7 +230,7 @@ print_char(char c)
draw_char(' ', ttyX*8, ttyY*16, 0xFFFFFF, 0x000000);
/* Characters */
- if (!(tty.lflag & ECHO) && c != '\n')
+ if (!(tty.c_lflag & ECHO) && c != '\n')
goto curctl;
switch (c) {
case '\r':
@@ -294,17 +294,9 @@ curctl:
/* Handle the keyboard interrupt */
void
-keyboard_handler(InterruptFrame *frame)
+tty_keypress(unsigned char key)
{
char c;
- unsigned char key;
- int i;
- for (i = 0; i < 1000; i++) {
- if ((inb(0x64) & 1) == 0)
- continue;
- key = inb(0x60);
- break;
- }
if (key == 0x1D)
ctrl = 128;
if (key == 0x9D)
@@ -323,6 +315,11 @@ keyboard_handler(InterruptFrame *frame)
if (!c)
return;
+ if (ctrl && c == 'c') {
+ kprintf("Killing foreground process");
+ return;
+ }
+
if (c == '\b' && lineBufLen == 0)
return;
if (c == '\b')
@@ -347,7 +344,7 @@ init_tty(void)
register_driver(&ttyDriver);
mknod("/dev/tty", S_IFCHR | 0666, MKDEV(ttyDriver.major, 0));
- tty.lflag = ICANON | ECHO;
+ tty.c_lflag = ICANON | ECHO;
int fd = open("/dev/fb", O_RDWR);
if (fd < 0) {
@@ -375,7 +372,6 @@ init_tty(void)
lineBuf = kmalloc(4096);
line = kmalloc(4096);
- register_interrupt(1, keyboard_handler);
}
/* Read from the TTY */
@@ -384,7 +380,7 @@ tty_read(File *file, char *buf, size_t size, off_t offset)
{
if (!lineLen) {
add_to_queue(&ttyWait, current);
- block_task(WAITING_FOR_READ);
+ block_task(WAITING_FOR_IO);
}
size_t count = (size < lineLen) ? size : lineLen;
memcpy(buf, line, count);