mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
bluetooth: Add debug logging to pa_bluetooth_device_supports_profile
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
This commit is contained in:
parent
d7f95170a1
commit
ab47d9394b
1 changed files with 15 additions and 8 deletions
|
|
@ -255,7 +255,7 @@ static const char *transport_state_to_string(pa_bluetooth_transport_state_t stat
|
|||
}
|
||||
|
||||
bool pa_bluetooth_device_supports_profile(const pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
|
||||
bool show_hfp, show_hsp;
|
||||
bool show_hfp, show_hsp, r;
|
||||
|
||||
if (device->enable_hfp_hf) {
|
||||
show_hfp = pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
|
||||
|
|
@ -267,34 +267,41 @@ bool pa_bluetooth_device_supports_profile(const pa_bluetooth_device *device, pa_
|
|||
|
||||
switch (profile) {
|
||||
case PA_BLUETOOTH_PROFILE_A2DP_SINK:
|
||||
return !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SINK) &&
|
||||
r = !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SINK) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_A2DP_SOURCE));
|
||||
break;
|
||||
case PA_BLUETOOTH_PROFILE_A2DP_SOURCE:
|
||||
return !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SOURCE) &&
|
||||
r = !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_A2DP_SOURCE) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_A2DP_SINK));
|
||||
case PA_BLUETOOTH_PROFILE_HSP_HS:
|
||||
return show_hsp
|
||||
r = show_hsp
|
||||
&& ( !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HSP_AG)) ||
|
||||
!!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS_ALT) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HSP_AG)) );
|
||||
case PA_BLUETOOTH_PROFILE_HSP_AG:
|
||||
return !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG) &&
|
||||
r = !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HSP_HS)) ||
|
||||
!!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HSP_HS_ALT));
|
||||
case PA_BLUETOOTH_PROFILE_HFP_HF:
|
||||
return show_hfp
|
||||
r = show_hfp
|
||||
&& !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HFP_AG));
|
||||
case PA_BLUETOOTH_PROFILE_HFP_AG:
|
||||
return !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_AG) &&
|
||||
r = !!(pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_AG) &&
|
||||
pa_hashmap_get(device->adapter->uuids, PA_BLUETOOTH_UUID_HFP_HF));
|
||||
break;
|
||||
case PA_BLUETOOTH_PROFILE_OFF:
|
||||
default:
|
||||
pa_assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
pa_assert_not_reached();
|
||||
pa_log_debug("Checking if device %s (%s) supports profile %s: %s",
|
||||
device->alias, device->address, pa_bluetooth_profile_to_string(profile), r ? "true" : "false");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool device_is_profile_connected(pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue