2011-05-12 18:36:46 +00:00
|
|
|
.TH KBDFS 8
|
|
|
|
.SH NAME
|
2019-12-09 16:44:28 +00:00
|
|
|
kbdfs, console \- keyboard and console filesystem
|
2011-05-12 18:36:46 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.B aux/kbdfs
|
|
|
|
[
|
|
|
|
.B -Dd
|
|
|
|
] [
|
|
|
|
.B -s
|
|
|
|
.I srv
|
|
|
|
] [
|
|
|
|
.B -m
|
|
|
|
.I mntpnt
|
|
|
|
] [
|
2019-12-09 16:44:28 +00:00
|
|
|
.I consfile
|
2011-05-12 18:36:46 +00:00
|
|
|
]
|
|
|
|
.nf
|
|
|
|
|
|
|
|
.B mount -b /srv/cons /dev
|
|
|
|
.B /dev/cons
|
|
|
|
.B /dev/consctl
|
|
|
|
.B /dev/kbd
|
2012-02-25 22:47:09 +00:00
|
|
|
.B /dev/kbdin
|
2011-05-12 18:36:46 +00:00
|
|
|
.B /dev/kbin
|
|
|
|
.B /dev/kbmap
|
|
|
|
.fi
|
2019-12-09 16:44:28 +00:00
|
|
|
.PP
|
|
|
|
.B console
|
|
|
|
[
|
|
|
|
.I cmd
|
|
|
|
.I args...
|
|
|
|
]
|
2011-05-12 18:36:46 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
|
|
|
Started on
|
|
|
|
.IR boot (8),
|
|
|
|
.IR kbdfs
|
|
|
|
translates raw keyboard scancodes from
|
|
|
|
.B /dev/scancode
|
|
|
|
(see
|
|
|
|
.IR kbd (3))
|
|
|
|
and its
|
|
|
|
.BR kbin
|
2012-02-25 22:47:09 +00:00
|
|
|
and
|
|
|
|
.BR kbdin
|
2c(1), torrent(1), uhtml(1), kbd(3), cwfs(4), hgfs(4), cifsd(8), cryptsetup(8), hjfs(8), kbdfs(8), realemu(8), wpa(8): fix spelling, typos
2013-08-23 19:48:52 +00:00
|
|
|
file and optionally reads console input from
|
2011-05-12 18:36:46 +00:00
|
|
|
.I consfile
|
|
|
|
to provide initial keyboard and console input.
|
|
|
|
.PP
|
|
|
|
It serves a one-level directory containing the files
|
|
|
|
.BR cons,
|
|
|
|
.BR consctl,
|
|
|
|
.BR kbd,
|
2012-02-25 22:47:09 +00:00
|
|
|
.BR kbdin,
|
2011-05-12 18:36:46 +00:00
|
|
|
.BR kbin
|
|
|
|
and
|
|
|
|
.BR kbmap.
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B -D
|
|
|
|
flag enables a debug trace of
|
|
|
|
.I 9p
|
|
|
|
messages and
|
|
|
|
.B -d
|
|
|
|
prevents
|
|
|
|
.IR kbdfs
|
|
|
|
from making its memory private.
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B -s
|
|
|
|
option causes
|
|
|
|
.IR kbdfs
|
|
|
|
to post its channel on
|
2011-05-11 23:31:29 +00:00
|
|
|
.B /srv/\fIsrv\fP.
|
2011-05-12 18:36:46 +00:00
|
|
|
On system startup,
|
|
|
|
.IR boot (8)
|
|
|
|
sets this to
|
|
|
|
.B cons.
|
|
|
|
With the
|
|
|
|
.B -m
|
|
|
|
option,
|
|
|
|
.IR kbdfs
|
2011-05-11 23:31:29 +00:00
|
|
|
mounts itself on
|
2011-05-12 18:36:46 +00:00
|
|
|
.I mntpnt
|
2011-05-11 23:31:29 +00:00
|
|
|
(see
|
|
|
|
.IR bind (2)),
|
2011-05-12 18:36:46 +00:00
|
|
|
otherwise on
|
|
|
|
.B /dev
|
2011-05-11 23:31:29 +00:00
|
|
|
(the default).
|
2019-12-09 16:44:28 +00:00
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B console
|
|
|
|
command executes
|
|
|
|
.I cmd
|
|
|
|
(defaults to the system shell)
|
|
|
|
under its own
|
|
|
|
.I kbdfs
|
|
|
|
instance providing a serial console if
|
|
|
|
.B $console
|
|
|
|
environment variable is set.
|
2011-05-12 18:36:46 +00:00
|
|
|
.SS Console
|
|
|
|
.PP
|
|
|
|
Reading the
|
|
|
|
.BR cons
|
|
|
|
file returns characters typed on the console. Normally, characters
|
2011-06-17 16:17:09 +00:00
|
|
|
are buffered to enable erase and kill processing.
|
|
|
|
A control-U,
|
2011-05-12 18:36:46 +00:00
|
|
|
.LR ^U ,
|
|
|
|
typed at the keyboard
|
2011-06-17 16:17:09 +00:00
|
|
|
.I erases
|
2011-05-12 18:36:46 +00:00
|
|
|
the current input line (removes all
|
|
|
|
characters from the buffer of characters not yet read via cons), and a
|
|
|
|
backspace
|
|
|
|
.I erases
|
|
|
|
the previous non-kill, non-erase character from the
|
2011-06-17 16:17:09 +00:00
|
|
|
input buffer.
|
|
|
|
The combination control-W,
|
|
|
|
.LR ^W ,
|
|
|
|
deletes the input last word.
|
|
|
|
Killing and erasing only delete characters back to, but
|
2011-05-12 18:36:46 +00:00
|
|
|
not including, the last newline. Characters typed at the keyboard
|
|
|
|
actually produce 16-bit runes (see
|
|
|
|
.IR utf (6)),
|
|
|
|
but the runes are translated into the variable-length
|
|
|
|
.SM UTF
|
|
|
|
encoding (see
|
|
|
|
.IR utf (6))
|
|
|
|
before putting them into the buffer. A
|
|
|
|
.IR read (2)
|
2011-05-11 23:31:29 +00:00
|
|
|
of a length greater than zero causes the process to wait until a newline
|
2011-05-12 18:36:46 +00:00
|
|
|
or a
|
|
|
|
.LR ^D
|
|
|
|
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
|
|
|
|
terminating
|
|
|
|
.LR ^D
|
|
|
|
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.
|
|
|
|
.PP
|
|
|
|
If the string
|
|
|
|
.B rawon
|
|
|
|
has been written to the
|
|
|
|
.BR consctl
|
|
|
|
file and the file
|
|
|
|
is still open,
|
|
|
|
.BR cons
|
|
|
|
is in
|
|
|
|
.IR "raw mode" :
|
|
|
|
characters are not echoed as they are typed,
|
|
|
|
backspace,
|
2011-06-17 16:17:09 +00:00
|
|
|
.L ^U,
|
|
|
|
.L ^W
|
2011-05-12 18:36:46 +00:00
|
|
|
and
|
|
|
|
.L ^D
|
|
|
|
are not treated specially, and characters are
|
|
|
|
available to read as soon as they are typed. Ordinary mode is
|
|
|
|
reentered when
|
|
|
|
.B rawoff
|
|
|
|
is written to
|
|
|
|
.BR consctl
|
|
|
|
or this file is closed.
|
|
|
|
.PP
|
|
|
|
A write (see
|
|
|
|
.IR read (2))
|
|
|
|
to
|
|
|
|
.BR cons
|
|
|
|
causes the characters to be printed on the console screen.
|
|
|
|
.PP
|
2011-05-11 23:31:29 +00:00
|
|
|
When a
|
2019-12-09 16:44:28 +00:00
|
|
|
.I consfile
|
2011-05-11 23:31:29 +00:00
|
|
|
is passed to
|
2011-05-12 18:36:46 +00:00
|
|
|
.IR kbdfs (8)
|
2011-05-11 23:31:29 +00:00
|
|
|
as its last argument, it reads and processes the
|
2011-05-12 18:36:46 +00:00
|
|
|
characters from that file and forwards them to the
|
|
|
|
.BR cons
|
|
|
|
file with the same text processing applied as on keyboard input.
|
2019-12-09 16:44:28 +00:00
|
|
|
This is used to provide a serial console when
|
|
|
|
.B $console
|
|
|
|
environment variable is set. (see
|
|
|
|
.IR plan9.ini (8)).
|
2021-07-16 23:36:40 +00:00
|
|
|
.PP
|
|
|
|
Holding
|
|
|
|
.LR Ctrl
|
|
|
|
+
|
|
|
|
.LR Alt
|
|
|
|
and then pressing the
|
|
|
|
.LR Del
|
|
|
|
key will
|
|
|
|
trigger a reboot of the terminal.
|
|
|
|
To forward this sequence downstream,
|
|
|
|
.LR Shift
|
|
|
|
+
|
|
|
|
.LR Ctrl
|
|
|
|
+
|
|
|
|
.LR Alt
|
|
|
|
and then pressing
|
|
|
|
.LR Del
|
|
|
|
will cause to send a
|
|
|
|
.LR Shift
|
|
|
|
up before the
|
|
|
|
.LR Del
|
|
|
|
key.
|
|
|
|
This is usefull for programs like
|
|
|
|
.IR vnc (1)
|
|
|
|
and
|
|
|
|
.IR vmx (1).
|
2011-05-12 18:36:46 +00:00
|
|
|
.SS Keyboard
|
|
|
|
A read on the
|
|
|
|
.BR kbd
|
2011-05-28 08:16:01 +00:00
|
|
|
file returns the character
|
|
|
|
.B k,
|
|
|
|
.B K
|
|
|
|
or
|
|
|
|
.B c
|
|
|
|
followed by a null terminated, variable-length,
|
2011-05-12 18:36:46 +00:00
|
|
|
.SM UTF
|
2011-05-28 08:16:01 +00:00
|
|
|
encoded string. The
|
|
|
|
.B k
|
2018-10-16 19:53:34 +00:00
|
|
|
message is sent when a key is pressed down
|
2011-05-28 08:16:01 +00:00
|
|
|
and
|
|
|
|
.B K
|
|
|
|
when a key is released. The following string contains all the keycodes
|
2012-02-25 22:47:09 +00:00
|
|
|
of the keys that are currently pressed down in unshifted form.
|
2011-05-28 08:16:01 +00:00
|
|
|
This includes all keys that have a keyboard mapping and modifier keys.
|
2012-02-25 22:47:09 +00:00
|
|
|
The string following the
|
2011-05-28 08:16:01 +00:00
|
|
|
.B c
|
2011-06-17 16:17:09 +00:00
|
|
|
message contains the single character that would have been returned
|
2011-05-28 08:16:01 +00:00
|
|
|
on the
|
|
|
|
.BR cons
|
|
|
|
file instead. The
|
|
|
|
.B c
|
|
|
|
message will be resent at the keyboard repeat rate.
|
2016-04-03 21:16:08 +00:00
|
|
|
A single
|
2011-05-28 08:16:01 +00:00
|
|
|
.IR read (2)
|
2016-04-03 21:16:08 +00:00
|
|
|
can return multiple concatenated messages at once (delimited by the null byte)
|
|
|
|
or block when there are no messages queued. Opening the
|
2011-05-27 00:41:58 +00:00
|
|
|
.BR kbd
|
|
|
|
file disables input processing on the
|
|
|
|
.BR cons
|
|
|
|
file until it is closed again.
|
2011-05-12 18:36:46 +00:00
|
|
|
.PP
|
2012-02-25 22:47:09 +00:00
|
|
|
.B K,
|
|
|
|
.B k
|
|
|
|
and
|
|
|
|
.B c
|
|
|
|
messages can be written to
|
|
|
|
.BR kbdin
|
|
|
|
and will forwarded to the reader of
|
|
|
|
.BR cons
|
|
|
|
or
|
|
|
|
.BR kbd.
|
|
|
|
Writing a
|
|
|
|
.B r
|
|
|
|
or
|
|
|
|
.B R
|
|
|
|
message followed by a
|
|
|
|
.SM UTF
|
|
|
|
encoded rune will simulate the press or
|
|
|
|
release of that particular rune.
|
|
|
|
.PP
|
2011-05-12 18:36:46 +00:00
|
|
|
Raw scancodes can be written to the
|
|
|
|
.BR kbin
|
2011-05-14 06:22:53 +00:00
|
|
|
file for external keyboard input (used for USB keyboards).
|
2011-05-12 18:36:46 +00:00
|
|
|
.SS "Keyboard map"
|
2012-06-02 02:30:23 +00:00
|
|
|
Scancodes are mapped to Unicode characters with a number of
|
2011-05-12 18:36:46 +00:00
|
|
|
translation tables. These tables can be accessed with the
|
|
|
|
.BR kbmap
|
|
|
|
file.
|
|
|
|
.PP
|
|
|
|
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.
|
|
|
|
.PP
|
|
|
|
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
|
|
|
|
.B 0x
|
|
|
|
(hexadecimal) or
|
|
|
|
.B 0
|
|
|
|
(octal).
|
|
|
|
The Unicode character can also be represented as
|
|
|
|
.BI ' x
|
|
|
|
where
|
|
|
|
.I x
|
|
|
|
gives the UTF-8 representation of the character
|
|
|
|
(see
|
|
|
|
.IR utf (6)),
|
|
|
|
or as
|
|
|
|
.BI ^ X
|
|
|
|
to represent a control character.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.IR cons (3),
|
|
|
|
.IR keyboard (6),
|
|
|
|
.IR utf (6),
|
2019-12-09 16:44:28 +00:00
|
|
|
.IR kbd (3),
|
|
|
|
.IR plan9.ini (8)
|
2011-05-12 18:36:46 +00:00
|
|
|
.SH FILES
|
2012-02-25 22:47:09 +00:00
|
|
|
.B /sys/lib/kbmap/*
|
2011-05-12 18:36:46 +00:00
|
|
|
.SH SOURCE
|
2011-05-28 08:16:01 +00:00
|
|
|
.B /sys/src/cmd/aux/kbdfs
|
2019-12-09 16:44:28 +00:00
|
|
|
.br
|
|
|
|
.B /rc/bin/console
|
2013-12-27 21:22:05 +00:00
|
|
|
.SH HISTORY
|
|
|
|
.I Kbdfs
|
|
|
|
first appeared in 9front (May, 2011).
|