Bluetooth

Bluetooth is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. In Linux, the canonical implementation of the Bluetooth protocol stack is BlueZ.

Pairing
To use bluetooth headphones with pulseaudio, the package  is required.

Audio/Video Remote Control Profile (AVRCP)
To use media keys with Bluetooth, the  command should be run. It needs access to Dbus. is started at boot to enable AVRCP 1.5 support. PulseAudio and BlueZ must be installed for this which pulls in  automatically. MR at pmaports: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/1804

Advanced Audio Distribution Profile (A2DP)
PulseAudio and BlueZ handle together Bluetooth A2DP 1.3 support. This is supported out-of-the-box.

PhoneBook Access Profile (PBAP)
BlueZ got PBAP 1.1 support recently in 5.63 with GNOME Evolution as backend. Currently, a MR is pending at Alpine to enable this feature: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/29955

Object Push Profile (OPP)
OBEXd was enabled at boot to enable OPP 1.2 support for transfering and receiving files over Bluetooth. MR at pmaports: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2245

Human Interface Device Profile (HID)
BlueZ provides the HID 1.0 profile to support mice and keyboards over Bluetooth. It is enabled by default.

Message Access Profile (MAP)
BlueZ has support for MAP 1.0 but does not have a backend which is compatible with any UI stack. The supported backends are from the old Nokia Maemo days.

Personal Area Network (PAN)
BlueZ supports PAN 1.0, but hasn't been enabled in postmarketOS (yet). Preliminary tests show that NetworkManager has full support for PAN network and they work well over the commandline:

nmcli connection add type bluetooth con-name "Bluetooth Hotspot" autoconnect no ifname btnap0 bluetooth.type nap ipv4.method shared ipv6.method disabled

For now, only IPv4 is marked as shared. IPv6 should work but was not tested. This works if BlueZ was built with BNEP support and a valid Bluetooth MAC address is available. Without a valid MAC address, the BlueZ BNEP network bridges cannot be added to the kernel.

Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html

Hands-Free Profile (HFP)
BlueZ and PulseAudio partly support HFP 1.6. Only the audio part is supported. Reporting battery levels from the AG to HF is unsupported and all cellular operations and status reporting is not supported (yet). A first step in fully supporting Bluetooth HFP 1.6 is taken here: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/631

postmarketOS edge has the necessary patches applied to PulseAudio for supporting Bluetooth HFP AT commands (battery level reporting, cellular status, accept/reject calls, etc.), audio routing not yet. Feedback is welcome in https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/693

HFP AT command support for controlling calls is merged in PipeWire and will be available officially when postmarketOS switches to PipeWire in the near future.

Other profiles
Bluetooth supports many other profiles, see https://www.bluetooth.com/specifications/ It is currently unknown if they are supported or not.

Bluetooth profiles supported by other mobile OSes
 Supported Bluetooth profiles by Apple: https://support.apple.com/en-us/HT204387 Supported Bluetooth profile by Android: https://source.android.com/devices/bluetooth/services 

Troubleshooting
in btattach or  in hciattach:

Enable  (and possibly  ) in kernel config.

doesn't set desired baud rate after uploading firmware:

Use hciattach instead (https://github.com/Arkq/bluez-alsa/issues/205) and verify results with.

or

when connecting to a headset

Bluetooth keyboards, mice and other HID devices
Make sure  is enabled in your kernel. If it's enabled as a module, run:

Getting the device to work might require a few tries; in general, what often works is first pairing the device, then turning off Bluetooth, turning it on again and letting the device connect again (many mice/keyboards will try to reconnect when you press any key/move the mouse).