1 From: "vivian,zhang" <vivian.zhang@intel.com>
2 Date: Wed, 17 Jul 2013 11:17:40 +0800
3 Subject: Add bt_profile_set patch which fixed bt a2dp&hsp profile setting
6 Change-Id: I9bc3649b02ab7ac56584211789a3ea18ff17fbb7
7 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
9 configure.ac | 13 +++++++++++++
10 src/Makefile.am | 3 +++
11 src/modules/bluetooth/module-bluez4-discover.c | 18 ++++++++++++++++++
12 3 files changed, 34 insertions(+)
14 diff --git a/configure.ac b/configure.ac
15 index 870375f..6a6bc83 100644
18 @@ -679,6 +679,19 @@ fi
19 AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes")
20 dnl end --------------------------------------------------------------------
22 +dnl use bt-profile-set --------------------------------------------------------------------------
23 +AC_ARG_ENABLE(bt-profile-set, AC_HELP_STRING([--enable-bt-profile-set], [enable bt profile param]),
25 + case "${enableval}" in
26 + yes) USE_BT_PROFILE_SET=yes ;;
27 + no) USE_BT_PROFILE_SET=no ;;
28 + *) AC_MSG_ERROR(bad value ${enableval} for --enable-bt-profile-set) ;;
30 + ],[USE_BT_PROFILE_SET=no])
32 +AM_CONDITIONAL(USE_BT_PROFILE_SET, test "x$USE_BT_PROFILE_SET" = "xyes")
33 +dnl end --------------------------------------------------------------------
37 AC_MSG_CHECKING([whether we need libatomic_ops])
38 diff --git a/src/Makefile.am b/src/Makefile.am
39 index a60b5bf..b09903f 100644
42 @@ -2082,6 +2082,9 @@ module_bluetooth_discover_la_CFLAGS = $(AM_CFLAGS)
44 module_bluetooth_discover_la_CFLAGS += -DBLUETOOTH_APTX_SUPPORT
46 +if USE_BT_PROFILE_SET
47 +module_bluetooth_discover_la_CFLAGS += -DBLUETOOTH_PROFILE_SET
50 # Bluetooth BlueZ 4 sink / source
51 module_bluez4_discover_la_SOURCES = modules/bluetooth/module-bluez4-discover.c
52 diff --git a/src/modules/bluetooth/module-bluez4-discover.c b/src/modules/bluetooth/module-bluez4-discover.c
53 index 7673ba7..aaaa095 100644
54 --- a/src/modules/bluetooth/module-bluez4-discover.c
55 +++ b/src/modules/bluetooth/module-bluez4-discover.c
56 @@ -79,9 +79,27 @@ static pa_hook_result_t load_module_for_device(pa_bluez4_discovery *y, const pa_
60 +#ifdef BLUETOOTH_PROFILE_SET
61 + const char *profile = NULL;
63 + if ((d->transports[PROFILE_A2DP] && d->transports[PROFILE_A2DP]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
65 + } if ((d->transports[PROFILE_A2DP_SOURCE] && d->transports[PROFILE_A2DP_SOURCE]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
66 + profile = "a2dp_source";
67 + } else if ((d->transports[PROFILE_HFGW] && d->transports[PROFILE_HFGW]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
74 /* Oh, awesome, a new device has shown up and been connected! */
76 +#ifdef BLUETOOTH_PROFILE_SET
77 + args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" profile=\"%s\"", d->address, d->path, profile);
79 args = pa_sprintf_malloc("address=\"%s\" path=\"%s\"", d->address, d->path);
82 if (pa_modargs_get_value(u->modargs, "sco_sink", NULL) &&
83 pa_modargs_get_value(u->modargs, "sco_source", NULL)) {