From 75c3d3ecf8d7ef188b00e2ac000070528c42565a Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 9 Mar 2026 20:39:44 +0200 Subject: [PATCH] bluez5: fix spa_bt_device_supports_media_codec() for HFP codecs HFP codecs don't have a direction dependent "target" profile, and this function was returning false if A2DP is disabled. Don't check target profile for HFP, leave checks to backend. Fixes HFP-only configurations, which were missing profiles. --- spa/plugins/bluez5/bluez5-dbus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 7dfe45911..6e4af5be2 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -2777,16 +2777,18 @@ bool spa_bt_device_supports_media_codec(struct spa_bt_device *device, const stru bool is_bap = codec->kind == MEDIA_CODEC_BAP; size_t i; - codec_target_profile = get_codec_target_profile(monitor, codec); - if (!codec_target_profile) - return false; - if (codec->kind == MEDIA_CODEC_HFP) { if (!(profile & SPA_BT_PROFILE_HEADSET_AUDIO)) return false; + if (!is_media_codec_enabled(monitor, codec)) + return false; return spa_bt_backend_supports_codec(monitor->backend, device, codec->codec_id) == 1; } + codec_target_profile = get_codec_target_profile(monitor, codec); + if (!codec_target_profile) + return false; + if (!device->adapter->a2dp_application_registered && is_a2dp) { /* Codec switching not supported: only plain SBC allowed */ return (codec->codec_id == A2DP_CODEC_SBC && spa_streq(codec->name, "sbc") &&