mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-04 22:09:57 +02:00
isotpsniffer: simplify option for CAN FD link layer
As the tx_dl and flags struct elements are not relevant for listen-only sockets, simplify the CAN FD command line option switch. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
+6
-11
@@ -77,8 +77,8 @@ void print_usage(char *prg)
|
|||||||
fprintf(stderr, " -c (color mode)\n");
|
fprintf(stderr, " -c (color mode)\n");
|
||||||
fprintf(stderr, " -t <type> (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n");
|
fprintf(stderr, " -t <type> (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n");
|
||||||
fprintf(stderr, " -f <format> (1 = HEX, 2 = ASCII, 3 = HEX & ASCII - default: %d)\n", FORMAT_DEFAULT);
|
fprintf(stderr, " -f <format> (1 = HEX, 2 = ASCII, 3 = HEX & ASCII - default: %d)\n", FORMAT_DEFAULT);
|
||||||
fprintf(stderr, " -L <mtu>:<tx_dl>:<tx_flags> (link layer options for CAN FD)\n");
|
fprintf(stderr, " -L (set link layer options for CAN FD)\n");
|
||||||
fprintf(stderr, " -h <len> (head: print only first <len> bytes)\n");
|
fprintf(stderr, " -h <len> (head: print only first <len> bytes)\n");
|
||||||
fprintf(stderr, "\nCAN IDs and addresses are given and expected in hexadecimal values.\n");
|
fprintf(stderr, "\nCAN IDs and addresses are given and expected in hexadecimal values.\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ int main(int argc, char **argv)
|
|||||||
unsigned char buffer[4096];
|
unsigned char buffer[4096];
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "s:d:x:X:h:ct:f:L:?")) != -1) {
|
while ((opt = getopt(argc, argv, "s:d:x:X:h:ct:f:L?")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 's':
|
case 's':
|
||||||
src = strtoul(optarg, NULL, 16);
|
src = strtoul(optarg, NULL, 16);
|
||||||
@@ -226,14 +226,9 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
if (sscanf(optarg, "%hhu:%hhu:%hhu",
|
llopts.mtu = CANFD_MTU;
|
||||||
&llopts.mtu,
|
llopts.tx_dl = CANFD_MAX_DLEN;
|
||||||
&llopts.tx_dl,
|
llopts.tx_flags = CANFD_BRS;
|
||||||
&llopts.tx_flags) != 3) {
|
|
||||||
printf("unknown link layer options '%s'.\n", optarg);
|
|
||||||
print_usage(basename(argv[0]));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|||||||
Reference in New Issue
Block a user