From d805253c69a857c309dcac52d9b74b0838ffcf01 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 26 Mar 2021 12:09:43 +0100 Subject: [PATCH] bluez5: don't warn when the services are not available If oFono or hsphfpd are not installed, just log an info message that they are not used. The native backend will work fine and we don't want to log warnings. See #971 --- spa/plugins/bluez5/backend-hsphfpd.c | 13 +++++++++++-- spa/plugins/bluez5/backend-ofono.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/spa/plugins/bluez5/backend-hsphfpd.c b/spa/plugins/bluez5/backend-hsphfpd.c index 1fa42aaa6..478ff7aed 100644 --- a/spa/plugins/bluez5/backend-hsphfpd.c +++ b/spa/plugins/bluez5/backend-hsphfpd.c @@ -1219,6 +1219,7 @@ static int backend_hsphfpd_register(void *data) const char *path = APPLICATION_OBJECT_MANAGER_PATH; DBusPendingCall *call; DBusError err; + int res; spa_log_debug(backend->log, NAME": Registering to hsphfpd"); @@ -1235,9 +1236,17 @@ static int backend_hsphfpd_register(void *data) dbus_message_unref(m); if (r == NULL) { - spa_log_warn(backend->log, NAME": Registering application %s failed", path); + if (dbus_error_has_name(&err, "org.freedesktop.DBus.Error.ServiceUnknown")) { + spa_log_info(backend->log, NAME": hsphfpd not available: %s", + err.message); + res = -ENOTSUP; + } else { + spa_log_warn(backend->log, NAME": Registering application %s failed: %s (%s)", + path, err.message, err.name); + res = -EIO; + } dbus_error_free(&err); - return -EIO; + return res; } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { diff --git a/spa/plugins/bluez5/backend-ofono.c b/spa/plugins/bluez5/backend-ofono.c index 7208e3e3c..a761070c6 100644 --- a/spa/plugins/bluez5/backend-ofono.c +++ b/spa/plugins/bluez5/backend-ofono.c @@ -541,7 +541,7 @@ static int backend_ofono_register(void *data) const char *path = OFONO_AUDIO_CLIENT; uint8_t codecs[2]; const uint8_t *pcodecs = codecs; - int ncodecs = 0; + int ncodecs = 0, res; DBusPendingCall *call; DBusError err; @@ -566,9 +566,17 @@ static int backend_ofono_register(void *data) dbus_message_unref(m); if (r == NULL) { - spa_log_warn(backend->log, NAME": Registering Profile %s failed", path); + if (dbus_error_has_name(&err, "org.freedesktop.DBus.Error.ServiceUnknown")) { + spa_log_info(backend->log, NAME": oFono not available: %s", + err.message); + res = -ENOTSUP; + } else { + spa_log_warn(backend->log, NAME": Registering Profile %s failed: %s (%s)", + path, err.message, err.name); + res = -EIO; + } dbus_error_free(&err); - return -EIO; + return res; } if (dbus_message_is_error(r, OFONO_ERROR_INVALID_ARGUMENTS)) {