diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2018-09-03 19:33:23 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-09-04 18:00:37 +0200 |
commit | 35386dfd13b746daf36a393bdf066dbe9b9b7aed (patch) | |
tree | b81d6bc4f0fb30a6033ad38e8763826c1b352e17 /tools/spi | |
parent | spi: sh-msiof: Document R-Car E3 support (diff) | |
download | linux-35386dfd13b746daf36a393bdf066dbe9b9b7aed.tar.xz linux-35386dfd13b746daf36a393bdf066dbe9b9b7aed.zip |
spi: spidev_test: Improve decoded text part of hex dump
- Print spaces as spaces,
- Do not print characters > 126, as they will be shown as garbage
in the modern UTF-8 era,
- Use a normal period instead of its hexadecimal ASCII value,
- Delimit the text part with pipe symbols on both sides (was left side
only), without any spaces, to make it clear where the decoded text
starts and ends,
- Drop a useless comment.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/spi')
-rw-r--r-- | tools/spi/spidev_test.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c index 8c590cd1171a..4c12e6aea5d5 100644 --- a/tools/spi/spidev_test.c +++ b/tools/spi/spidev_test.c @@ -73,12 +73,12 @@ static void hex_dump(const void *src, size_t length, size_t line_size, while (i++ % line_size) printf("__ "); } - printf(" | "); /* right close */ + printf(" |"); while (line < address) { c = *line++; - printf("%c", (c < 33 || c == 255) ? 0x2E : c); + printf("%c", (c < 32 || c > 126) ? '.' : c); } - printf("\n"); + printf("|\n"); if (length > 0) printf("%s | ", prefix); } |