]> git.lizzy.rs Git - plan9front.git/blob - sys/man/8/kbdfs
add HISTORY to various man pages
[plan9front.git] / sys / man / 8 / kbdfs
1 .TH KBDFS 8
2 .SH NAME
3 kbdfs \- keyboard and console filesystem
4 .SH SYNOPSIS
5 .B aux/kbdfs
6 [
7 .B -Dd
8 ] [
9 .B -s
10 .I srv
11 ] [
12 .B -m
13 .I mntpnt
14 ] [
15 .I filename
16 ]
17 .nf
18
19 .B mount -b /srv/cons /dev
20 .B /dev/cons
21 .B /dev/consctl
22 .B /dev/kbd
23 .B /dev/kbdin
24 .B /dev/kbin
25 .B /dev/kbmap
26 .fi
27 .SH DESCRIPTION
28 .PP
29 Started on 
30 .IR boot (8),
31 .IR kbdfs
32 translates raw keyboard scancodes from 
33 .B /dev/scancode
34 (see
35 .IR kbd (3))
36 and its
37 .BR kbin
38 and
39 .BR kbdin
40 file and optionally reads console input from
41 .I consfile
42 to provide initial keyboard and console input.
43 .PP
44 It serves a one-level directory containing the files
45 .BR cons,
46 .BR consctl,
47 .BR kbd,
48 .BR kbdin,
49 .BR kbin
50 and
51 .BR kbmap.
52 .PP
53 The
54 .B -D
55 flag enables a debug trace of
56 .I 9p
57 messages and
58 .B -d
59 prevents 
60 .IR kbdfs
61 from making its memory private.
62 .PP
63 The
64 .B -s
65 option causes
66 .IR kbdfs
67 to post its channel on
68 .B /srv/\fIsrv\fP.
69 On system startup,
70 .IR boot (8)
71 sets this to
72 .B cons.
73 With the
74 .B -m
75 option,
76 .IR kbdfs
77 mounts itself on
78 .I mntpnt
79 (see
80 .IR bind (2)),
81 otherwise on
82 .B /dev
83 (the default).
84 .SS Console
85 .PP
86 Reading the
87 .BR cons
88 file returns characters typed on the console.  Normally, characters
89 are buffered to enable erase and kill processing.  
90 A control-U, 
91 .LR ^U ,
92 typed at the keyboard
93 .I erases
94 the current input line (removes all
95 characters from the buffer of characters not yet read via cons), and a
96 backspace
97 .I erases
98 the previous non-kill, non-erase character from the
99 input buffer.
100 The combination control-W,
101 .LR ^W ,
102 deletes the input last word.
103 Killing and erasing only delete characters back to, but
104 not including, the last newline.  Characters typed at the keyboard
105 actually produce 16-bit runes (see
106 .IR utf (6)),
107 but the runes are translated into the variable-length
108 .SM UTF
109 encoding (see
110 .IR utf (6))
111 before putting them into the buffer. A
112 .IR read (2)
113 of a length greater than zero causes the process to wait until a newline
114 or a
115 .LR ^D
116 ends the buffer, and then returns as much of the buffer as the
117 argument to read allows, but only up to one complete line.  A
118 terminating
119 .LR ^D
120 is not put into the buffer.  If part of the line remains, the next
121 read will return bytes from that remainder and not part of any new
122 line that has been typed since.
123 .PP
124 If the string
125 .B rawon
126 has been written to the
127 .BR consctl
128 file and the file
129 is still open,
130 .BR cons
131 is in
132 .IR "raw mode" :
133 characters are not echoed as they are typed,
134 backspace,
135 .L ^U,
136 .L ^W
137 and
138 .L ^D
139 are not treated specially, and characters are
140 available to read as soon as they are typed.  Ordinary mode is
141 reentered when
142 .B rawoff
143 is written to
144 .BR consctl
145 or this file is closed.
146 .PP
147 A write (see 
148 .IR read (2))
149 to
150 .BR cons
151 causes the characters to be printed on the console screen.
152 .PP
153 When a
154 .I filename
155 is passed to
156 .IR kbdfs (8)
157 as its last argument, it reads and processes the
158 characters from that file and forwards them to the
159 .BR cons
160 file with the same text processing applied as on keyboard input.
161 This is used on serial consoles.
162 .SS Keyboard
163 A read on the
164 .BR kbd
165 file returns the character
166 .B k,
167 .B K
168 or
169 .B c
170 followed by a null terminated, variable-length,
171 .SM UTF
172 encoded string. The
173 .B k
174 message is send when a key is pressed down
175 and
176 .B K
177 when a key is released. The following string contains all the keycodes
178 of the keys that are currently pressed down in unshifted form. 
179 This includes all keys that have a keyboard mapping and modifier keys.
180 The string following the
181 .B c
182 message contains the single character that would have been returned
183 on the
184 .BR cons
185 file instead. The
186 .B c
187 message will be resent at the keyboard repeat rate.
188 Each
189 .IR read (2)
190 will return a single message or block until there are new messages
191 available. Opening the
192 .BR kbd
193 file disables input processing on the
194 .BR cons
195 file until it is closed again.
196 .PP
197 .B K,
198 .B k
199 and
200 .B c
201 messages can be written to
202 .BR kbdin
203 and will forwarded to the reader of
204 .BR cons
205 or
206 .BR kbd.
207 Writing a
208 .B r
209 or
210 .B R
211 message followed by a
212 .SM UTF
213 encoded rune will simulate the press or
214 release of that particular rune.
215 .PP
216 Raw scancodes can be written to the
217 .BR kbin
218 file for external keyboard input (used for USB keyboards).
219 .SS "Keyboard map"
220 Scancodes are mapped to Unicode characters with a number of
221 translation tables. These tables can be accessed with the
222 .BR kbmap
223 file.
224 .PP
225 Reads return the current contents of the map.
226 Each entry is one line containing three 11 character numeric fields,
227 each followed by a space:
228 a table number, an index into the table (scan code), and the decimal value
229 of the corresponding Unicode character (0 if none).
230 The table numbers are platform dependent; they typically distinguish
231 between unshifted and shifted keys.
232 The scan code values are hardware dependent and can vary
233 from keyboard to keyboard.
234 .PP
235 Writes to the file change the map.
236 Lines written to the file must contain three space-separated fields,
237 representing the table number, scan code index, and Unicode character.
238 Values are taken to be decimal unless they start with
239 .B 0x
240 (hexadecimal) or
241 .B 0
242 (octal).
243 The Unicode character can also be represented as
244 .BI ' x
245 where
246 .I x
247 gives the UTF-8 representation of the character
248 (see
249 .IR utf (6)),
250 or as 
251 .BI ^ X
252 to represent a control character.
253 .SH "SEE ALSO"
254 .IR cons (3),
255 .IR keyboard (6),
256 .IR utf (6),
257 .IR kbd (3)
258 .SH FILES
259 .B /sys/lib/kbmap/*
260 .SH SOURCE
261 .B /sys/src/cmd/aux/kbdfs
262 .SH HISTORY
263 .I Kbdfs
264 first appeared in 9front (May, 2011).