Skip to content

Instantly share code, notes, and snippets.

@carepack
Created March 20, 2020 18:50
Show Gist options
  • Save carepack/9124915d226861abc891888cb5a23460 to your computer and use it in GitHub Desktop.
Save carepack/9124915d226861abc891888cb5a23460 to your computer and use it in GitHub Desktop.
Configure FreeBSD Bluetooth Mouse
Add to /boot/loader.conf:
ng_ubt_load="YES"
Add to /etc/rc.conf:
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"
Reboot, or run:
kldload ng_ubt
/etc/rc.d/sdpd start
/etc/rc.d/hcsecd start
Figure out the name of the Bluetooth HCI node by running:
hccontrol read_node_list
The node name will be something like “ubt0hci”; replace all HCINODE below with this name.
Figure out the EUI-48 address (“BD_ADDR” in the output, six hexadecimal bytes separated by colons) of the mouse by running this right after turning on the mouse:
hccontrol -n HCINODE inquiry
Replace all BDADDR below with the EUI-48 address.
Note: Mighty Mouse goes into sleep mode in a minute or so if it can't find a computer that wants to control it.
Optional: Set up a Bluetooth host alias in /etc/bluetooth/hosts by running:
echo BDADDR BDHOST >> /etc/bluetooth/hosts
Pick a suitable host name, e.g. “mightymouse”, for BDHOST.
Register the device with bthidd(8) by running:
bthidcontrol -a BDADDR query >> /etc/bluetooth/bthidd.conf
Register the PIN for the mouse by adding this to /etc/bluetooth/hcsecd.conf:
device {
bdaddr BDADDR;
name "Mighty Mouse";
key nokey;
pin "0000";
}
Restart hcsecd and bthidd:
/etc/rc.d/hcsecd restart
/etc/rc.d/bthidd restart
Turn the mouse off and back on.
If all went well, bthidd will emit messages like these in /var/log/messages:
Feb 16 23:06:58 seerajeane bthidd[1906]: Accepted control connection from BDADDR
Feb 16 23:06:58 seerajeane bthidd[1906]: Accepted interrupt connection from BDADDR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment