Keyboard input
Posted: Wed Jul 13, 2016 1:07 pm
Not sure if I'm missing something. Have followed the wiki - which seems to suggest that scan code set 2 will be enabled by default. My code sets up a function to catch interrupts from IRQ 1, and caught interrupts are converted into something meaningful for other functions in the OS and queued. For now the code simply prints on screen when a text key is pressed.
I'm able to catch the interrupts but for some reason scan code set 1 is used. I've even tried to manually set scan code 2 (with reference to the wiki, and here), but scan code 1 is still being used.
For example, when I press the ctrl, the letter 'w' appears (scan code 0x1D is retrieved - which is scan code set 1 ctrl, and scan code 2 set 'w').
My keyboard handler initialisation code:
The code that I've added (before the above) to set the scan code to 2:
The scan code is obtained by calling:
Any ideas?
I'm able to catch the interrupts but for some reason scan code set 1 is used. I've even tried to manually set scan code 2 (with reference to the wiki, and here), but scan code 1 is still being used.
For example, when I press the ctrl, the letter 'w' appears (scan code 0x1D is retrieved - which is scan code set 1 ctrl, and scan code 2 set 'w').
My keyboard handler initialisation code:
Code: Select all
// Initialise the event buffer
kb = malloc(sizeof(KeyboardEvent_t *) * (KB_BUFFER_MAX_SIZE+1));
kb[0] = malloc(sizeof(KeyboardEvent_t));
KBEVENT_END(kb[0]->flags);
// Initialise the flags
kb_flags = 0x0;
// Set the first event to the end of the event buffer
KBEVENT_END(kb[0]);
// Install the interupt handler
irq_install_handler(1, keyboard_handler);
Code: Select all
outportb(0x60, 0xF0);
while (!(inportb(0x60) == 0xfa));
outportb(0x60, 0x02);
Code: Select all
scancode = inportb(0x60);