/* a new device has been connected */
pa_module *m;
#ifdef __TIZEN_BT__
- char *args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" autodetect_mtu=%i", d->address, d->path, (int)u->autodetect_mtu);
-#else
- char *args = pa_sprintf_malloc("path=%s autodetect_mtu=%i", d->path, (int)u->autodetect_mtu);
-#endif
+ const char *profile = NULL;
-#ifdef __TIZEN_BT__
- if (pa_bluetooth_device_sink_transport_connected(d) == true)
- args = pa_sprintf_malloc("%s profile=\"a2dp_sink\"", args);
+ if (pa_bluetooth_device_sink_transport_connected(d))
+ profile = "a2dp_sink";
+ else if (pa_bluetooth_device_source_transport_connected(d))
+ profile = "a2dp_source";
- if (pa_bluetooth_device_source_transport_connected(d) == true)
- args = pa_sprintf_malloc("%s profile=\"a2dp_source\"", args);
+ char *args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" autodetect_mtu=%i profile=\"%s\"",
+ d->address, d->path, (int)u->autodetect_mtu, pa_strnull(profile));
+#else
+ char *args = pa_sprintf_malloc("path=%s autodetect_mtu=%i", d->path, (int)u->autodetect_mtu);
#endif
-
pa_log_debug("Loading module-bluez5-device %s", args);
pa_module_load(&m, u->module->core, "module-bluez5-device", args);
pa_xfree(args);