mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
bluez5: move no-HFP fast connect checks to better place
Not waiting for HFP when no HFP backend should be checked via adapter_connectable_profiles in spa_bt_device_check_profiles where the relevant logic is. Cleanup by moving the checks there.
This commit is contained in:
parent
e2844e4421
commit
89cdf4f6eb
1 changed files with 11 additions and 12 deletions
|
|
@ -1364,6 +1364,7 @@ static void adapter_free(struct spa_bt_adapter *adapter)
|
||||||
|
|
||||||
static uint32_t adapter_connectable_profiles(struct spa_bt_adapter *adapter)
|
static uint32_t adapter_connectable_profiles(struct spa_bt_adapter *adapter)
|
||||||
{
|
{
|
||||||
|
struct spa_bt_monitor *monitor = adapter->monitor;
|
||||||
const uint32_t profiles = adapter->profiles;
|
const uint32_t profiles = adapter->profiles;
|
||||||
uint32_t mask = 0;
|
uint32_t mask = 0;
|
||||||
|
|
||||||
|
|
@ -1392,6 +1393,9 @@ static uint32_t adapter_connectable_profiles(struct spa_bt_adapter *adapter)
|
||||||
if (profiles & SPA_BT_PROFILE_HFP_HF)
|
if (profiles & SPA_BT_PROFILE_HFP_HF)
|
||||||
mask |= SPA_BT_PROFILE_HFP_AG;
|
mask |= SPA_BT_PROFILE_HFP_AG;
|
||||||
|
|
||||||
|
if (monitor->backend_selection == BACKEND_NONE)
|
||||||
|
mask &= ~SPA_BT_PROFILE_HEADSET_AUDIO;
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1955,7 +1959,8 @@ int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force)
|
||||||
direction_connected = true;
|
direction_connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
all_connected = (device->profiles & connected_profiles) == device->profiles;
|
all_connected = ((device->profiles & connected_profiles & connectable_profiles)
|
||||||
|
== (device->profiles & connectable_profiles));
|
||||||
|
|
||||||
spa_list_for_each(set, &device->set_membership_list, link)
|
spa_list_for_each(set, &device->set_membership_list, link)
|
||||||
spa_bt_for_each_set_member(s, set)
|
spa_bt_for_each_set_member(s, set)
|
||||||
|
|
@ -1969,7 +1974,7 @@ int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force)
|
||||||
if (connected_profiles == 0 && spa_list_is_empty(&device->codec_switch_list)) {
|
if (connected_profiles == 0 && spa_list_is_empty(&device->codec_switch_list)) {
|
||||||
device_stop_timer(device);
|
device_stop_timer(device);
|
||||||
device_connected(monitor, device, BT_DEVICE_DISCONNECTED);
|
device_connected(monitor, device, BT_DEVICE_DISCONNECTED);
|
||||||
} else if (force || ((direction_connected || all_connected) && set_connected)) {
|
} else if (force || ((direction_connected || all_connected) && set_connected && connected_profiles)) {
|
||||||
device_stop_timer(device);
|
device_stop_timer(device);
|
||||||
device_connected(monitor, device, BT_DEVICE_CONNECTED);
|
device_connected(monitor, device, BT_DEVICE_CONNECTED);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2362,17 +2367,11 @@ static int device_update_props(struct spa_bt_device *device,
|
||||||
|
|
||||||
profile = spa_bt_profile_from_uuid(uuid);
|
profile = spa_bt_profile_from_uuid(uuid);
|
||||||
|
|
||||||
/* Only add A2DP/BAP profiles if HSP/HFP backed is none.
|
if (profile && (device->profiles & profile) == 0) {
|
||||||
* This allows BT device to connect instantly instead of waiting for
|
spa_log_debug(monitor->log, "device %p: add UUID=%s", device, uuid);
|
||||||
* profile timeout, because all available profiles are connected.
|
device->profiles |= profile;
|
||||||
*/
|
|
||||||
if (monitor->backend_selection != BACKEND_NONE || (monitor->backend_selection == BACKEND_NONE &&
|
|
||||||
profile & (SPA_BT_PROFILE_MEDIA_SINK | SPA_BT_PROFILE_MEDIA_SOURCE))) {
|
|
||||||
if (profile && (device->profiles & profile) == 0) {
|
|
||||||
spa_log_debug(monitor->log, "device %p: add UUID=%s", device, uuid);
|
|
||||||
device->profiles |= profile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_next(&iter);
|
dbus_message_iter_next(&iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue