[RFC v0 06/15] bluetooth: Add HFP 1.6 codec ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 bf31f28..67b3240 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -814,7 +814,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;
 
     pa_log_debug("Registering %s on adapter %s.", endpoint, path);
 
@@ -830,14 +830,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 |
@@ -852,6 +856,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.7.11.7



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux