From def45adaec6dc88f7347f1805b096725ba7cebb7 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 19 Sep 2021 16:31:08 +0300 Subject: [PATCH] bluez5: fix behavior on HSP/HFP backends with no codec switching Fix HSP/HFP profile not showing correctly when using hsphfpd/ofono backends, which don't support codec switching and have no HFP codec profiles. --- spa/plugins/bluez5/bluez5-device.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index baa5c964e..bc60f7aa0 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -681,6 +681,9 @@ static int emit_nodes(struct impl *this) } } } + + if (get_supported_a2dp_codec(this, this->props.codec) == NULL) + this->props.codec = 0; break; case DEVICE_PROFILE_HSP_HFP: if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HEADSET_HEAD_UNIT) { @@ -696,6 +699,9 @@ static int emit_nodes(struct impl *this) emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_SCO_SINK, false); } } + + if (spa_bt_device_supports_hfp_codec(this->bt_dev, get_hfp_codec(this->props.codec)) != 1) + this->props.codec = 0; break; default: return -EINVAL;