bluez5: Use spa_log_hexdump() to dump media properties/configuration

This commit is contained in:
Frédéric Danis 2022-07-18 11:26:59 +02:00
parent 1d39ea004e
commit 2c72597271
2 changed files with 10 additions and 14 deletions

View file

@ -885,7 +885,7 @@ static void a2dp_on_timeout(struct spa_source *source)
static int do_start(struct impl *this) static int do_start(struct impl *this)
{ {
int i, res, val, size; int res, val, size;
struct port *port; struct port *port;
socklen_t len; socklen_t len;
uint8_t *conf; uint8_t *conf;
@ -907,8 +907,8 @@ static int do_start(struct impl *this)
conf = this->transport->configuration; conf = this->transport->configuration;
size = this->transport->configuration_len; size = this->transport->configuration_len;
for (i = 0; i < size; i++) spa_log_debug(this->log, "Transport configuration:");
spa_log_debug(this->log, " %d: %02x", i, conf[i]); spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
this->codec_data = this->codec->init(this->codec, this->codec_data = this->codec->init(this->codec,
this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0, this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0,

View file

@ -491,7 +491,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu
uint8_t *pconf = (uint8_t *) config; uint8_t *pconf = (uint8_t *) config;
DBusMessage *r; DBusMessage *r;
DBusError err; DBusError err;
int i, size, res; int size, res;
const struct a2dp_codec *codec; const struct a2dp_codec *codec;
bool sink; bool sink;
@ -506,8 +506,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
spa_log_info(monitor->log, "%p: %s select conf %d", monitor, path, size); spa_log_info(monitor->log, "%p: %s select conf %d", monitor, path, size);
for (i = 0; i < size; i++) spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, cap, (size_t)size);
spa_log_debug(monitor->log, " %d: %02x", i, cap[i]);
codec = a2dp_endpoint_to_codec(monitor, path, &sink); codec = a2dp_endpoint_to_codec(monitor, path, &sink);
if (codec != NULL) if (codec != NULL)
@ -529,8 +528,7 @@ static DBusHandlerResult endpoint_select_configuration(DBusConnection *conn, DBu
return DBUS_HANDLER_RESULT_NEED_MEMORY; return DBUS_HANDLER_RESULT_NEED_MEMORY;
goto exit_send; goto exit_send;
} }
for (i = 0; i < size; i++) spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, pconf, (size_t)size);
spa_log_debug(monitor->log, " %d: %02x", i, pconf[i]);
if ((r = dbus_message_new_method_return(m)) == NULL) if ((r = dbus_message_new_method_return(m)) == NULL)
return DBUS_HANDLER_RESULT_NEED_MEMORY; 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")) { else if (spa_streq(key, "Capabilities")) {
DBusMessageIter iter; DBusMessageIter iter;
uint8_t *value; uint8_t *value;
int i, len; int len;
if (!check_iter_signature(&it[1], "ay")) if (!check_iter_signature(&it[1], "ay"))
goto next; 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); dbus_message_iter_get_fixed_array(&iter, &value, &len);
spa_log_debug(monitor->log, "remote_endpoint %p: %s=%d", remote_endpoint, key, len); spa_log_debug(monitor->log, "remote_endpoint %p: %s=%d", remote_endpoint, key, len);
for (i = 0; i < len; i++) spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
spa_log_debug(monitor->log, " %d: %02x", i, value[i]);
free(remote_endpoint->capabilities); free(remote_endpoint->capabilities);
remote_endpoint->capabilities_len = 0; 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")) { else if (spa_streq(key, "Configuration")) {
DBusMessageIter iter; DBusMessageIter iter;
uint8_t *value; uint8_t *value;
int i, len; int len;
if (!check_iter_signature(&it[1], "ay")) if (!check_iter_signature(&it[1], "ay"))
goto next; 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); dbus_message_iter_get_fixed_array(&iter, &value, &len);
spa_log_debug(monitor->log, "transport %p: %s=%d", transport, key, len); spa_log_debug(monitor->log, "transport %p: %s=%d", transport, key, len);
for (i = 0; i < len; i++) spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
spa_log_debug(monitor->log, " %d: %02x", i, value[i]);
free(transport->configuration); free(transport->configuration);
transport->configuration_len = 0; transport->configuration_len = 0;