mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
bluetooth: Deregister battery provider when profile disconnects
Whenever a device disconnects the device is not removed from BlueZ, only the profiles that had an active connection are disconnected. Since we were providing this battery level based on AT commands received through HSP/HFP these services should be responsible for deregistering it again. Deregister the interface to signal BlueZ (And UPower in return) that the battery level won't be accurate/updated anymore. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
This commit is contained in:
parent
f7955eeb48
commit
713e3f0680
4 changed files with 49 additions and 4 deletions
|
|
@ -686,6 +686,11 @@ static void rfcomm_io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_i
|
|||
|
||||
if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) {
|
||||
pa_log_info("Lost RFCOMM connection.");
|
||||
// TODO: Keep track of which profile is the current battery provider,
|
||||
// only deregister if it is us currently providing these levels.
|
||||
// (Also helpful to fill the 'Source' property)
|
||||
// We might also move this to Profile1::RequestDisconnection
|
||||
pa_bluetooth_device_deregister_battery(t->device);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue