[pulseaudio-discuss] [RFC] [PATCH 0/2] HFP AG integration with PulseAudio

2010-01-29 Thread João Paulo Rechi Vita
Hi all,

I'm trying to add support for the Handsfree Gateway role Gustavo just added
to BlueZ and oFono. The BlueZ patches can be found on [1] and [2] and the
oFono part was just merged upstream.

But when it comes to integrate them with Pulse, I'm getting a POLLHUP when
trying to write on the fd. Also, it seems different gateways have different
behaviours regarding when they connect the SCO link. Some phone connect
them just after the RFCOMM link (some Nokia phones), when there is no call
going on yet, and others just when a call is started (Android 1.5).

Also, right now the same property (State) is beeing used to refer when the
RFCOOM link is established (State=Connected) and when the SCO link is
established (State=Playing). Shouldn't this be handled by separate props?

And last but not least, is the new Media API intended to handle the audio
part of handsfree gateways too? If so, maybe we should use all this work
as a prototype for latter integration with the new API.

Any help on testing and getting this working together or comments on the
topic would be appreciated.

[1] http://www.spinics.net/lists/linux-bluetooth/msg04250.html
[2] http://www.spinics.net/lists/linux-bluetooth/msg04251.html

--
João Paulo Rechi Vita
http://jprvita.wordpress.com/

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 2/2] bluetooth: add HFP Gateway support

2010-01-29 Thread João Paulo Rechi Vita
From: João Paulo Rechi Vita jprv...@profusion.mobi

Create the 'Handsfree Gateway' profile for bluetooth cards and add
filters for 'org.bluez.HandsfreeGateway' to the discover module so
module-bluetooth-device is loaded with the correct profile when a
Handsfree Gateway connects to bluetoothd (in this case bluetoothd
is acting as the headset).
---
 src/modules/bluetooth/bluetooth-util.c|   30 ++--
 src/modules/bluetooth/bluetooth-util.h|3 +
 src/modules/bluetooth/module-bluetooth-device.c   |   50 +++-
 src/modules/bluetooth/module-bluetooth-discover.c |9 +++-
 4 files changed, 72 insertions(+), 20 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c 
b/src/modules/bluetooth/bluetooth-util.c
index d3f3bfe..a873e25 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -97,6 +97,7 @@ static pa_bluetooth_device* device_new(const char *path) {
 d-audio_sink_state = PA_BT_AUDIO_STATE_INVALID;
 d-audio_source_state = PA_BT_AUDIO_STATE_INVALID;
 d-headset_state = PA_BT_AUDIO_STATE_INVALID;
+d-hfgw_state = PA_BT_AUDIO_STATE_INVALID;
 
 return d;
 }
