bluetooth: Do not create a card profile for unsupported profiles

Check whether a Bluetooth profile is supported both by the remote device
and the local host before creating a card profile for it.

This is useful when some of the media profiles have not been registered
with bluetoothd because ex., oFono is not running and the headset
backend is not available.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
This commit is contained in:
João Paulo Rechi Vita 2018-09-11 12:57:07 -07:00 committed by PulseAudio Marge Bot
parent ab47d9394b
commit f7acc2ad7d

View file

@ -2198,6 +2198,9 @@ static int add_card(struct userdata *u) {
if (pa_hashmap_get(data.profiles, pa_bluetooth_profile_to_string(profile)))
continue;
if (!pa_bluetooth_device_supports_profile(d, profile))
continue;
cp = create_card_profile(u, profile, data.ports);
pa_hashmap_put(data.profiles, cp->name, cp);
}