This is merely a initial hack/WIP to make my new bluetooth headphones work on FreeBSD. I am pretty sure that lots of my changes aren't ideal and need some work.
The patch is mostly derived from looking at the hcidump traces on a Linux box and then digging through the Bluetooth specs.
Regarding the change in ng_hci.h: I had difficulties reading the event mask macros and comparing them with the Spec.
Some of them e.g. NG_HCI_EVMSK_KEYPRESS_NOTIFICATION were also wrong.
How to:
- Scan for new Bluetooth devices (bluetooth-config scan, PIN code is most likely 0000 or 1234 if not set otherwise)
- Stop the hcsecd service
- Edit /etc/bluetooth/hcsecd.conf and add autoaccept; to the entry for the new device
- Start hcsecd again
- Ensure that sdpd is running.
- Now create the connection:
- hccontrol create_connection <bthostname>
- hccontrol request_authentication <conn-id>
- hccontrol write_connection_encryption <conn-id> 1
- Run (my patched version of) virtual_oss to open the audio connection:
- See https://github.com/herrhotzenplotz/virtual_oss/tree/fix/reverse-sdp-discovery
- Build with: make HAVE_BLUETOOTH=1
- virtual_oss -S -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/<bthostname> -T /dev/sndstat -d dsp -t vdsp.ctl
- Note: I also have a branch that adds support for the aptX codecs. You'll have to set -b24 instead of -b16 to make it work with these codecs.
- After you paired the devices, remove the autoaccept entry in hcsecd.conf again and restart the daemon.
PS: I now noticed that there is already a patch for SSP, however it seems to not implement the needed commands in hccontrol and hcsecd in order to allow pairing through SSP.