@@ -122,11 +123,11 @@ static pa_bool_t device_is_audio(pa_bluetooth_device *d) {
 pa_assert(d);
 
 return
-d-device_info_valid 
+d-device_info_valid  (d-hfgw_state != PA_BT_AUDIO_STATE_INVALID ||
 (d-audio_state != PA_BT_AUDIO_STATE_INVALID 
  (d-audio_sink_state != PA_BT_AUDIO_STATE_INVALID ||
   d-audio_source_state != PA_BT_AUDIO_STATE_INVALID ||
-  d-headset_state != PA_BT_AUDIO_STATE_INVALID));
+  d-headset_state != PA_BT_AUDIO_STATE_INVALID)));
 }
 
 static int parse_device_property(pa_bluetooth_discovery *y, 
pa_bluetooth_device *d, DBusMessageIter *i) {
@@ -229,7 +230,10 @@ static int parse_device_property(pa_bluetooth_discovery 
*y, pa_bluetooth_device
 PA_LLIST_PREPEND(pa_bluetooth_uuid, d-uuids, node);
 
 /* Vudentz said the interfaces are here when the UUIDs are 
announced */
-if (strcasecmp(HSP_HS_UUID, value) == 0 || 
strcasecmp(HFP_HS_UUID, value) == 0) {
+if (strcasecmp(HSP_AG_UUID, value) == 0 || 
strcasecmp(HFP_AG_UUID, value) == 0) {
+pa_assert_se(m = 
dbus_message_new_method_call(org.bluez, d-path, 
org.bluez.HandsfreeGateway, GetProperties));
+send_and_add_to_pending(y, d, m, get_properties_reply);
+} else if (strcasecmp(HSP_HS_UUID, value) == 0 || 
strcasecmp(HFP_HS_UUID, value) == 0) {
 pa_assert_se(m = 
dbus_message_new_method_call(org.bluez, d-path, org.bluez.Headset, 
GetProperties));
 send_and_add_to_pending(y, d, m, get_properties_reply);
 } else if (strcasecmp(A2DP_SINK_UUID, value) == 0) {
@@ -396,9 +400,14 @@ static void get_properties_reply(DBusPendingCall *pending, 
void *userdata) {
 }  else if (dbus_message_has_interface(p-message, 
org.bluez.AudioSink)) {
 if (parse_audio_property(y, d-audio_sink_state, dict_i)  0)
 goto finish;
+
 }  else if (dbus_message_has_interface(p-message, 
org.bluez.AudioSource)) {
 if (parse_audio_property(y, d-audio_source_state, dict_i)  
0)
 goto finish;
+
+}  else if (dbus_message_has_interface(p-message, 
org.bluez.HandsfreeGateway)) {
+if (parse_audio_property(y, d-hfgw_state, arg_i)  0)
+goto finish;
 }
 }
 
@@ -626,6 +635,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, 
DBusMessage *m, void *us
dbus_message_is_signal(m, org.bluez.Headset, 
PropertyChanged) ||
dbus_message_is_signal(m, org.bluez.AudioSink, 
PropertyChanged) ||
dbus_message_is_signal(m, org.bluez.AudioSource, 
PropertyChanged) ||
+   dbus_message_is_signal(m, org.bluez.HandsfreeGateway, 
PropertyChanged) ||
dbus_message_is_signal(m, org.bluez.Device, 
PropertyChanged)) {
 
 pa_bluetooth_device *d;
@@ -653,9 +663,14 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, 
DBusMessage *m, void *us
 }  else if (dbus_message_has_interface(m, org.bluez.AudioSink)) {
 if (parse_audio_property(y, d-audio_sink_state, arg_i)  0)
 goto fail;
+
 }  else if (dbus_message_has_interface(m, 
org.bluez.AudioSource)) {
 if (parse_audio_property(y, d-audio_source_state, arg_i)  
0)
 goto fail;
+
+}  else if (dbus_message_has_interface(m, 
org.bluez.HandsfreeGateway)) {
+if (parse_audio_property(y, d-hfgw_state, arg_i)  0)
+goto fail;
 }
 
 run_callback(y, d, FALSE);
@@ -672,6 +687,7 @@ static DBusHandlerResult 

Re: [pulseaudio-discuss] [RFC] [PATCH 0/2] HFP AG integration with PulseAudio

2010-01-29 Thread João Paulo Rechi Vita
2010/1/29 João Paulo Rechi Vita jprv...@gmail.com:
 Hi all,

 I'm trying to add support for the Handsfree Gateway role Gustavo just added
 to BlueZ and oFono. The BlueZ patches can be found on [1] and [2] and the
 oFono part was just merged upstream.

 But when it comes to integrate them with Pulse, I'm getting a POLLHUP when
 trying to write on the fd. Also, it seems different gateways have different
 behaviours regarding when they connect the SCO link. Some phone connect
 them just after the RFCOMM link (some Nokia phones), when there is no call
 going on yet, and others just when a call is started (Android 1.5).

 Also, right now the same property (State) is beeing used to refer when the
 RFCOOM link is established (State=Connected) and when the SCO link is
 established (State=Playing). Shouldn't this be handled by separate props?

 And last but not least, is the new Media API intended to handle the audio
 part of handsfree gateways too? If so, maybe we should use all this work
 as a prototype for latter integration with the new API.

 Any help on testing and getting this working together or comments on the
 topic would be appreciated.

 [1] http://www.spinics.net/lists/linux-bluetooth/msg04250.html
 [2] http://www.spinics.net/lists/linux-bluetooth/msg04251.html

 --
 João Paulo Rechi Vita
 http://jprvita.wordpress.com/



I forgot to add, suspending of the sink/source seemed to cause
disconnection by the AG, so you might want to disable
module-suspend-on-idle when testing. BTW, Lennart, is there any way to
mark a source/sink to not be suspended?

-- 
João Paulo Rechi Vita
http://jprvita.wordpress.com/
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC] [PATCH 0/2] HFP AG integration with PulseAudio

2010-01-29 Thread Colin Guthrie
'Twas brillig, and João Paulo Rechi Vita at 29/01/10 14:53 did gyre and
gimble:
 I forgot to add, suspending of the sink/source seemed to cause
 disconnection by the AG, so you might want to disable
 module-suspend-on-idle when testing. BTW, Lennart, is there any way to
 mark a source/sink to not be suspended?

Don't quote me but I think you just handle the sink message
PA_SINK_MESSAGE_SET_STATE and make it a noop and don't pass through to
calling pa_sink_process_msg(o, code, data, offset, chunk);

I catch this message in the raop-sink module but I *do* pass it on to
the above function.

I could be wrong with the above tho' and there may be a simpler way.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss