[pulseaudio-discuss] [RFC 21/24] bluetooth: Fix stream setup for PROFILE_HFP_AG

jprvita at gmail.com jprvita at gmail.com
Tue Mar 26 22:17:00 PDT 2013


From: João Paulo Rechi Vita <jprvita at openbossa.org>

Use the correct value for block size and instead of trying to acquire
the transport, get it from the HF card.
---
 src/modules/bluetooth/bluetooth-util.c          | 15 +++++++++++++++
 src/modules/bluetooth/module-bluetooth-device.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index a2be396..37d96ee 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1838,6 +1838,21 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, siz
     pa_assert(t->device);
     pa_assert(t->device->discovery);
 
+    if (t->profile == PROFILE_HFP_AG) {
+        struct handsfree_card *hf_card = pa_hashmap_get(t->device->discovery->hf_cards, t->path);
+
+        /* TODO: get block size from adapter and USB endpoint */
+        if (imtu)
+            *imtu = 48;
+        if (omtu)
+            *omtu = 48;
+
+        if (hf_card)
+            return hf_card->fd;
+        else
+            return -1;
+    }
+
     dbus_error_init(&err);
 
     if (t->device->discovery->version == BLUEZ_VERSION_4) {
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 1027dd5..47457e5 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -243,7 +243,7 @@ static void a2dp_set_bitpool(struct userdata *u, uint8_t bitpool)
 /* from IO thread, except in SCO over PCM */
 static void bt_transport_config_mtu(struct userdata *u) {
     /* Calculate block sizes */
-    if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW) {
+    if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW || u->profile == PROFILE_HFP_AG) {
         u->read_block_size = u->read_link_mtu;
         u->write_block_size = u->write_link_mtu;
     } else {
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list