Commit f3c0e6f1 authored by pali's avatar pali
Browse files

bluetooth: legacy_hsp: Implement RequestDisconnection DBus method

Properly stop bluetooth transport when bluez is asking for it. This is required for correct co-operation with hsphpfd bluetooth daemon.
parent 55c5ff84
......@@ -530,10 +530,35 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *m,
static DBusMessage *profile_request_disconnection(DBusConnection *conn, DBusMessage *m, void *userdata) {
pa_bluetooth_backend *b = userdata;
DBusMessage *r;
DBusError error;
const char *path;
pa_bluetooth_transport *t;
pa_assert_se(r = dbus_message_new_method_return(m));
if (!dbus_message_get_args(m, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
pa_log_error("Invalid parameters found in RequestDisconnection: %s", error.message);
pa_assert_se(r = dbus_message_new_error_printf(m, "org.bluez.Error.InvalidArguments", "Invalid parameters: %s", error.message));
return r;
pa_log_debug("dbus: RequestDisconnection path=%s", path);
t = pa_bluetooth_transport_get(b->discovery, path);
if (!t || !pa_safe_streq(dbus_message_get_sender(m), t->owner) || t->profile != PA_BLUETOOTH_PROFILE_HSP_HEAD_UNIT) {
pa_log_error("RequestDisconnection failed: Endpoint %s is not connected", path);
pa_assert_se(r = dbus_message_new_error_printf(m, "org.bluez.Error.InvalidArguments", "Endpoint %s is not connected", path));
return r;
pa_assert_se(r = dbus_message_new_method_return(m));
return r;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment