FreeBSD supports USB keyboards out-of-the-box. Once you have USB keyboard support enabled on your system, 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/console > /dev/null
Note that if the USB keyboard is the only keyboard, it is accessed as /dev/ukbd0, thus, the command should look like:
# kbdcontrol -k /dev/ukbd0 < /dev/console > /dev/null
Note: To make this change permanent across reboots, add keyboard="/dev/ukbd0" to /etc/rc.conf.
Once this is done, the USB keyboard should work in the X environment as well without any special settings.
If you want to switch back to the default keyboard, use this command:
# kbdcontrol -k /dev/kbd0 > /dev/null
To allow using both the second USB keyboard and the first AT keyboard at the same time on a console via kbdmux(4) driver type the following commands:
# kbdcontrol -K < /dev/console > /dev/null # kbdcontrol -a atkbd0 < /dev/kbdmux0 > /dev/null # kbdcontrol -a ukbd1 < /dev/kbdmux0 > /dev/null # kbdcontrol -k /dev/kbdmux0 < /dev/console > /dev/null
See the ukbd(4), kbdcontrol(1) and kbdmux(4) manual pages for more information.
Note: Hot-plugging and unplugging of the USB keyboard may not work quite right yet. We recommend connecting the keyboard before starting the system and leaving it connected until the system is shutdown to avoid issues.
FreeBSD supports the bus mouse and the InPort bus mouse from such manufacturers as Microsoft, Logitech and ATI. The GENERIC kernel does not include the device driver. To build a custom kernel with the bus mouse driver, add the following line to the kernel config file:
device mse0 at isa? port 0x23c irq5
Bus mice usually come with dedicated interface cards. These cards may allow you to set the port address and the IRQ number other than shown above. Refer to the manual of your mouse and the mse(4) manual page for more information.
The PS/2 mouse is supported out-of-the-box. The necessary device driver, psm, is included in the kernel.
If your custom kernel does not have this, add the following line to your kernel configuration and compile a new kernel.
device psm0 at atkbdc? irq 12
Once the kernel detects psm0 correctly at boot time, a device node psm0 will be created automatically.
If you are using the default console driver, syscons(4), you can use a mouse pointer in text consoles to cut & paste text. Run the mouse daemon, moused(8), and turn on the mouse pointer in the virtual console:
# moused -p /dev/xxxx -t yyyy # vidcontrol -m on
Where xxxx is the mouse device name and yyyy is a protocol type for the mouse. The mouse daemon can automatically determine the protocol type of most mice, except old serial mice. Specify the auto protocol to invoke automatic detection. If automatic detection does not work, see the moused(8) manual page for a list of supported protocol types.
If you have a PS/2 mouse, just add moused_enable="YES" to /etc/rc.conf to start the mouse daemon at boot-time. Additionally, if you would like to use the mouse daemon on all virtual terminals instead of just the console, add allscreens_flags="-m on" to /etc/rc.conf.
When the mouse daemon is running, access to the mouse must be coordinated between the mouse daemon and other programs such as X Windows. Refer to the FAQ Why does my mouse not work with X? for more details on this issue.
Once you get the mouse daemon running (see the previous section), hold down the button 1 (left button) and move the mouse to select a region of text. Then, press the button 2 (middle button) to paste it at the text cursor. Pressing button 3 (right button) will “extend” the selected region of text.
If your mouse does not have a middle button, you may wish to emulate one or remap buttons using mouse daemon options. See the moused(8) manual page for details.
The answer is, unfortunately, “It depends”. These mice with additional features require specialized driver in most cases. Unless the mouse device driver or the user program has specific support for the mouse, it will act just like a standard two, or three button mouse.
For the possible usage of wheels in the X Window environment, refer to that section.
Please refer to the answer to the previous question.
For the Bourne Shell, add the following lines to your .shrc. See sh(1) and editrc(5).
bind ^? ed-delete-next-char # for console bind ^[[3~ ed-delete-next-char # for xterm
For the C Shell, add the following lines to your .cshrc. See csh(1).
bindkey ^? delete-char # for console bindkey ^[[3~ delete-char # for xterm
For more information, see this page.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.