mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: don't try to autoconnect same device via multiple adapters
If you use multiple BT adapters, it's annoying that PW tries to autoconnect to the device via all available adapters, and you end up with multiple connections to the same device (which does not necessarily work). Avoid this by autoconnecting with only the first adapter that sees the device.
This commit is contained in:
parent
e90c436f3a
commit
b057c9166d
1 changed files with 13 additions and 0 deletions
|
|
@ -1046,10 +1046,23 @@ static int device_try_connect_profile(struct spa_bt_device *device,
|
|||
|
||||
static int reconnect_device_profiles(struct spa_bt_device *device)
|
||||
{
|
||||
struct spa_bt_monitor *monitor = device->monitor;
|
||||
struct spa_bt_device *d;
|
||||
uint32_t reconnect = device->profiles
|
||||
& device->reconnect_profiles
|
||||
& (device->connected_profiles ^ device->profiles);
|
||||
|
||||
/* Don't try to connect to same device via multiple adapters */
|
||||
spa_list_for_each(d, &monitor->device_list, link) {
|
||||
if (d != device && spa_streq(d->address, device->address)) {
|
||||
if (d->paired && d->trusted && !d->blocked &&
|
||||
d->reconnect_state == BT_DEVICE_RECONNECT_STOP)
|
||||
reconnect &= ~d->reconnect_profiles;
|
||||
if (d->connected_profiles)
|
||||
reconnect = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(device->connected_profiles & SPA_BT_PROFILE_HEADSET_HEAD_UNIT)) {
|
||||
if (reconnect & SPA_BT_PROFILE_HFP_HF) {
|
||||
SPA_FLAG_CLEAR(reconnect, SPA_BT_PROFILE_HSP_HS);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue