From 92643f77f9010063af555fa10c0441eb049c18c5 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Fri, 25 Apr 2025 21:38:25 +0300 Subject: [PATCH] bluez5: backend-native: fix sco HUP|ERR debug message Print the error in td->err (the SO_ERROR) or else let the user know this is a regular hangup. The previous printout was always reporting EAGAIN (remainder in errno from the event loop code, I suppose) as an error, without any real data. --- spa/plugins/bluez5/backend-native.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c index 906e5268d..0e94227a1 100644 --- a/spa/plugins/bluez5/backend-native.c +++ b/spa/plugins/bluez5/backend-native.c @@ -2841,11 +2841,20 @@ static int sco_release_cb(void *data) static void sco_event(struct spa_source *source) { struct spa_bt_transport *t = source->data; + struct transport_data *td = t->user_data; struct impl *backend = SPA_CONTAINER_OF(t->backend, struct impl, this); if (source->rmask & (SPA_IO_HUP | SPA_IO_ERR)) { - spa_log_debug(backend->log, "transport %p: error on SCO socket: %s", t, strerror(errno)); + /* sco_ready() reads the socket error status in td->err */ sco_ready(t); + + if (td->err < 0) { + spa_log_info(backend->log, "transport %p: SCO socket error: %s (%d)", + t, strerror(-td->err), td->err); + } else { + spa_log_debug(backend->log, "transport %p: SCO socket hangup", t); + } + if (source->loop) spa_loop_remove_source(source->loop, source); if (t->fd >= 0) {