spi: spidev_test: Sorted the options into logical groups

In order to increase usability, the command line options are sorted into
logical groups. In addition, the usage string was sorted alphabetically,
and the missing parameters '8','i' and 'o' were added. Furthermore, the
option descriptions were moved further to the right, in order to allow
for longer option names.

Signed-off-by: Boerge Struempfel <boerge.struempfel@gmail.com>
Link: https://lore.kernel.org/r/20230530141641.1155691-5-boerge.struempfel@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Boerge Struempfel
2023-05-30 16:16:40 +02:00
committed by Mark Brown
parent 5cc223ca48
commit 113f36f2dc

View File

@@ -172,28 +172,34 @@ static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
static void print_usage(const char *prog) static void print_usage(const char *prog)
{ {
printf("Usage: %s [-DsbdlHOLC3vpNR24SI]\n", prog); printf("Usage: %s [-2348CDHILNORSbdilopsv]\n", prog);
puts(" -D --device device to use (default /dev/spidev1.1)\n" puts("general device settings:\n"
" -s --speed max speed (Hz)\n" " -D --device device to use (default /dev/spidev1.1)\n"
" -d --delay delay (usec)\n" " -s --speed max speed (Hz)\n"
" -b --bpw bits per word\n" " -d --delay delay (usec)\n"
" -i --input input data from a file (e.g. \"test.bin\")\n" " -l --loop loopback\n"
" -o --output output data to a file (e.g. \"results.bin\")\n" "spi mode:\n"
" -l --loop loopback\n" " -H --cpha clock phase\n"
" -H --cpha clock phase\n" " -O --cpol clock polarity\n"
" -O --cpol clock polarity\n" "number of wires for transmission:\n"
" -L --lsb least significant bit first\n" " -2 --dual dual transfer\n"
" -C --cs-high chip select active high\n" " -4 --quad quad transfer\n"
" -3 --3wire SI/SO signals shared\n" " -8 --octal octal transfer\n"
" -v --verbose Verbose (show tx buffer)\n" " -3 --3wire SI/SO signals shared\n"
" -p Send data (e.g. \"1234\\xde\\xad\")\n" "data:\n"
" -N --no-cs no chip select\n" " -i --input input data from a file (e.g. \"test.bin\")\n"
" -R --ready slave pulls low to pause\n" " -o --output output data to a file (e.g. \"results.bin\")\n"
" -2 --dual dual transfer\n" " -p Send data (e.g. \"1234\\xde\\xad\")\n"
" -4 --quad quad transfer\n" " -S --size transfer size\n"
" -8 --octal octal transfer\n" " -I --iter iterations\n"
" -S --size transfer size\n" "additional parameters:\n"
" -I --iter iterations\n"); " -b --bpw bits per word\n"
" -L --lsb least significant bit first\n"
" -C --cs-high chip select active high\n"
" -N --no-cs no chip select\n"
" -R --ready slave pulls low to pause\n"
"misc:\n"
" -v --verbose Verbose (show tx buffer)\n");
exit(1); exit(1);
} }
@@ -201,26 +207,26 @@ static void parse_opts(int argc, char *argv[])
{ {
while (1) { while (1) {
static const struct option lopts[] = { static const struct option lopts[] = {
{ "device", 1, 0, 'D' }, { "device", 1, 0, 'D' },
{ "speed", 1, 0, 's' }, { "speed", 1, 0, 's' },
{ "delay", 1, 0, 'd' }, { "delay", 1, 0, 'd' },
{ "bpw", 1, 0, 'b' }, { "loop", 0, 0, 'l' },
{ "input", 1, 0, 'i' }, { "cpha", 0, 0, 'H' },
{ "output", 1, 0, 'o' }, { "cpol", 0, 0, 'O' },
{ "loop", 0, 0, 'l' }, { "dual", 0, 0, '2' },
{ "cpha", 0, 0, 'H' }, { "quad", 0, 0, '4' },
{ "cpol", 0, 0, 'O' }, { "octal", 0, 0, '8' },
{ "lsb", 0, 0, 'L' }, { "3wire", 0, 0, '3' },
{ "cs-high", 0, 0, 'C' }, { "input", 1, 0, 'i' },
{ "3wire", 0, 0, '3' }, { "output", 1, 0, 'o' },
{ "no-cs", 0, 0, 'N' }, { "size", 1, 0, 'S' },
{ "ready", 0, 0, 'R' }, { "iter", 1, 0, 'I' },
{ "dual", 0, 0, '2' }, { "bpw", 1, 0, 'b' },
{ "verbose", 0, 0, 'v' }, { "lsb", 0, 0, 'L' },
{ "quad", 0, 0, '4' }, { "cs-high", 0, 0, 'C' },
{ "octal", 0, 0, '8' }, { "no-cs", 0, 0, 'N' },
{ "size", 1, 0, 'S' }, { "ready", 0, 0, 'R' },
{ "iter", 1, 0, 'I' }, { "verbose", 0, 0, 'v' },
{ NULL, 0, 0, 0 }, { NULL, 0, 0, 0 },
}; };
int c; int c;