From 2c7259727152399dad9d34266ba9d0583ba0bc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Mon, 18 Jul 2022 11:26:59 +0200 Subject: [PATCH] bluez5: Use spa_log_hexdump() to dump media properties/configuration --- spa/plugins/bluez5/a2dp-sink.c | 6 +++--- spa/plugins/bluez5/bluez5-dbus.c | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index fac3b57a7..9d712d815 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -885,7 +885,7 @@ static void a2dp_on_timeout(struct spa_source *source) static int do_start(struct impl *this) { - int i, res, val, size; + int res, val, size; struct port *port; socklen_t len; uint8_t *conf; @@ -907,8 +907,8 @@ static int do_start(struct impl *this) conf = this->transport->configuration; size = this->transport->configuration_len; - for (i = 0; i < size; i++) - spa_log_debug(this->log, " %d: %02x", i, conf[i]); + spa_log_debug(this->log, "Transport configuration:"); + spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size); this->codec_data = this->codec->init(this->codec, this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0, diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index f43d4b57d..93f8e7217 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -491,7 +491,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu uint8_t *pconf = (uint8_t *) config; DBusMessage *r; DBusError err; - int i, size, res; + int size, res; const struct a2dp_codec *codec; bool sink; @@ -506,8 +506,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } spa_log_info(monitor->log, "%p: %s select conf %d", monitor, path, size); - for (i = 0; i < size; i++) - spa_log_debug(monitor->log, " %d: %02x", i, cap[i]); + spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, cap, (size_t)size); codec = a2dp_endpoint_to_codec(monitor, path, &sink); if (codec != NULL) @@ -529,8 +528,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu return DBUS_HANDLER_RESULT_NEED_MEMORY; goto exit_send; } - for (i = 0; i < size; i++) - spa_log_debug(monitor->log, " %d: %02x", i, pconf[i]); + spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, pconf, (size_t)size); if ((r = dbus_message_new_method_return(m)) == NULL) return DBUS_HANDLER_RESULT_NEED_MEMORY; @@ -1734,7 +1732,7 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en else if (spa_streq(key, "Capabilities")) { DBusMessageIter iter; uint8_t *value; - int i, len; + int len; if (!check_iter_signature(&it[1], "ay")) goto next; @@ -1743,8 +1741,7 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en dbus_message_iter_get_fixed_array(&iter, &value, &len); spa_log_debug(monitor->log, "remote_endpoint %p: %s=%d", remote_endpoint, key, len); - for (i = 0; i < len; i++) - spa_log_debug(monitor->log, " %d: %02x", i, value[i]); + spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len); free(remote_endpoint->capabilities); remote_endpoint->capabilities_len = 0; @@ -2267,7 +2264,7 @@ static int transport_update_props(struct spa_bt_transport *transport, else if (spa_streq(key, "Configuration")) { DBusMessageIter iter; uint8_t *value; - int i, len; + int len; if (!check_iter_signature(&it[1], "ay")) goto next; @@ -2276,8 +2273,7 @@ static int transport_update_props(struct spa_bt_transport *transport, dbus_message_iter_get_fixed_array(&iter, &value, &len); spa_log_debug(monitor->log, "transport %p: %s=%d", transport, key, len); - for (i = 0; i < len; i++) - spa_log_debug(monitor->log, " %d: %02x", i, value[i]); + spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len); free(transport->configuration); transport->configuration_len = 0;