[PATCH v2 0/8] spi: spidev_test: new features
From: Jonas Rebmann
Date: Wed Sep 16 2026 - 13:56:09 EST
A collection of new features for spidev_test which have collected during
testing/development of spi drivers.
Patch 2 is a small preparatory commit to share macro definitions with
the rest of the tools tree instead of keeping local copies.
Patches 3 to 7 add the following options:
-c, --compare Compare RX against TX without enabling controller
loopback mode; useful when TX is physically
bridged to RX.
-t, --no-tx Do not provide a TX buffer.
-r, --no-rx Do not provide an RX buffer.
-z, --nonzero Skip 0x00 and 0xff bytes in the generated
random TX pattern so that a stuck line (pulled
high or low) does not produce a false positive
in compare mode.
-P, --predictable Send a deterministic byte sequence instead of
random data, so that runs can be compared e.g.
on an oscilloscope.
-T, --transfers N Split the message into N SPI transfers inside a
single SPI_IOC_MESSAGE() ioctl, exercising the
controller's multi-transfer handling.
Patch 8 resolves out of bounds issues when parsing escape sequences in
the -i (--input) parameter.
Signed-off-by: Jonas Rebmann <jre@xxxxxxxxxxxxxx>
---
Changes in v2:
- Keep options sorted alphabetically in usage help (Thanks, Mark)
- Count mutually exclusive input choices during argparse to avoid
overwhelmingly cute construct during verification (Thanks, Mark)
- 3/7: Error on conflicting --no-rx --output <file> early (Thanks, Mark)
- 3/7: Make usage error message more clear
- 4/7: Braces for legibility (Thanks, Mark)
- 6/7: Heap-allocate transfer-array tr (Thanks, Mark)
- 6/7: Ensure --bpw is greater than zero, prevents division by zero (Thanks, Mark)
- 6/7: Use roundup instead of ALIGN so -T works when --bpw is no power of two (Thanks, Mark)
- 7/7: Limit hexdump to 256 characters (Thanks, Mark)
- 7/7: Preserve errno (Thanks, Mark)
- Add patch 8 to deal with a preexisting issue (sashiko)
- 2/7: Conflict -c with -2/-4/-8 (sashiko)
- Link to v1: https://patch.msgid.link/20260914-spi-sun4i-spidev_test-v1-0-72d6a3b38cee@xxxxxxxxxxxxxx
---
Jonas Rebmann (2):
spi: spidev_test: include tools/include
spi: spidev_test: rewrite unescape() to stay in bounds
Marc Kleine-Budde (6):
spi: spidev_test: add compare mode
spi: spidev_test: allow disabling rx or tx buffers
spi: spidev_test: don't send 0x0 or 0xff
spi: spidev_test: send predictable data
spi: spidev_test: add option to split message into multiple transfers
spi: spidev_test: print TX on error
tools/spi/Makefile | 2 +-
tools/spi/spidev_test.c | 239 ++++++++++++++++++++++++++++++++++--------------
2 files changed, 171 insertions(+), 70 deletions(-)
---
base-commit: 89a312991dc6e638a36adc43ccb91dbc25504c04
change-id: 20260910-spi-sun4i-spidev_test-881b33fdc3b4
Best regards,
--
Jonas Rebmann <jre@xxxxxxxxxxxxxx>