xref: /freebsd/usr.sbin/kbdcontrol/kbdcontrol.1 (revision 02e9120893770924227138ba49df1edb3896112a)
1.\"
2.\" kbdcontrol - a utility for manipulating the syscons or vt keyboard driver section
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.Dd March 16, 2016
14.Dt KBDCONTROL 1
15.Os
16.Sh NAME
17.Nm kbdcontrol
18.Nd keyboard control and configuration utility
19.Sh SYNOPSIS
20.Nm
21.Op Fl dFKix
22.Op Fl A Ar name
23.Op Fl a Ar name
24.Oo
25.Fl b
26.Ar duration . Ns Ar pitch | Ar belltype
27.Oc
28.Oo
29.Fl r
30.Ar delay . Ns Ar repeat | Ar speed
31.Oc
32.Op Fl l Ar keymap_file
33.Op Fl f Ar # Ar string
34.Op Fl k Ar keyboard_device
35.Op Fl L Ar keymap_file
36.Op Fl P Ar path
37.Sh DESCRIPTION
38The
39.Nm
40command is used to set various keyboard related options for the
41.Xr syscons 4
42or
43.Xr vt 4
44console driver and the keyboard drivers,
45such as key map, keyboard repeat and delay rates, bell
46characteristics etc.
47.Pp
48Keyboard options may be automatically configured at system boot time by
49setting variables in
50.Pa /etc/rc.conf .
51See
52.Sx Boot Time Configuration
53below.
54.Pp
55The following command line options are supported:
56.Bl -tag -width indent
57.It Fl A Ar name
58Detach the keyboard, specified by the keyboard device name, from the keyboard
59multiplexer.
60When using this option, the standard input of the
61.Nm
62process should be redirected from the keyboard multiplexer keyboard device
63(if the keyboard multiplexer is not the active keyboard) or
64.Pa /dev/console
65(if the keyboard multiplexer is the active keyboard and
66you are not working on the system console).
67.It Fl a Ar name
68Attach the keyboard, specified by the keyboard device name, to the keyboard
69multiplexer.
70When using this option, the standard input of the
71.Nm
72process should be redirected from the keyboard multiplexer keyboard device
73(if the keyboard multiplexer is not the active keyboard) or
74.Pa /dev/console
75(if the keyboard multiplexer is the active keyboard and
76you are not working on the system console).
77.It Fl b Xo
78.Ar duration . Ns Ar pitch | Ar belltype
79.Xc
80Set the bell duration in milliseconds and pitch in hertz.
81If a
82.Ar belltype
83argument is specified, it may be one of
84.Cm normal
85which sets sound parameters back to normal values,
86.Cm off
87which disables the bell entirely, or
88.Cm visual
89which sets the bell to visual mode, i.e., flashes the screen instead.
90If
91.Ar belltype
92is preceded by the word
93.Cm quiet. ,
94the bell will not be rung when the ringing process is in the background vty.
95The
96.Cm visual
97bell, when chosen, applies to all vtys; other bell types
98can be set individually for each vty.
99.It Fl r Xo
100.Ar delay . Ns Ar repeat | Ar speed
101.Xc
102Set keyboard
103.Ar delay
104(250, 500, 750, 1000)
105and
106.Ar repeat
107(34, 38, 42, 46, 50, 55, 59, 63, 68, 76, 84, 92, 100, 110, 118, 126,
108136, 152, 168, 184, 200, 220, 236, 252, 272, 304, 336, 368, 400, 440,
109472, 504)
110rates, or if a
111.Ar speed
112argument is specified, it may be one of
113.Cm slow
114(1000.504),
115.Cm fast
116(250.34)
117or
118.Cm normal
119(500.126).
120.It Fl l Ar keymap_file
121Install keyboard map file from
122.Ar keymap_file .
123You may load the keyboard map file from a menu-driven command,
124.Xr kbdmap 1 .
125The format of keyboard map files is documented in the
126.Xr kbdmap 5
127manual page.
128.It Fl d
129Dump the current keyboard map onto stdout.
130The output may be redirected to a file and can be loaded
131back to the kernel later by the
132.Fl l
133option above.
134.It Fl f Ar # Ar string
135Set function key number
136.Ar #
137to send
138.Ar string .
139Refer to the man page for the keyboard driver
140(e.g.\&
141.Xr atkbd 4 )
142for available function keys and their numbers.
143.It Fl F
144Set function keys back to the standard definitions.
145.It Fl x
146Use hexadecimal numbers in keyboard map dump.
147.It Fl i
148Print brief information about the keyboard.
149.It Fl K
150Disconnect the keyboard from the console.
151You need to use the
152.Fl k
153option below to associate a keyboard with the console again.
154.It Fl k Ar keyboard_device
155Use the specified device as the console keyboard.
156When using this option, the standard input of the
157.Nm
158process should be redirected from
159.Pa /dev/console
160if you are not working on the system console
161(see the
162.Sx EXAMPLES
163section).
164.It Fl L Ar keymap_file
165Load keyboard map file from
166.Ar keymap_file
167and write the
168.Ft "struct keymap"
169compiled from it to stdout.
170This option is primarily intended for programmers and is probably
171of little use under normal circumstances.
172.It Fl P Ar path
173Search for the keymap file in
174.Ar path .
175The
176.Fl P
177option may be specified multiple times.
178.El
179.Sh ENVIRONMENT
180The environment variable
181.Ev KEYMAP_PATH
182can hold an alternative path to the keyboard map files.
183.Sh KEYBOARD CONFIGURATION
184.Ss Boot Time Configuration
185You may set variables in
186.Pa /etc/rc.conf
187or
188.Pa /etc/rc.conf.local
189in order to configure the keyboard at boot time.
190The following is the list of relevant variables.
191.Pp
192.Bl -tag -width foo_bar_var -compact
193.It Ar keymap
194Specifies a keyboard map file for the
195.Fl l
196option.
197.It Ar keyrate
198Sets the keyboard repeat rate for the
199.Fl r
200option.
201.It Ar keychange
202Lists function key strings for the
203.Fl f
204option.
205.El
206.Pp
207See
208.Xr rc.conf 5
209for details.
210.Ss Driver Configuration
211The keyboard device driver may let you change default configuration
212options, such as the default keyboard map, so that you do not need to set up
213the options at boot time.
214See keyboard driver manuals
215(e.g.\&
216.Xr atkbd 4 ,
217.Xr ukbd 4 )
218for details.
219.Sh FILES
220.Bl -tag -width /usr/share/syscons/keymaps/foo_bar -compact
221.It Pa /usr/share/syscons/keymaps/*
222keyboard map files for syscons
223.It Pa /usr/share/vt/keymaps/*
224keyboard map files for vt
225.El
226.Sh EXAMPLES
227The following command will load the keyboard map file
228.Pa /usr/share/syscons/keymaps/ru.koi8-r.kbd .
229.Pp
230.Dl kbdcontrol -l /usr/share/syscons/keymaps/ru.koi8-r.kbd
231.Pp
232So long as the keyboard map file resides in
233.Pa /usr/share/syscons/keymaps
234(if using
235.Xr syscons 4 ) or
236.Pa /usr/share/vt/keymaps
237(if using
238.Xr vt 4 ) ,
239you may abbreviate the file name as
240.Pa ru.koi8-r .
241Since
242.Xr vt 4
243uses Unicode, the corresponding keyboard file names omit the encoding
244and typically are just a country code, e.g.\&
245.Pa ru .
246.Pp
247.Dl kbdcontrol -l ru.koi8-r
248.Pp
249The following command will make the function key 10 emit "telnet myhost".
250.Pp
251.Dl kbdcontrol -f 10 \&"telnet myhost\&"
252.Pp
253In order to get the visual effect for bell, but prevent the screen
254from flashing if the bell is to ring in the background screen,
255run the following command.
256.Pp
257.Dl kbdcontrol -b quiet.visual
258.Pp
259To change the default console keyboard to another keyboard,
260for example the first USB keyboard (see
261.Xr ukbd 4 ) ,
262use the following command.
263.Pp
264.Dl kbdcontrol -k /dev/ukbd0 < /dev/console
265.Pp
266To switch back to the default keyboard, use this command.
267.Pp
268.Dl kbdcontrol -k /dev/kbd0
269.Pp
270To allow using both the second USB keyboard and the first AT keyboard
271at the same time on console via the
272.Xr kbdmux 4
273driver, use the following sequence of commands.
274.Bd -literal -offset indent
275kbdcontrol -K < /dev/console
276kbdcontrol -a atkbd0 < /dev/kbdmux0
277kbdcontrol -a ukbd1 < /dev/kbdmux0
278kbdcontrol -k /dev/kbdmux0 < /dev/console
279.Ed
280.Sh SEE ALSO
281.Xr kbdmap 1 ,
282.Xr vidcontrol 1 ,
283.Xr atkbd 4 ,
284.Xr kbdmux 4 ,
285.Xr keyboard 4 ,
286.Xr screen 4 ,
287.Xr syscons 4 ,
288.Xr ukbd 4 ,
289.Xr vt 4 ,
290.Xr kbdmap 5 ,
291.Xr rc.conf 5
292.Sh AUTHORS
293.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org
294.Sh BUGS
295Report when found.
296