AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes")
dnl end --------------------------------------------------------------------
+dnl use bt-profile-set --------------------------------------------------------------------------
+AC_ARG_ENABLE(bt-profile-set, AC_HELP_STRING([--enable-bt-profile-set], [enable bt profile param]),
+[
+ case "${enableval}" in
+ yes) USE_BT_PROFILE_SET=yes ;;
+ no) USE_BT_PROFILE_SET=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-bt-profile-set) ;;
+ esac
+ ],[USE_BT_PROFILE_SET=no])
+
+AM_CONDITIONAL(USE_BT_PROFILE_SET, test "x$USE_BT_PROFILE_SET" = "xyes")
+dnl end --------------------------------------------------------------------
+
#### atomic-ops ####
AC_MSG_CHECKING([whether we need libatomic_ops])
else
module_bluetooth_discover_la_CFLAGS = $(AM_CFLAGS)
endif
+if USE_BT_PROFILE_SET
+module_bluetooth_discover_la_CFLAGS += -DBLUETOOTH_PROFILE_SET
+endif
# Bluetooth BlueZ 4 sink / source
module_bluez4_discover_la_SOURCES = modules/bluetooth/module-bluez4-discover.c
pa_module *m = NULL;
char *args;
+#ifdef BLUETOOTH_PROFILE_SET
+ const char *profile = NULL;
+
+ if ((d->transports[PROFILE_A2DP] && d->transports[PROFILE_A2DP]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
+ profile = "a2dp";
+ } if ((d->transports[PROFILE_A2DP_SOURCE] && d->transports[PROFILE_A2DP_SOURCE]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
+ profile = "a2dp_source";
+ } else if ((d->transports[PROFILE_HFGW] && d->transports[PROFILE_HFGW]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
+ profile = "hfgw";
+ }
+ if (!profile)
+ return PA_HOOK_OK;
+#endif
+
/* Oh, awesome, a new device has shown up and been connected! */
+#ifdef BLUETOOTH_PROFILE_SET
+ args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" profile=\"%s\"", d->address, d->path, profile);
+#else
args = pa_sprintf_malloc("address=\"%s\" path=\"%s\"", d->address, d->path);
+#endif
if (pa_modargs_get_value(u->modargs, "sco_sink", NULL) &&
pa_modargs_get_value(u->modargs, "sco_source", NULL)) {