FreeBSD supports USB keyboards out-of-the-box. Enable USB support in /etc/rc.conf.
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/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. We recommend connecting the keyboard before starting the system and leaving it connected until the system is shutdown to avoid troubles.
See the ukbd(4) manual page for more information.
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, make sure that an entry for psm0 exists in /dev. You can create this entry by typing:
# cd /dev; sh MAKEDEV psm0
when logged in as root.
Note: You can omit this step if you are running FreeBSD 5.0-RELEASE or newer with devfs(5) enabled, since the proper device nodes will be created automatically under /dev.
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.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the documentation before contacting <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.