hid: Port ukbd to HID and attach to build

Reviewed by:	hselasky
Differential revision:  https://reviews.freebsd.org/D27991
This commit is contained in:
Vladimir Kondratyev 2020-10-12 22:52:29 +03:00
parent 08d8840175
commit b93f6bfca3
7 changed files with 623 additions and 796 deletions

View File

@ -183,6 +183,7 @@ MAN= aac.4 \
hidbus.4 \
hidquirk.4 \
hifn.4 \
hkbd.4 \
hmt.4 \
hpet.4 \
${_hpt27xx.4} \

View File

@ -24,37 +24,41 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 24, 2018
.Dt UKBD 4
.Dd September 12, 2020
.Dt HKBD 4
.Os
.Sh NAME
.Nm ukbd
.Nd USB keyboard driver
.Nm hkbd
.Nd HID keyboard driver
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device ukbd"
.Cd "device hkbd"
.Cd "device hid"
.Cd "device usb"
.Cd "device hidbus"
.Cd "device evdev"
.Cd "options EVDEV_SUPPORT"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
ukbd_load="YES"
hkbd_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for keyboards that attach to the USB port.
.Xr usb 4
driver provides support for keyboards that attach to the HID transport
backend.
.Xr hid 4 ,
.Xr hidbus 4 ,
and one of
.Xr uhci 4
.Xr iichid 4
or
.Xr ohci 4
.Xr usbhid 4
must be configured in the kernel as well.
.Sh CONFIGURATION
By default, the keyboard subsystem does not create the appropriate devices yet.
@ -63,12 +67,12 @@ config file:
.Pp
.Dl "options KBD_INSTALL_CDEV"
.Pp
If both an AT keyboard USB keyboards are used at the same time, the
If both an AT keyboard HID keyboards are used at the same time, the
AT keyboard will appear as
.Pa kbd0
in
.Pa /dev .
The USB keyboards will be
The HID keyboards will be
.Pa kbd1 , kbd2 ,
etc.
You can see some information about the keyboard with the following command:
@ -87,19 +91,19 @@ You can swap console keyboards by using the command
.Pp
.Dl "kbdcontrol -k /dev/kbd1"
.Pp
From this point on, the first USB keyboard will be the keyboard
From this point on, the first HID keyboard will be the keyboard
to be used by the console.
.Pp
If you want to use a USB keyboard as your default and not use an AT keyboard at
If you want to use a HID keyboard as your default and not use an AT keyboard at
all, you will have to remove the
.Cd "device atkbd"
line from the kernel configuration file.
Because of the device initialization order,
the USB keyboard will be detected
the HID keyboard will be detected
.Em after
the console driver
initializes itself and you have to explicitly tell the console
driver to use the existence of the USB keyboard.
driver to use the existence of the HID keyboard.
This can be done in
one of the following two ways.
.Pp
@ -107,7 +111,7 @@ Run the following command as a part of system initialization:
.Pp
.Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null"
.Pp
(Note that as the USB keyboard is the only keyboard, it is accessed as
(Note that as the HID keyboard is the only keyboard, it is accessed as
.Pa /dev/kbd0 )
or otherwise tell the console driver to periodically look for a
keyboard by setting a flag in the kernel configuration file:
@ -123,8 +127,8 @@ initialized at boot time.
Make the keyboards available through a character device in
.Pa /dev .
.Pp
.D1 Cd options UKBD_DFLT_KEYMAP
.D1 Cd makeoptions UKBD_DFLT_KEYMAP=fr.iso
.D1 Cd options HKBD_DFLT_KEYMAP
.D1 Cd makeoptions HKBD_DFLT_KEYMAP=fr.iso
.Pp
The above lines will put the French ISO keymap in the ukbd driver.
You can specify any keymap in
@ -145,28 +149,31 @@ variables and
.Xr loader 8
tunables:
.Bl -tag -width indent
.It Va hw.usb.ukbd.debug
.It Va hw.hid.hkbd.debug
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/kbd*" -compact
.Bl -tag -width ".Pa /dev/input/event*" -compact
.It Pa /dev/kbd*
blocking device nodes
.It Pa /dev/input/event*
input event device nodes.
.El
.Sh EXAMPLES
.D1 Cd "device ukbd"
.D1 Cd "device hkbd"
.Pp
Add the
.Nm
driver to the kernel.
.Sh SEE ALSO
.Xr kbdcontrol 1 ,
.Xr ohci 4 ,
.Xr hid 4 ,
.Xr hidbus 4 ,
.Xr iichid 4 ,
.Xr syscons 4 ,
.Xr uhci 4 ,
.Xr usb 4 ,
.Xr usbhid 4 ,
.Xr vt 4 ,
.Xr config 8
.Sh AUTHORS

View File

@ -1820,6 +1820,7 @@ dev/hid/hid.c optional hid
dev/hid/hid_if.m optional hid
dev/hid/hidbus.c optional hidbus
dev/hid/hidquirk.c optional hid
dev/hid/hkbd.c optional hkbd
dev/hid/hmt.c optional hmt hconf
dev/hifn/hifn7751.c optional hifn
dev/hptiop/hptiop.c optional hptiop scbus
@ -2327,7 +2328,7 @@ dev/ixgbe/ixgbe_dcb_82599.c optional ix inet | ixv inet \
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
dev/jedec_dimm/jedec_dimm.c optional jedec_dimm smbus
dev/jme/if_jme.c optional jme pci
dev/kbd/kbd.c optional atkbd | pckbd | sc | ukbd | vt
dev/kbd/kbd.c optional atkbd | pckbd | sc | ukbd | vt | hkbd
dev/kbdmux/kbdmux.c optional kbdmux
dev/ksyms/ksyms.c optional ksyms
dev/le/am7990.c optional le

View File

@ -1019,3 +1019,4 @@ LINDEBUGFS
HID_DEBUG opt_hid.h
IICHID_DEBUG opt_hid.h
IICHID_SAMPLING opt_hid.h
HKBD_DFLT_KEYMAP opt_hkbd.h

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ SUBDIR = \
SUBDIR += \
hconf \
hkbd \
hmt
.include <bsd.subdir.mk>

View File

@ -0,0 +1,10 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/hid
KMOD= hkbd
SRCS= hkbd.c
SRCS+= opt_evdev.h opt_kbd.h opt_hkbd.h
SRCS+= bus_if.h device_if.h
.include <bsd.kmod.mk>