Skip to content

bluetooth: Hook up HSP/HFP battery reporting to proplist and BlueZ experimental battery provider

Marijn Suijten requested to merge MarijnS95/pulseaudio:battery-provider into master

Provide battery level received through HSP/HFP AT messages in a bluetooth.battery card property and (if enabled) through the experimental BlueZ external battery provider API.


Fixes #722 (closed)

BlueZ recently received an experimental API to register external battery providers. PulseAudio is a perfect fit to extract battery level from AT+IPHONEACCEV commands on the HSP/HFP RFCOMM socket and provide these to BlueZ: BlueZ in return exposes an org.bluez.Battery1 interface on the Bluetooth device path which is picked up by daemons like UPower for further processing.

bluetoothd needs to be started with the -E flag to enable this experimental feature. For those not interested in UPower/DBus functionality the level is now also listed in card properties under bluetooth.battery.

Note that UPower needs some patches to display battery percentage instead of unknown for devices that do not expose their "kind" via the "appearance" GAP service; this kind can still be derived from the device Class: upower/upower!61 (merged). I hope to finish this MR in the coming days.

Edited by Marijn Suijten

Merge request reports