PS/2 driver not working as expected
Posted: Wed Dec 19, 2018 7:21 pm
I'm trying to add a PS/2 keyboard driver, it reads the keys, but the problem is that returns any character except the one that was pressed on the keyboard.
At first I thought it might be the putch function, but doing some tests, I saw that putch wasn't the problem.
Why doesn't it work?
btw, also I tried with unsigned char c, but it gives a worse result.
Code: Select all
#include <stdint.h>
#include "kernel/terminal.h"
#include "kernel/kernel.h"
#include "kernel/pic.h"
int kernelmain(void)
{
PIC_remap(0x20, 0x28);
clear_screen();
textcolor(RED);
println("Hello protected mode! ");
textcolor(CYAN);
println("AAABBBCCC ");
println("Ñandú áéíóú ");
outb(0xED, 2); /* Turn on CapsLock LED (doesn't works)*/
char c = 0;
while (c != 1)
{
if (inb(0x60) != c) /* IF key isn't escape key */
{
c = inb(0x60); /* 0x60 returns the pressed key */
if (c > 0)
putch(c);
}
}
return 0;
}
Why doesn't it work?
btw, also I tried with unsigned char c, but it gives a worse result.