From 8277bf6b36b24d45111a1f2ae96bb923f0ad298e Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Thu, 2 Oct 2025 01:25:56 +0300 Subject: [PATCH] bluez5: improve error messages when connection drops Log something less confusing when connection to remote device drops unexpectedly. Silence logging transport Release() error in cases where the transport was simultaneously deleted. --- spa/plugins/bluez5/bluez5-dbus.c | 5 +++++ spa/plugins/bluez5/media-sink.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 1beddebd4..07b122c63 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -4143,6 +4143,11 @@ release: */ spa_log_debug(monitor->log, "Failed to release idle transport %s: %s", transport->path, err.message); + } else if (spa_streq(err.name, DBUS_ERROR_UNKNOWN_METHOD) || + spa_streq(err.name, DBUS_ERROR_UNKNOWN_OBJECT)) { + /* Transport disappeared */ + spa_log_debug(monitor->log, "Failed to release (gone) transport %s: %s", + transport->path, err.message); } else { spa_log_error(monitor->log, "Failed to release transport %s: %s", transport->path, err.message); diff --git a/spa/plugins/bluez5/media-sink.c b/spa/plugins/bluez5/media-sink.c index f5708d080..271cc419c 100644 --- a/spa/plugins/bluez5/media-sink.c +++ b/spa/plugins/bluez5/media-sink.c @@ -1300,7 +1300,8 @@ static void media_on_flush_error(struct spa_source *source) spa_log_trace(this->log, "%p: flush event", this); if (source->rmask & (SPA_IO_HUP | SPA_IO_ERR)) { - spa_log_warn(this->log, "%p: error %d", this, source->rmask); + spa_log_warn(this->log, "%p: connection (%s) terminated unexpectedly", + this, this->transport ? this->transport->path : ""); if (this->flush_source.loop) { spa_bt_latency_flush(&this->tx_latency, this->flush_source.fd, this->log); spa_loop_remove_source(this->data_loop, &this->flush_source);