UKBD(4)
π UKBD β the USB keyboard driver, bestie π
okay so this is ukbd(4) from the Kernel Interfaces Manual, and it's literally the driver that makes your keyboard work when you plug it into a USB port. iconic behavior honestly. let's get into it π
β¨ NAME β¨
ukbd β the USB keyboard driver. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
so you wanna get this driver into your kernel? two ways, pick your fighter:
option one β bake it into the kernel. drop this line in your kernel configuration file:
device ukbd
option two β load it as a module at boot time. put this line in loader.conf(5):
ukbd_load="YES"
slay, either way works π
π¦ DESCRIPTION π¦
the ukbd driver provides support for keyboards that attach to the USB port. no cap, that's its whole job.
β οΈ but listen βusb(4)AND one ofuhci(4)orohci(4)must be configured in the kernel as well. you can't just haveukbdsitting there all alone, it needs its friends fr fr.
π CONFIGURATION π
okay so here's the tea: by default, the keyboard subsystem does not create the appropriate devices yet. so make sure you reconfigure your kernel with the following option in the kernel config file:
options KBD_INSTALL_CDEV
now, if both an AT keyboard and USB keyboards are used at the same time β the AT keyboard will appear as kbd0 in /dev. and the USB keyboards will be kbd1, kbd2, etc. that's just the order of things bestie.
you can peek at some info about the keyboard with this command:
kbdcontrol -i < /dev/kbd1
or load a keymap with:
kbdcontrol -l keymaps/pt.iso < /dev/kbd1
see kbdcontrol(1) for more possible options β¨
you can swap console keyboards by using the command:
kbdcontrol -k /dev/kbd1
from this point on, the first USB keyboard will be the keyboard to be used by the console. main character promotion π
now β if you want to use a USB keyboard as your default and not use an AT keyboard at all, you will have to remove the device atkbd line from the kernel configuration file. because of the device initialization order, the USB keyboard will be detected after the console driver initializes itself, and you have to explicitly tell the console driver to use the existence of the USB keyboard. this can be done in one of the following two ways:
way 1: run the following command as a part of system initialization:
kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null
(note that as the USB keyboard is the only keyboard, it is accessed as /dev/kbd0 π‘)
way 2: otherwise tell the console driver to periodically look for a keyboard by setting a flag in the kernel configuration file:
device sc0 at isa? flags 0x100
with the above flag, the console driver will try to detect any keyboard in the system if it did not detect one while it was initialized at boot time. she's persistent, we love her π«Ά
π DRIVER CONFIGURATION π
options KBD_INSTALL_CDEV
make the keyboards available through a character device in /dev. periodt.
options UKBD_DFLT_KEYMAP
makeoptions UKBD_DFLT_KEYMAP=fr.iso
the above lines will put the French ISO keymap in the ukbd driver. you can specify any keymap in /usr/share/syscons/keymaps or /usr/share/vt/keymaps (depending on the console driver being used) with this option. so many keymaps, so little time π
options KBD_DISABLE_KEYMAP_LOADING
do not allow the user to change the keymap. π
note that these options also affect the AT keyboard driver, atkbd(4). yeah, they share. iykyk.
β SYSCTL VARIABLES β
the following variables are available as both sysctl(8) variables and loader(8) tunables:
hw.usb.ukbd.debugβ Debug output level, where0is debugging disabled and larger values increase debug message verbosity. Default is0.
π FILES π
/dev/kbd*β blocking device nodes
π₯ EXAMPLES π₯
device ukbd
Add the ukbd driver to the kernel. boom. done. β¨
π SEE ALSO π
kbdcontrol(1), ohci(4), syscons(4), uhci(4), usb(4), vt(4), config(8)
π AUTHORS π
the ukbd driver was written by Lennart Augustsson <augustss@cs.chalmers.se> for NetBSD and was substantially rewritten for FreeBSD by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>. legends, both of them π«‘
this manual page was written by Nick Hibma <n_hibma@FreeBSD.org> with a large amount of input from Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>. collab of the century tbh π
and that's the whole page bestie!! this one's from the Debian crew, dated April 24, 2018, filed under UKBD(4) in the Kernel Interfaces Manual. go forth and type fabulously πβ¨πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1997, 1998 Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms