| Frequently Asked Questions for FreeBSD 3.X, 4.X, 5.X, and 6.X | ||
|---|---|---|
| Prev | Chapter 4 Hardware compatibility | Next |
FreeBSD 4.X and later supports USB keyboards out-of-the-box. Preliminary USB device support appeared in FreeBSD 3.1, but might not always work as of version 3.2. If you want to experiment with the USB keyboard support in FreeBSD 3.X, follow the procedure described below.
Use a version of FreeBSD 3.X later than 3.2.
Add the following lines to your kernel configuration file, and rebuild the kernel.
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=""
If you want to use a USB keyboard in FreeBSD 4.X or later, you just need to 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 manufactures as Microsoft, Logitech and ATI. The bus device driver is compiled in the GENERIC kernel by default in FreeBSD versions 2.X, but not included in version 3.0 or later. If you are building a custom kernel with the bus mouse driver, make sure to add the following line to the kernel config file
In FreeBSD 3.0 or before, add:
device mse0 at isa? port 0x23c tty irq5 vector mseintr
In FreeBSD 3.X, the line should be:
device mse0 at isa? port 0x23c tty irq5
And in FreeBSD 4.X and later, the line should read:
device mse0 at isa? port 0x23c irq5
Bus mice usually comes 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 in all recent versions of FreeBSD. The necessary device driver, psm, is included in the GENERIC kernel.
If your custom kernel does not have this, add the appropriate following line to your kernel configuration file and compile a new kernel.
In FreeBSD 3.0 or earlier, the line should be:
device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr
In FreeBSD 3.1 or later, the line should be:
device psm0 at isa? tty irq 12
In FreeBSD 4.0 or later, the line should be:
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 do this 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.
Preliminary USB device support was added to FreeBSD 3.1. It did not always work through early versions of 3.X. As of FreeBSD 4.0, USB devices should work out of the box. If you want to experiment with the USB mouse support under FreeBSD 3.X, 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 ums
In versions of FreeBSD before 4.0, use this instead:
controller uhci0 controller ohci0 controller usb0 device ums0
Go to the /dev directory and create a device node as follows:
# cd /dev # ./MAKEDEV ums0
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.
Edit /etc/rc.conf and add the following lines:
moused_enable="YES" moused_type="auto" moused_port="/dev/ums0" moused_flags="" usbd_enable="YES" usbd_flags=""
See the previous section for more detailed discussion on moused.
In order to use the USB mouse in the X session, edit XF86Config. If you are using XFree86™ 3.3.2 or later, be sure to have the following lines in the Pointer section:
Device "/dev/sysmouse" Protocol "Auto"
If you are using earlier versions of XFree86, be sure to have the following lines in the Pointer section:
Device "/dev/sysmouse" Protocol "SysMouse"
Refer to another section on the mouse support in the X environment.
Hot-plugging and unplugging of the USB mouse may not work quite right yet. It is a good idea connect the mouse before you start the system and leave it connected until the system is shutdown to avoid trouble.
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. Also check out the Mobile Computing 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>.