The k project

Keyboard

Description

The keyboard driver is used to add a first form of input in k. It just detects when a key is pressed by configuring the keyboard controller to trigger interrupt when a key is pressed. You have to implement the non-blocking syscall getkey(). The chip managing the keyboard on the IBM PC is the Intel 8042.

Syscall interface

NAME
    getkey - handle the keyboard
SYNOPSIS
    int getkey(void);
DESCRIPTION
    getkey() returns the last pressed key. It does not support simultaneous key strikes.
RETURN VALUE
    getkey() returns the key code, or -1 if no key was pressed.
SEE ALSO
    Useful constants for scan codes are defined in k/kstd.h.

Possible bug causes