mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
spi: spidev_test: clarify usage for --size
By default, spidev_test transmits the predetermined message default_tx. Given the --size parameter, the given number of random bytes are transmitted instead. Make all the input options (random bytes, string, file) mutually exclusive. Clarify the help text for --size. While at it, make the -p help text consistently lowercase. Signed-off-by: Jonas Rebmann <jre@pengutronix.de> Link: https://patch.msgid.link/20260924-spi-sun4i-spidev_test-v7-2-126e31a07fdc@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
88ca7a587f
commit
a9e74a4c99
|
|
@ -44,6 +44,7 @@ static int verbose;
|
|||
static int transfer_size;
|
||||
static int iterations;
|
||||
static int interval = 5; /* interval in seconds for showing transfer rate */
|
||||
static int input_choices;
|
||||
|
||||
static uint8_t default_tx[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
|
@ -191,8 +192,8 @@ static void print_usage(const char *prog)
|
|||
"data:\n"
|
||||
" -i --input input data from a file (e.g. \"test.bin\")\n"
|
||||
" -o --output output data to a file (e.g. \"results.bin\")\n"
|
||||
" -p Send data (e.g. \"1234\\xde\\xad\")\n"
|
||||
" -S --size transfer size\n"
|
||||
" -p send data (e.g. \"1234\\xde\\xad\")\n"
|
||||
" -S --size transfer the given number of random bytes\n"
|
||||
" -I --iter iterations\n"
|
||||
"additional parameters:\n"
|
||||
" -b --bpw bits per word\n"
|
||||
|
|
@ -262,6 +263,7 @@ static void parse_opts(int argc, char *argv[])
|
|||
break;
|
||||
case 'i':
|
||||
input_file = optarg;
|
||||
input_choices++;
|
||||
break;
|
||||
case 'o':
|
||||
output_file = optarg;
|
||||
|
|
@ -304,6 +306,7 @@ static void parse_opts(int argc, char *argv[])
|
|||
break;
|
||||
case 'p':
|
||||
input_tx = optarg;
|
||||
input_choices++;
|
||||
break;
|
||||
case '2':
|
||||
mode |= SPI_TX_DUAL;
|
||||
|
|
@ -316,6 +319,7 @@ static void parse_opts(int argc, char *argv[])
|
|||
break;
|
||||
case 'S':
|
||||
transfer_size = atoi(optarg);
|
||||
input_choices++;
|
||||
break;
|
||||
case 'I':
|
||||
iterations = atoi(optarg);
|
||||
|
|
@ -446,8 +450,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
parse_opts(argc, argv);
|
||||
|
||||
if (input_tx && input_file)
|
||||
pabort("only one of -p and --input may be selected");
|
||||
if (input_choices > 1)
|
||||
pabort("at most one of -S (--size), -p, -i (--input) may be selected, "
|
||||
"and each may be specified only once");
|
||||
|
||||
fd = open(device, O_RDWR);
|
||||
if (fd < 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user