From f7acc2ad7d77c32083f749446a5184ad3f482639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Date: Tue, 11 Sep 2018 12:57:07 -0700 Subject: [PATCH] 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: --- src/modules/bluetooth/module-bluez5-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index afbb7e3fa..3ceda9713 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -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); }