From: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxxxxxx> According to the HFP 1.6 spec, the default codec (CVSD) has ID 0x01. This change has no effect in older versions of BlueZ since the codec ID was ignored for HFP, due to the fact that HFP versions prior to 1.6 do not have such a field. --- src/modules/bluetooth/bluetooth-util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 2418f2d..d9f268d 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -864,7 +864,7 @@ finish: static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid) { DBusMessage *m; DBusMessageIter i, d; - uint8_t codec = 0; + uint8_t codec; const char *interface = y->version == BLUEZ_VERSION_4 ? "org.bluez.Media" : "org.bluez.Media1"; pa_log_debug("Registering %s on adapter %s.", endpoint, path); @@ -881,14 +881,18 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const pa_dbus_append_basic_variant_dict_entry(&d, "UUID", DBUS_TYPE_STRING, &uuid); - pa_dbus_append_basic_variant_dict_entry(&d, "Codec", DBUS_TYPE_BYTE, &codec); if (pa_streq(uuid, HFP_AG_UUID) || pa_streq(uuid, HFP_HS_UUID)) { uint8_t capability = 0; + + codec = 1; + pa_dbus_append_basic_array_variant_dict_entry(&d, "Capabilities", DBUS_TYPE_BYTE, &capability, 1); } else { a2dp_sbc_t capabilities; + codec = 0; + capabilities.channel_mode = SBC_CHANNEL_MODE_MONO | SBC_CHANNEL_MODE_DUAL_CHANNEL | SBC_CHANNEL_MODE_STEREO | SBC_CHANNEL_MODE_JOINT_STEREO; capabilities.frequency = SBC_SAMPLING_FREQ_16000 | SBC_SAMPLING_FREQ_32000 | @@ -903,6 +907,8 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const pa_dbus_append_basic_array_variant_dict_entry(&d, "Capabilities", DBUS_TYPE_BYTE, &capabilities, sizeof(capabilities)); } + pa_dbus_append_basic_variant_dict_entry(&d, "Codec", DBUS_TYPE_BYTE, &codec); + dbus_message_iter_close_container(&i, &d); send_and_add_to_pending(y, m, register_endpoint_reply, pa_xstrdup(endpoint)); -- 1.8.1.4