[igt-dev] [PATCH i-g-t 2/6] tools/dpcd_reg: Improve outputs

Rodrigo Vivi rodrigo.vivi at intel.com
Sat Sep 1 04:18:02 UTC 2018


Before:

$ dpcd_reg read --device=0 --offset=0200 --count 8
Read 8 byte(s) starting at offset 200

41
0
0
0
80
0
66
66

After:
$ dpcd_reg read --device=0 --offset=0200 --count 8
0200: 41 00 00 00 80 00 66 66

Besides the clean view this will allow us to integrate
the dump and multiple reads.

Cc: Tarun Vyas <tarun.vyas at intel.com>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 tools/dpcd_reg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/dpcd_reg.c b/tools/dpcd_reg.c
index 39dde2c9..d139007c 100644
--- a/tools/dpcd_reg.c
+++ b/tools/dpcd_reg.c
@@ -75,9 +75,10 @@ static int dpcd_read(char *device, const uint32_t offset, size_t count)
 			goto out;
 		}
 
-		igt_info("Read %zu byte(s) starting at offset %x\n\n", count, offset);
+		igt_info("%04x:", offset);
 		for (i = 0; i < count; i++)
-			igt_info("%x\n", *(((uint8_t *)(buf)) + i));
+			igt_info(" %02x", *(((uint8_t *)(buf)) + i));
+		igt_info("\n");
 	}
 	else {
 		igt_warn("Failed to open %s aux device - error: %s\n", device, strerror(errno));
-- 
2.17.1



More information about the igt-dev mailing list