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