1.\" Copyright (c) 1997, 1998 2.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved. 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.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd August 3, 2017 28.Dt UKBD 4 29.Os 30.Sh NAME 31.Nm ukbd 32.Nd USB keyboard driver 33.Sh SYNOPSIS 34To compile this driver into the kernel, 35place the following line in your 36kernel configuration file: 37.Bd -ragged -offset indent 38.Cd "device ukbd" 39.Ed 40.Pp 41Alternatively, to load the driver as a 42module at boot time, place the following line in 43.Xr loader.conf 5 : 44.Bd -literal -offset indent 45ukbd_load="YES" 46.Ed 47.Sh DESCRIPTION 48The 49.Nm 50driver provides support for keyboards that attach to the USB port. 51.Xr usb 4 52and one of 53.Xr uhci 4 54or 55.Xr ohci 4 56must be configured in the kernel as well. 57.Sh CONFIGURATION 58By default, the keyboard subsystem does not create the appropriate devices yet. 59Make sure you reconfigure your kernel with the following option in the kernel 60config file: 61.Pp 62.Dl "options KBD_INSTALL_CDEV" 63.Pp 64If both an AT keyboard USB keyboards are used at the same time, the 65AT keyboard will appear as 66.Pa kbd0 67in 68.Pa /dev . 69The USB keyboards will be 70.Pa kbd1 , kbd2 , 71etc. 72You can see some information about the keyboard with the following command: 73.Pp 74.Dl "kbdcontrol -i < /dev/kbd1" 75.Pp 76or load a keymap with 77.Pp 78.Dl "kbdcontrol -l keymaps/pt.iso < /dev/kbd1" 79.Pp 80See 81.Xr kbdcontrol 1 82for more possible options. 83.Pp 84You can swap console keyboards by using the command 85.Pp 86.Dl "kbdcontrol -k /dev/kbd1" 87.Pp 88From this point on, the first USB keyboard will be the keyboard 89to be used by the console. 90.Pp 91If you want to use a USB keyboard as your default and not use an AT keyboard at 92all, you will have to remove the 93.Cd "device atkbd" 94line from the kernel configuration file. 95Because of the device initialization order, 96the USB keyboard will be detected 97.Em after 98the console driver 99initializes itself and you have to explicitly tell the console 100driver to use the existence of the USB keyboard. 101This can be done in 102one of the following two ways. 103.Pp 104Run the following command as a part of system initialization: 105.Pp 106.Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null" 107.Pp 108(Note that as the USB keyboard is the only keyboard, it is accessed as 109.Pa /dev/kbd0 ) 110or otherwise tell the console driver to periodically look for a 111keyboard by setting a flag in the kernel configuration file: 112.Pp 113.Dl "device sc0 at isa? flags 0x100" 114.Pp 115With the above flag, the console driver will try to detect any 116keyboard in the system if it did not detect one while it was 117initialized at boot time. 118.Sh DRIVER CONFIGURATION 119.D1 Cd "options KBD_INSTALL_CDEV" 120.Pp 121Make the keyboards available through a character device in 122.Pa /dev . 123.Pp 124.D1 Cd options UKBD_DFLT_KEYMAP 125.D1 Cd makeoptions UKBD_DFLT_KEYMAP=fr.iso 126.Pp 127The above lines will put the French ISO keymap in the ukbd driver. 128You can specify any keymap in 129.Pa /usr/share/syscons/keymaps 130or 131.Pa /usr/share/vt/keymaps 132(depending on the console driver being used) with this option. 133.Pp 134.D1 Cd "options KBD_DISABLE_KEYMAP_LOADING" 135.Pp 136Do not allow the user to change the keymap. 137Note that these options also affect the AT keyboard driver, 138.Xr atkbd 4 . 139.Sh MIB Variables 140The 141.Nm 142driver exposes the following variables in the 143.Va hw.usb.ukbd 144branch of the 145.Xr sysctl 3 146MIB: 147.Bl -tag -width ".Va debug" 148.It Va debug 149Debug output level, where 0 is debugging disabled and larger values increase 150debug message verbosity. 151Default is 0. 152.Sh FILES 153.Bl -tag -width ".Pa /dev/kbd*" -compact 154.It Pa /dev/kbd* 155blocking device nodes 156.El 157.Sh EXAMPLES 158.D1 Cd "device ukbd" 159.Pp 160Add the 161.Nm 162driver to the kernel. 163.Sh SEE ALSO 164.Xr kbdcontrol 1 , 165.Xr ohci 4 , 166.Xr syscons 4 , 167.Xr uhci 4 , 168.Xr usb 4 , 169.Xr vt 4 , 170.Xr config 8 171.Sh AUTHORS 172.An -nosplit 173The 174.Nm 175driver was written by 176.An Lennart Augustsson Aq Mt augustss@cs.chalmers.se 177for 178.Nx 179and was substantially rewritten for 180.Fx 181by 182.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . 183.Pp 184This manual page was written by 185.An Nick Hibma Aq Mt n_hibma@FreeBSD.org 186with a large amount of input from 187.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . 188