[PATCH] bluetooth: Fix Media Endpoint for HandsfreeGateway

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

 



Hi,

2011/8/12 Fr?d?ric Dalleau <frederic.dalleau at linux.intel.com>:
> ---
> ?src/modules/bluetooth/bluetooth-util.c ? ? ? ? ?| ? ?6 +++++-
> ?src/modules/bluetooth/module-bluetooth-device.c | ? ?2 +-
> ?2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
> index b24fe7a..76304b5 100644
> --- a/src/modules/bluetooth/bluetooth-util.c
> +++ b/src/modules/bluetooth/bluetooth-util.c
> @@ -34,6 +34,7 @@
> ?#include "a2dp-codecs.h"
>
> ?#define HFP_AG_ENDPOINT "/MediaEndpoint/HFPAG"
> +#define HFP_HS_ENDPOINT "/MediaEndpoint/HFPHS"
> ?#define A2DP_SOURCE_ENDPOINT "/MediaEndpoint/A2DPSource"
> ?#define A2DP_SINK_ENDPOINT "/MediaEndpoint/A2DPSink"
>
> @@ -665,6 +666,7 @@ static void found_adapter(pa_bluetooth_discovery *y, const char *path) {
>
> ?#ifdef DBUS_TYPE_UNIX_FD
> ? ? register_endpoint(y, path, HFP_AG_ENDPOINT, HFP_AG_UUID);
> + ? ?register_endpoint(y, path, HFP_HS_ENDPOINT, HFP_HS_UUID);
> ? ? register_endpoint(y, path, A2DP_SOURCE_ENDPOINT, A2DP_SOURCE_UUID);
> ? ? register_endpoint(y, path, A2DP_SINK_ENDPOINT, A2DP_SINK_UUID);
> ?#endif
> @@ -1169,6 +1171,8 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
>
> ? ? if (dbus_message_has_path(m, HFP_AG_ENDPOINT))
> ? ? ? ? p = PROFILE_HSP;
> + ? ?else if (dbus_message_has_path(m, HFP_HS_ENDPOINT))
> + ? ? ? ?p = PROFILE_HFGW;
> ? ? else if (dbus_message_has_path(m, A2DP_SOURCE_ENDPOINT))
> ? ? ? ? p = PROFILE_A2DP;
> ? ? else
> @@ -1412,7 +1416,7 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
> ? ? path = dbus_message_get_path(m);
> ? ? dbus_error_init(&e);
>
> - ? ?if (!pa_streq(path, A2DP_SOURCE_ENDPOINT) && !pa_streq(path, A2DP_SINK_ENDPOINT) && !pa_streq(path, HFP_AG_ENDPOINT))
> + ? ?if (!pa_streq(path, A2DP_SOURCE_ENDPOINT) && !pa_streq(path, A2DP_SINK_ENDPOINT) && !pa_streq(path, HFP_AG_ENDPOINT) && !pa_streq(path, HFP_HS_ENDPOINT))
> ? ? ? ? return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
>
> ? ? if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index 288ad2f..1638a0e 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -2545,7 +2545,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
> ? ? ? ? pa_log_warn("A2DP is not connected, refused to switch profile");
> ? ? ? ? return -PA_ERR_IO;
> ? ? }
> - ? ?else if (device->hfgw_state <= PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HFGW) {
> + ? ?else if (device->hfgw_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HFGW) {
> ? ? ? ? pa_log_warn("HandsfreeGateway is not connected, refused to switch profile");
> ? ? ? ? return -PA_ERR_IO;
> ? ? }

Looks good, now about the issue with card disappearing, try the following:

diff --git a/src/modules/bluetooth/module-bluetooth-discover.c
b/src/modules/bluetooth/module-bluetooth-discover.c
index 7b27f6b..75f85ee 100644
--- a/src/modules/bluetooth/module-bluetooth-discover.c
+++ b/src/modules/bluetooth/module-bluetooth-discover.c
@@ -77,7 +77,7 @@ static pa_hook_result_t
load_module_for_device(pa_bluetooth_discovery *y, const
     if (!d->dead && d->device_connected > 0 &&
         (d->audio_state >= PA_BT_AUDIO_STATE_CONNECTED ||
          d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED ||
-         d->hfgw_state > PA_BT_AUDIO_STATE_CONNECTED)) {
+         d->hfgw_state >= PA_BT_AUDIO_STATE_CONNECTED)) {

         if (!mi) {
             pa_module *m = NULL;

-- 
Luiz Augusto von Dentz


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

  Powered by Linux