====== How I managed to use BlueTooth audio with ThinkPad X220: ======
- Enable %%BlueTooth%% support:
kldload acpi_ibm ; echo 'acpi_ibm_load="YES"' >> /boot/loader.conf
sysctl dev.acpi_ibm.0.bluetooth=1 ; echo dev.acpi_ibm.0.bluetooth=1 >> /etc/sysctl.conf
- Ensure kernel module ng_ubt is loaded, though it should be loaded automatically by devd:
kldload ng_ubt
- Ensure bthidd service is enabled and started:
sysrc bthidd_enable=yes ; service bthidd start
- Ensure hcsecd service is enabled and started:
sysrc hcsecd_enable=yes ; service hcsecd start
- Put device in pairing mode and pair with %%FreeBSD%%. Can be done manually using ''%%hccontrol%%'' or using ''%%bluetooth-config%%'' script from [[https://reviews.freebsd.org/D3778|Phabricator review]]
bluetooth-config
- Ensure that the connection exists by running hccontrol:
hccontrol -n ubt0hci create_connection BT_ADDR_OF_DEVICE
- Verify connection using:
hccontrol -n ubt0hci read_connection_list
- Install virtual_oss port:
pkg install virtual_oss
- Start virtual_oss:
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/BT_ADDR_OF_DEVICE -d dsp
If after src r295440, add ''%%-T /dev/sndstat%%'' before the -d to enable the device to show up in /dev/sndstat. If you want to use the virtual_oss_ctl package to control the virtual_oss device via GUI, add ''%%-t vdsp.ctl%%'' to the end. If you have trouble, try changing 48000 to 44100.
- Play audio via vlc or other app
Further reading:
* [[https://www.freebsd.org/doc/handbook/network-bluetooth.html|FreeBSD Handbook Chapter on BlueTooth]]
* [[http://www.oook.cz/bsd/bluetooth.html|Pav's page on BlueTooth that Handbook Chapter was based on. Has some more detail]]
* [[https://reviews.freebsd.org/D3778|Review for bluetooth-config script]]
* [[https://reviews.freebsd.org/D5191|Review for making /dev/sndstat writeable]]
* [[https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203745|PR discussing setup which lead me to this]]
* [[https://www.freebsd.org/cgi/man.cgi?query=hccontrol&sektion=8|hccontrol(8) man page]]
* [[https://www.freebsd.org/cgi/man.cgi?query=l2ping&sektion=8|l2ping(8) man page]]
* [[https://lists.freebsd.org/pipermail/freebsd-bluetooth/|FreeBSD BlueTooth mailing list archive]]
----
{{tag>HowTo}}