FreeBSD Administration

Bluetooth Mouse on FreeBSD 6.1

The bluetooth support in FreeBSD is evolving at a rapid pace.  This How-to was done to try and get my bluetooth mouse working on my Laptop running FreeBSD 6.0-beta1.  Newer versions of FreeBSD may be slightly different. 

Load the Bluetooth drivers

# echo ng_ubt_load=\"YES\" >> /boot/loader.conf
# echo vkbd_load=\"YES\" >> /boot/loader.conf

Copy the bluetooth startup script from the examples directory.
(NOTE: FreeBSD 6.2 already has the startup script installed in /etc/rc.d)

# cp /usr/share/examples/netgraph/bluetooth/rc.bluetooth /etc/rc.bluetooth

Patch the HID device

I had to create a patch for the hid device to understand my bluetooth mouse buttons. This may not be needed in newer versions of FreeBSD.

# cd /var/tmp
# fetch http://www.bohica.net/projects/bluetooth.button.swap.patch
# cd /usr/src # patch < /var/tmp/bluetooth.button.swap.patch

Recompile and install the bluetooth hid stuff.

# make
# make install
# cd /usr/src/usr.sbin/bluetooth/bthidd
# make
# make install

Start the bluetooth stack

Reboot and then insert the bluetooth USB dongle.

# /etc/rc.bluetooth start ubt0

Discovering the bluetooth device.

Turn the bluetooth mouse into discovery mode. Enter the following command to get the device MAC address.

# hccontrol -n ubt0hci inquiry

Create the device entry

Edit the /etc/bluetooth/hcsec.conf file and create a device entry for the mouse. Here is mine:

device {
        bdaddr    00:0a:3a:00:70:5a;
        name      "BT500";
        key       nokey;
        pin       "0000";
}

Start the hsec service.

# hcsecd -f /etc/bluetooth/hcsecd.conf

Edit the /etc/bluetooth/hosts file and associate the MAC address with the name mouse.

# echo "00:0a:3a:00:70:5a          mouse" >> /etc/bluetooth/hosts

Start the HID service

Discover the HID information from the mouse and store it in the hid file.

# bthidcontrol -a mouse query > /etc/bluetooth/bthidd.conf
# bthidd -c /etc/bluetooth/bthidd.conf

This mouse should now work. 

Leave a Comment

Your email address will not be published. Required fields are marked *