Jump to content

Bluetooth: Difference between revisions

From postmarketOS Wiki
Peremen (talk | contribs)
No edit summary
No edit summary
Line 56: Line 56:
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.
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
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 ===
=== Other profiles ===

Revision as of 09:21, 2 February 2023

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

phone:~# service bluetooth start
phone:~# bluetoothctl
Agent registered
[CHG] Controller XX:XX:XX:XX:XX:XX Pairable: yes
[bluetooth]# scan on
[NEW] 00:11:22:33:44:55
[bluetooth]# pair 00:11:22:33:44:55

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

Supported Bluetooth Profiles

Audio/Video Remote Control Profile (AVRCP)

To use media keys with Bluetooth, the mpris-proxy command should be run. It needs access to Dbus. mpris-proxy is started at boot to enable AVRCP 1.5 support. PulseAudio and BlueZ must be installed for this which pulls in mpris-proxy 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.

Unsupported Bluetooth Profiles

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 tested or enabled in postmarketOS (yet).

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

Troubleshooting

No default controller available

# modprobe -r btqcomsmd
# modprobe btqcomsmd

Failed set serial line discipline: Invalid argument in btattach or Can't set line discipline: Invalid argument in hciattach:

Enable CONFIG_BT_HCIUART (and possibly CONFIG_BT_HCIUART_BCM) in kernel config.


btattach -P bcm doesn't set desired baud rate after uploading firmware:

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


Failed to start discovery: org.bluez.Error.NotReady or Failed to connect: org.bluez.Error.NotReady br-connection-adapter-not-powered

[bluetooth]# power on
Changing power on succeeded
[CHG] Controller XX:XX:XX:XX:XX:XX Powered: yes

Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable when connecting to a headset

# apk add bluez-alsa
# service bluealsa start
# bluetoothctl
[bluetooth]# connect 00:11:22:33:44:55
Attempting to connect 00:11:22:33:44:55
Connection successful
[CHG] Device 00:11:22:33:44:55 ServicesResolved: yes