kbdfs – keyboard and console filesystem
mount -b /srv/cons /dev
translates raw keyboard scancodes from
file and optionally reads console input from
to provide initial keyboard and console input.
It serves a one-level directory containing the files
flag enables a debug trace of
from making its memory private.
to post its channel on
On system startup,
sets this to
mounts itself on
file returns characters typed on the console. Normally, characters
are buffered to enable erase and kill processing.
typed at the keyboard
the current input line (removes all
characters from the buffer of characters not yet read via cons), and a
the previous non-kill, non-erase character from the
The combination control-W,
deletes the input last word.
Killing and erasing only delete characters back to, but
not including, the last newline. Characters typed at the keyboard
actually produce 16-bit runes (see
but the runes are translated into the variable-length
before putting them into the buffer. A
of a length greater than zero causes the process to wait until a newline
ends the buffer, and then returns as much of the buffer as the
argument to read allows, but only up to one complete line. A
is not put into the buffer. If part of the line remains, the next
read will return bytes from that remainder and not part of any new
line that has been typed since.
If the string
has been written to the
file and the file
is still open,
raw mode :
characters are not echoed as they are typed,
are not treated specially, and characters are
available to read as soon as they are typed. Ordinary mode is
is written to
or this file is closed.
A write (see
causes the characters to be printed on the console screen.
is passed to
as its last argument, it reads and processes the
characters from that file and forwards them to the
file with the same text processing applied as on keyboard input.
This is used on serial consoles.
A read on the
file returns the character
followed by a null terminated, variable-length,
encoded string. The
message is sent when a key is pressed down
when a key is released. The following string contains all the keycodes
of the keys that are currently pressed down in unshifted form.
This includes all keys that have a keyboard mapping and modifier keys.
The string following the
message contains the single character that would have been returned
file instead. The
message will be resent at the keyboard repeat rate.
can return multiple concatenated messages at once (delimited by the null byte)
or block when there are no messages queued. Opening the
file disables input processing on the
file until it is closed again.
messages can be written to
and will forwarded to the reader of
message followed by a
encoded rune will simulate the press or
release of that particular rune.
Raw scancodes can be written to the
file for external keyboard input (used for USB keyboards).
Scancodes are mapped to Unicode characters with a number of
translation tables. These tables can be accessed with the
Reads return the current contents of the map.
Each entry is one line containing three 11 character numeric fields,
each followed by a space:
a table number, an index into the table (scan code), and the decimal value
of the corresponding Unicode character (0 if none).
The table numbers are platform dependent; they typically distinguish
between unshifted and shifted keys.
The scan code values are hardware dependent and can vary
from keyboard to keyboard.
Writes to the file change the map.
Lines written to the file must contain three space-separated fields,
representing the table number, scan code index, and Unicode character.
Values are taken to be decimal unless they start with
The Unicode character can also be represented as
gives the UTF-8 representation of the character
to represent a control character.
first appeared in 9front (May, 2011).