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