From 4c49d095fcff2087db32a6477398e946104af47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Barna=C5=9B?= Date: Fri, 31 Mar 2023 18:44:40 +0200 Subject: [PATCH] i2c: improve the message dumps messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit changes the format of printed messages to align the following strings and make it more readable. Signed-off-by: Michał Barnaś --- drivers/i2c/i2c_common.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/i2c_common.c b/drivers/i2c/i2c_common.c index 6094ed12c77..616e15a2d03 100644 --- a/drivers/i2c/i2c_common.c +++ b/drivers/i2c/i2c_common.c @@ -35,15 +35,13 @@ void i2c_dump_msgs_rw(const struct device *dev, const struct i2c_msg *msgs, uint const bool dump_data = dump_read || !is_read; if (msg->len == 1 && dump_data) { - LOG_DBG(" %c %s%s len=01: %02x", is_read ? 'R' : 'W', - msg->flags & I2C_MSG_RESTART ? "Sr " : "", - msg->flags & I2C_MSG_STOP ? "P" : "", - msg->buf[0]); + LOG_DBG(" %c %2s %1s len=01: %02x", is_read ? 'R' : 'W', + msg->flags & I2C_MSG_RESTART ? "Sr" : "", + msg->flags & I2C_MSG_STOP ? "P" : "", msg->buf[0]); } else { - LOG_DBG(" %c %s%s len=%02x: ", is_read ? 'R' : 'W', - msg->flags & I2C_MSG_RESTART ? "Sr " : "", - msg->flags & I2C_MSG_STOP ? "P" : "", - msg->len); + LOG_DBG(" %c %2s %1s len=%02x: ", is_read ? 'R' : 'W', + msg->flags & I2C_MSG_RESTART ? "Sr" : "", + msg->flags & I2C_MSG_STOP ? "P" : "", msg->len); if (dump_data) { LOG_HEXDUMP_DBG(msg->buf, msg->len, "contents:"); }