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

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Wed Sep 5 01:04:54 UTC 2018


On Fri, 2018-08-31 at 21:18 -0700, Rodrigo Vivi wrote:
> 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 am expecting igt_info() in Patch 1/6 to go way, but this looks
better. Please make it obvious that the values are in hex by prefixing
"0x". Same with the offset too.

> i));
> +		igt_info("\n");
>  	}
>  	else {
>  		igt_warn("Failed to open %s aux device - error:
> %s\n", device, strerror(errno));


More information about the igt-dev mailing list