Skip to content

Commit 113f36f

Browse files
BoergeStbroonie
authored andcommitted
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>
1 parent 5cc223c commit 113f36f

1 file changed

Lines changed: 48 additions & 42 deletions

File tree

tools/spi/spidev_test.c

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -172,55 +172,61 @@ static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
172172

173173
static void print_usage(const char *prog)
174174
{
175-
printf("Usage: %s [-DsbdlHOLC3vpNR24SI]\n", prog);
176-
puts(" -D --device device to use (default /dev/spidev1.1)\n"
177-
" -s --speed max speed (Hz)\n"
178-
" -d --delay delay (usec)\n"
179-
" -b --bpw bits per word\n"
180-
" -i --input input data from a file (e.g. \"test.bin\")\n"
181-
" -o --output output data to a file (e.g. \"results.bin\")\n"
182-
" -l --loop loopback\n"
183-
" -H --cpha clock phase\n"
184-
" -O --cpol clock polarity\n"
185-
" -L --lsb least significant bit first\n"
186-
" -C --cs-high chip select active high\n"
187-
" -3 --3wire SI/SO signals shared\n"
188-
" -v --verbose Verbose (show tx buffer)\n"
189-
" -p Send data (e.g. \"1234\\xde\\xad\")\n"
190-
" -N --no-cs no chip select\n"
191-
" -R --ready slave pulls low to pause\n"
192-
" -2 --dual dual transfer\n"
193-
" -4 --quad quad transfer\n"
194-
" -8 --octal octal transfer\n"
195-
" -S --size transfer size\n"
196-
" -I --iter iterations\n");
175+
printf("Usage: %s [-2348CDHILNORSbdilopsv]\n", prog);
176+
puts("general device settings:\n"
177+
" -D --device device to use (default /dev/spidev1.1)\n"
178+
" -s --speed max speed (Hz)\n"
179+
" -d --delay delay (usec)\n"
180+
" -l --loop loopback\n"
181+
"spi mode:\n"
182+
" -H --cpha clock phase\n"
183+
" -O --cpol clock polarity\n"
184+
"number of wires for transmission:\n"
185+
" -2 --dual dual transfer\n"
186+
" -4 --quad quad transfer\n"
187+
" -8 --octal octal transfer\n"
188+
" -3 --3wire SI/SO signals shared\n"
189+
"data:\n"
190+
" -i --input input data from a file (e.g. \"test.bin\")\n"
191+
" -o --output output data to a file (e.g. \"results.bin\")\n"
192+
" -p Send data (e.g. \"1234\\xde\\xad\")\n"
193+
" -S --size transfer size\n"
194+
" -I --iter iterations\n"
195+
"additional parameters:\n"
196+
" -b --bpw bits per word\n"
197+
" -L --lsb least significant bit first\n"
198+
" -C --cs-high chip select active high\n"
199+
" -N --no-cs no chip select\n"
200+
" -R --ready slave pulls low to pause\n"
201+
"misc:\n"
202+
" -v --verbose Verbose (show tx buffer)\n");
197203
exit(1);
198204
}
199205

200206
static void parse_opts(int argc, char *argv[])
201207
{
202208
while (1) {
203209
static const struct option lopts[] = {
204-
{ "device", 1, 0, 'D' },
205-
{ "speed", 1, 0, 's' },
206-
{ "delay", 1, 0, 'd' },
207-
{ "bpw", 1, 0, 'b' },
208-
{ "input", 1, 0, 'i' },
209-
{ "output", 1, 0, 'o' },
210-
{ "loop", 0, 0, 'l' },
211-
{ "cpha", 0, 0, 'H' },
212-
{ "cpol", 0, 0, 'O' },
213-
{ "lsb", 0, 0, 'L' },
214-
{ "cs-high", 0, 0, 'C' },
215-
{ "3wire", 0, 0, '3' },
216-
{ "no-cs", 0, 0, 'N' },
217-
{ "ready", 0, 0, 'R' },
218-
{ "dual", 0, 0, '2' },
219-
{ "verbose", 0, 0, 'v' },
220-
{ "quad", 0, 0, '4' },
221-
{ "octal", 0, 0, '8' },
222-
{ "size", 1, 0, 'S' },
223-
{ "iter", 1, 0, 'I' },
210+
{ "device", 1, 0, 'D' },
211+
{ "speed", 1, 0, 's' },
212+
{ "delay", 1, 0, 'd' },
213+
{ "loop", 0, 0, 'l' },
214+
{ "cpha", 0, 0, 'H' },
215+
{ "cpol", 0, 0, 'O' },
216+
{ "dual", 0, 0, '2' },
217+
{ "quad", 0, 0, '4' },
218+
{ "octal", 0, 0, '8' },
219+
{ "3wire", 0, 0, '3' },
220+
{ "input", 1, 0, 'i' },
221+
{ "output", 1, 0, 'o' },
222+
{ "size", 1, 0, 'S' },
223+
{ "iter", 1, 0, 'I' },
224+
{ "bpw", 1, 0, 'b' },
225+
{ "lsb", 0, 0, 'L' },
226+
{ "cs-high", 0, 0, 'C' },
227+
{ "no-cs", 0, 0, 'N' },
228+
{ "ready", 0, 0, 'R' },
229+
{ "verbose", 0, 0, 'v' },
224230
{ NULL, 0, 0, 0 },
225231
};
226232
int c;

0 commit comments

Comments
 (0)