Does FreeBSD support my USB keyboard?
USB device support was added to FreeBSD 3.1. However, it is still in preliminary state and may not always work as of version 3.2. If you want to experiment with the USB keyboard support, follow the procedure described below.
-
Use FreeBSD 3.2 or later.
-
Add the following lines to your kernel configuration file, and rebuild the kernel.
device uhci device ohci device usb device ukbd options KBD_INSTALL_CDEV
In versions of FreeBSD before 4.0, use this instead:
controller uhci0 controller ohci0 controller usb0 controller ukbd0 options KBD_INSTALL_CDEV
-
Go to the /dev directory and create device nodes as follows:
# cd /dev # ./MAKEDEV kbd0 kbd1
-
Edit /etc/rc.conf and add the following lines:
usbd_enable="YES" usbd_flags=""
After the system is rebooted, the AT keyboard becomes /dev/kbd0 and the USB keyboard becomes /dev/kbd1, if both are connected to the system. If there is the USB keyboard only, it will be /dev/ukbd0.
If you want to use the USB keyboard in the console, you have to explicitly tell the console driver to use the existing USB keyboard. This can be done by running the following command as a part of system initialization.
# kbdcontrol -k /dev/kbd1 < /dev/ttyv0 > /dev/null
Note that if the USB keyboard is the only keyboard, it is accessed as /dev/kbd0, thus, the command should look like:
# kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null
/etc/rc.i386 is a good place to add the above command.
Once this is done, the USB keyboard should work in the X environment as well without any special settings.
Hot-plugging and unplugging of the USB keyboard may not work quite right yet. It is a good idea to connect the keyboard before you start the system and leave it connected until the system is shutdown to avoid troubles.
See the ukbd(4) man page for more information.