xref: /freebsd/share/man/man4/hkbd.4 (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
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.Dd September 12, 2020
26.Dt HKBD 4
27.Os
28.Sh NAME
29.Nm hkbd
30.Nd HID keyboard driver
31.Sh SYNOPSIS
32To compile this driver into the kernel,
33place the following line in your
34kernel configuration file:
35.Bd -ragged -offset indent
36.Cd "device hkbd"
37.Cd "device hid"
38.Cd "device hidbus"
39.Cd "device evdev"
40.Cd "options EVDEV_SUPPORT"
41.Ed
42.Pp
43Alternatively, to load the driver as a
44module at boot time, place the following line in
45.Xr loader.conf 5 :
46.Bd -literal -offset indent
47hkbd_load="YES"
48.Ed
49.Sh DESCRIPTION
50The
51.Nm
52driver provides support for keyboards that attach to the HID transport
53backend.
54.Xr hid 4 ,
55.Xr hidbus 4 ,
56and one of
57.Xr iichid 4
58or
59.Xr usbhid 4
60must be configured in the kernel as well.
61.Sh CONFIGURATION
62By default, the keyboard subsystem does not create the appropriate devices yet.
63Make sure you reconfigure your kernel with the following option in the kernel
64config file:
65.Pp
66.Dl "options KBD_INSTALL_CDEV"
67.Pp
68If both an AT keyboard HID keyboards are used at the same time, the
69AT keyboard will appear as
70.Pa kbd0
71in
72.Pa /dev .
73The HID keyboards will be
74.Pa kbd1 , kbd2 ,
75etc.
76You can see some information about the keyboard with the following command:
77.Pp
78.Dl "kbdcontrol -i < /dev/kbd1"
79.Pp
80or load a keymap with
81.Pp
82.Dl "kbdcontrol -l keymaps/pt.iso < /dev/kbd1"
83.Pp
84See
85.Xr kbdcontrol 1
86for more possible options.
87.Pp
88You can swap console keyboards by using the command
89.Pp
90.Dl "kbdcontrol -k /dev/kbd1"
91.Pp
92From this point on, the first HID keyboard will be the keyboard
93to be used by the console.
94.Pp
95If you want to use a HID keyboard as your default and not use an AT keyboard at
96all, you will have to remove the
97.Cd "device atkbd"
98line from the kernel configuration file.
99Because of the device initialization order,
100the HID keyboard will be detected
101.Em after
102the console driver
103initializes itself and you have to explicitly tell the console
104driver to use the existence of the HID keyboard.
105This can be done in
106one of the following two ways.
107.Pp
108Run the following command as a part of system initialization:
109.Pp
110.Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null"
111.Pp
112(Note that as the HID keyboard is the only keyboard, it is accessed as
113.Pa /dev/kbd0 )
114or otherwise tell the console driver to periodically look for a
115keyboard by setting a flag in the kernel configuration file:
116.Pp
117.Dl "device sc0 at isa? flags 0x100"
118.Pp
119With the above flag, the console driver will try to detect any
120keyboard in the system if it did not detect one while it was
121initialized at boot time.
122.Sh DRIVER CONFIGURATION
123.D1 Cd "options KBD_INSTALL_CDEV"
124.Pp
125Make the keyboards available through a character device in
126.Pa /dev .
127.Pp
128.D1 Cd options HKBD_DFLT_KEYMAP
129.D1 Cd makeoptions HKBD_DFLT_KEYMAP=fr.iso
130.Pp
131The above lines will put the French ISO keymap in the ukbd driver.
132You can specify any keymap in
133.Pa /usr/share/syscons/keymaps
134or
135.Pa /usr/share/vt/keymaps
136(depending on the console driver being used) with this option.
137.Pp
138.D1 Cd "options KBD_DISABLE_KEYMAP_LOADING"
139.Pp
140Do not allow the user to change the keymap.
141Note that these options also affect the AT keyboard driver,
142.Xr atkbd 4 .
143.Sh SYSCTL VARIABLES
144The following variables are available as both
145.Xr sysctl 8
146variables and
147.Xr loader 8
148tunables:
149.Bl -tag -width indent
150.It Va hw.hid.hkbd.debug
151Debug output level, where 0 is debugging disabled and larger values increase
152debug message verbosity.
153Default is 0.
154.El
155.Sh FILES
156.Bl -tag -width ".Pa /dev/input/event*" -compact
157.It Pa /dev/kbd*
158blocking device nodes
159.It Pa /dev/input/event*
160input event device nodes.
161.El
162.Sh EXAMPLES
163.D1 Cd "device hkbd"
164.Pp
165Add the
166.Nm
167driver to the kernel.
168.Sh SEE ALSO
169.Xr kbdcontrol 1 ,
170.Xr hid 4 ,
171.Xr hidbus 4 ,
172.Xr iichid 4 ,
173.Xr syscons 4 ,
174.Xr usbhid 4 ,
175.Xr vt 4 ,
176.Xr config 8
177.Sh AUTHORS
178.An -nosplit
179The
180.Nm
181driver was written by
182.An Lennart Augustsson Aq Mt augustss@cs.chalmers.se
183for
184.Nx
185and was substantially rewritten for
186.Fx
187by
188.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp .
189.Pp
190This manual page was written by
191.An Nick Hibma Aq Mt n_hibma@FreeBSD.org
192with a large amount of input from
193.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp .
194