jos.platform.keyboard
virtualizes the keyboard into a series of KeyEvents: PRESSED, RELEASED, and TYPED. jos.system.console
(should it be in platform?) abstracts an output console with methods strongly similar to (n)curses -- getCharAt(x,y), setChar(x,y), etc. The console architecture is a bit simpler than the keyboard's, so I'll cover it first. A daemon, consoled
, blocks on events from keyboard
. When it recieves an event, it dispatches it to the current console, unless the event signals a switch of consoles. consoled
uses Focus events to pass along these signals to the console
s. The console
s use ConsoleDriver
s to write to the screen. The two ConsoleDriver
s should be the host build's ncurses-based driver, and the i386 build's write-to-VGA-port driver. A primitive VGA driver is available for the i386 build as well.
jos.platform.keyboard
serves as a router of keyboard events, and the `well-known class' to which listeners interested in scancode or key events subscribe. Keyboard events are generated by a InterruptListener (jos.platform.driver.keyboard
) which reads scancodes from the hardware and enqueues them for later dispatch. keyboardd
dispatches the scancode events to j.p.keyboard
, which re-dispatches them to interested listeners and the KeyboardInterpreter
which converts scancodes to key events, and dispatches them back to j.p.keyboard
. Finally, the `well-known class' j.p.keyboard
dispatches the key events to its listeners (the rest of the system). On the host build, the keyboard is, IIRC, emulated as h/w, though the host build could easily use a driver.keyboard
which used native code to query (n)curses.
-- ToddMiller ( 22 June 2001 )