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
This commit is contained in:
Wim Taymans 2021-03-26 12:09:43 +01:00
parent 0af8c0c045
commit d805253c69
2 changed files with 22 additions and 5 deletions

View file

@ -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) {

View file

@ -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)) {