From b740fb7fab97a6dfba330e54390adfc5393c1833 Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 01/29] asc2log.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0001-asc2log.c-Reformat-help-usage-output-to-be-compatibl.patch --- asc2log.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/asc2log.c b/asc2log.c index 59f2f98..cecaa9f 100644 --- a/asc2log.c +++ b/asc2log.c @@ -61,9 +61,11 @@ extern int optind, opterr, optopt; void print_usage(char *prg) { + fprintf(stderr, "%s - convert ASC logfile to compact CAN frame logfile.\n", prg); fprintf(stderr, "Usage: %s\n", prg); - fprintf(stderr, "Options: -I (default stdin)\n"); - fprintf(stderr, " -O (default stdout)\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, "\t-I \t(default stdin)\n"); + fprintf(stderr, "\t-O \t(default stdout)\n"); } void prframe(FILE *file, struct timeval *tv, int dev, struct can_frame *cf) { From 69865c824719e050db27189fcbf73128af222cd6 Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 02/29] canbusload.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0002-canbusload.c-Reformat-help-usage-output-to-be-compat.patch --- canbusload.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/canbusload.c b/canbusload.c index f5f130b..b002b66 100644 --- a/canbusload.c +++ b/canbusload.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ /* - * canbusload.c + * canbusload.c - monitor CAN bus load * * Copyright (c) 2002-2008 Volkswagen Group Electronic Research * All rights reserved. @@ -91,14 +91,16 @@ static char *prg; void print_usage(char *prg) { + fprintf(stderr, "%s - monitor CAN bus load.\n", prg); fprintf(stderr, "\nUsage: %s [options] +\n", prg); fprintf(stderr, " (use CTRL-C to terminate %s)\n\n", prg); - fprintf(stderr, "Options: -t (show current time on the first line)\n"); - fprintf(stderr, " -c (colorize lines)\n"); - fprintf(stderr, " -b (show bargraph in %d%% resolution)\n", PERCENTRES); - fprintf(stderr, " -r (redraw the terminal - similar to top)\n"); - fprintf(stderr, " -i (ignore bitstuffing in bandwidth calculation)\n"); - fprintf(stderr, " -e (exact calculation of stuffed bits)\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -t (show current time on the first line)\n"); + fprintf(stderr, " -c (colorize lines)\n"); + fprintf(stderr, " -b (show bargraph in %d%% resolution)\n", PERCENTRES); + fprintf(stderr, " -r (redraw the terminal - similar to top)\n"); + fprintf(stderr, " -i (ignore bitstuffing in bandwidth calculation)\n"); + fprintf(stderr, " -e (exact calculation of stuffed bits)\n"); fprintf(stderr, "\n"); fprintf(stderr, "Up to %d CAN interfaces with mandatory bitrate can be specified on the \n", MAXSOCK); fprintf(stderr, "commandline in the form: @\n\n"); @@ -107,7 +109,7 @@ void print_usage(char *prg) fprintf(stderr, "Due to the bitstuffing estimation the calculated busload may exceed 100%%.\n"); fprintf(stderr, "For each given interface the data is presented in one line which contains:\n\n"); fprintf(stderr, "(interface) (received CAN frames) (used bits total) (used bits for payload)\n"); - fprintf(stderr, "\nExample:\n"); + fprintf(stderr, "\nExamples:\n"); fprintf(stderr, "\nuser$> canbusload can0@100000 can1@500000 can2@500000 can3@500000 -r -t -b -c\n\n"); fprintf(stderr, "%s 2014-02-01 21:13:16 (worst case bitstuffing)\n", prg); fprintf(stderr, " can0@100000 805 74491 36656 74%% |XXXXXXXXXXXXXX......|\n"); From f4a9e5b57deff103787bb050d8f34ad7bc594205 Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 03/29] can-calc-bit-timing.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0003-can-calc-bit-timing.c-Reformat-help-usage-output-to-.patch --- can-calc-bit-timing.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/can-calc-bit-timing.c b/can-calc-bit-timing.c index abbc4ca..49347f8 100644 --- a/can-calc-bit-timing.c +++ b/can-calc-bit-timing.c @@ -131,17 +131,16 @@ static inline void *netdev_priv(const struct net_device *dev) static void print_usage(char *cmd) { + printf("%s - calculate CAN bit timing parameters.\n", cmd); printf("Usage: %s [options] []\n" - "\tOptions:\n" - "\t-q : don't print header line\n" - "\t-l : list all support CAN controller names\n" - "\t-b : bit-rate in bits/sec\n" - "\t-s : sample-point in one-tenth of a percent\n" + "Options:\n" + "\t-q don't print header line\n" + "\t-l list all support CAN controller names\n" + "\t-b bit-rate in bits/sec\n" + "\t-s sample-point in one-tenth of a percent\n" "\t or 0 for CIA recommended sample points\n" - "\t-c : real CAN system clock in Hz\n", + "\t-c real CAN system clock in Hz\n", cmd); - - exit(EXIT_FAILURE); } static void printf_btr_sja1000(struct can_bittiming *bt, bool hdr) @@ -638,7 +637,7 @@ int main(int argc, char *argv[]) const struct calc_bittiming_const *btc; - while ((opt = getopt(argc, argv, "b:c:lqs:")) != -1) { + while ((opt = getopt(argc, argv, "b:c:lqs:?")) != -1) { switch (opt) { case 'b': bitrate_nominal = atoi(optarg); @@ -660,14 +659,22 @@ int main(int argc, char *argv[]) spt_nominal = strtoul(optarg, NULL, 10); break; + case '?': + print_usage(argv[0]); + exit(EXIT_SUCCESS); + break; + default: print_usage(argv[0]); + exit(EXIT_FAILURE); break; } } - if (argc > optind + 1) + if (argc > optind + 1) { print_usage(argv[0]); + exit(EXIT_FAILURE); + } if (argc == optind + 1) name = argv[optind]; @@ -677,8 +684,10 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); } - if (spt_nominal && (spt_nominal >= 1000 || spt_nominal < 100)) + if (spt_nominal && (spt_nominal >= 1000 || spt_nominal < 100)) { print_usage(argv[0]); + exit(EXIT_FAILURE); + } for (i = 0; i < ARRAY_SIZE(can_calc_consts); i++) { if (name && strcmp(can_calc_consts[i].bittiming_const.name, name)) From 6db632531dc37522c35a6325802f2a9219655910 Mon Sep 17 00:00:00 2001 From: Alexander GQ Gerasiov Date: Sat, 11 Apr 2020 13:46:56 +0300 Subject: [PATCH 04/29] candump.c: Reformat help/usage output to be compatible with help2man. Gbp-Pq: Name 0004-candump.c-Reformat-help-usage-output-to-be-compatibl.patch --- candump.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/candump.c b/candump.c index 16382d1..4fcffef 100644 --- a/candump.c +++ b/candump.c @@ -116,9 +116,11 @@ static volatile int running = 1; void print_usage(char *prg) { + fprintf(stderr, "%s - dump CAN bus traffic.\n", prg); fprintf(stderr, "\nUsage: %s [options] +\n", prg); fprintf(stderr, " (use CTRL-C to terminate %s)\n\n", prg); - fprintf(stderr, "Options: -t (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -t (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n"); fprintf(stderr, " -H (read hardware timestamps instead of system timestamps)\n"); fprintf(stderr, " -c (increment color mode level)\n"); fprintf(stderr, " -i (binary output - may exceed 80 chars/line)\n"); @@ -137,22 +139,23 @@ void print_usage(char *prg) fprintf(stderr, "\n"); fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK); fprintf(stderr, "on the commandline in the form: [,filter]*\n"); - fprintf(stderr, "\nComma separated filters can be specified for each given CAN interface:\n"); - fprintf(stderr, " : (matches when & mask == can_id & mask)\n"); - fprintf(stderr, " ~ (matches when & mask != can_id & mask)\n"); - fprintf(stderr, " # (set error frame filter, see include/linux/can/error.h)\n"); - fprintf(stderr, " [j|J] (join the given CAN filters - logical AND semantic)\n"); + fprintf(stderr, "\nFilters:\n"); + fprintf(stderr, " Comma separated filters can be specified for each given CAN interface:\n"); + fprintf(stderr, ":\n\t(matches when & mask == can_id & mask)\n"); + fprintf(stderr, "~\n\t(matches when & mask != can_id & mask)\n"); + fprintf(stderr, "#\n\t(set error frame filter, see include/linux/can/error.h)\n"); + fprintf(stderr, "[j|J]\n\t(join the given CAN filters - logical AND semantic)\n"); fprintf(stderr, "\nCAN IDs, masks and data content are given and expected in hexadecimal values.\n"); fprintf(stderr, "When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format.\n"); fprintf(stderr, "Without any given filter all data frames are received ('0:0' default filter).\n"); fprintf(stderr, "\nUse interface name '%s' to receive from all CAN interfaces.\n", ANYDEV); fprintf(stderr, "\nExamples:\n"); - fprintf(stderr, "%s -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8\n", prg); - fprintf(stderr, "%s -l any,0~0,#FFFFFFFF (log only error frames but no(!) data frames)\n", prg); - fprintf(stderr, "%s -l any,0:0,#FFFFFFFF (log error frames and also all data frames)\n", prg); - fprintf(stderr, "%s vcan2,12345678:DFFFFFFF (match only for extended CAN ID 12345678)\n", prg); - fprintf(stderr, "%s vcan2,123:7FF (matches CAN ID 123 - including EFF and RTR frames)\n", prg); - fprintf(stderr, "%s vcan2,123:C00007FF (matches CAN ID 123 - only SFF and non-RTR frames)\n", prg); + fprintf(stderr, "%s -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8\n\n", prg); + fprintf(stderr, "%s -l any,0~0,#FFFFFFFF\n\t(log only error frames but no(!) data frames)\n", prg); + fprintf(stderr, "%s -l any,0:0,#FFFFFFFF\n\t(log error frames and also all data frames)\n", prg); + fprintf(stderr, "%s vcan2,12345678:DFFFFFFF\n\t(match only for extended CAN ID 12345678)\n", prg); + fprintf(stderr, "%s vcan2,123:7FF\n\t(matches CAN ID 123 - including EFF and RTR frames)\n", prg); + fprintf(stderr, "%s vcan2,123:C00007FF\n\t(matches CAN ID 123 - only SFF and non-RTR frames)\n", prg); fprintf(stderr, "\n"); } From c56259ab33a16f30f5721cc7d19b21f0784f437a Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 05/29] canfdtest.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0005-canfdtest.c-Reformat-help-usage-output-to-be-compati.patch --- canfdtest.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/canfdtest.c b/canfdtest.c index cf59a3a..a4b98f5 100644 --- a/canfdtest.c +++ b/canfdtest.c @@ -52,9 +52,11 @@ static int exit_sig; static void print_usage(char *prg) { fprintf(stderr, + "%s - Full-duplex test program (DUT and host part).\n" "Usage: %s [options] \n" "\n" - "Options: -v (low verbosity)\n" + "Options:\n" + " -v (low verbosity)\n" " -vv (high verbosity)\n" " -g (generate messages)\n" " -l COUNT (test loop count)\n" @@ -64,10 +66,12 @@ static void print_usage(char *prg) " are sent back incrementing the CAN id and\n" "all data bytes. The program can be aborted with ^C.\n" "\n" - "Example:\n" - "\ton DUT : %s -v can0\n" - "\ton Host: %s -g -v can2\n", - prg, prg, prg); + "Examples:\n" + "\ton DUT:\n" + "%s -v can0\n" + "\ton Host:\n" + "%s -g -v can2\n", + prg, prg, prg, prg); exit(1); } @@ -320,7 +324,7 @@ int main(int argc, char *argv[]) signal(SIGHUP, signal_handler); signal(SIGINT, signal_handler); - while ((opt = getopt(argc, argv, "gl:v")) != -1) { + while ((opt = getopt(argc, argv, "gl:v?")) != -1) { switch (opt) { case 'v': verbose++; @@ -334,6 +338,7 @@ int main(int argc, char *argv[]) echo_gen = 1; break; + case '?': default: print_usage(basename(argv[0])); break; From f503097a3861bd7be94b8b9a0a536ec1827813be Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 06/29] cangen.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0006-cangen.c-Reformat-help-usage-output-to-be-compatible.patch --- cangen.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cangen.c b/cangen.c index 9a1914b..9675b8a 100644 --- a/cangen.c +++ b/cangen.c @@ -78,9 +78,11 @@ static unsigned long long enobufs_count; void print_usage(char *prg) { + fprintf(stderr, "%s - CAN frames generator for testing purposes.\n", prg); fprintf(stderr, "\n%s: generate CAN frames\n\n", prg); fprintf(stderr, "Usage: %s [options] \n", prg); - fprintf(stderr, "Options: -g (gap in milli seconds " + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -g (gap in milli seconds " "- default: %d ms)\n", DEFAULT_GAP); fprintf(stderr, " -e (generate extended frame mode " "(EFF) CAN frames)\n"); @@ -106,25 +108,25 @@ void print_usage(char *prg) fprintf(stderr, " -v (increment verbose level for " "printing sent CAN frames)\n\n"); fprintf(stderr, "Generation modes:\n"); - fprintf(stderr, "'r' => random values (default)\n"); - fprintf(stderr, "'i' => increment values\n"); - fprintf(stderr, " => fix value using \n\n"); + fprintf(stderr, " 'r' => random values (default)\n"); + fprintf(stderr, " 'i' => increment values\n"); + fprintf(stderr, " => fix value using \n\n"); fprintf(stderr, "When incrementing the CAN data the data length code " "minimum is set to 1.\n"); fprintf(stderr, "CAN IDs and data content are given and expected in hexadecimal values.\n\n"); fprintf(stderr, "Examples:\n"); - fprintf(stderr, "%s vcan0 -g 4 -I 42A -L 1 -D i -v -v ", prg); - fprintf(stderr, "(fixed CAN ID and length, inc. data)\n"); - fprintf(stderr, "%s vcan0 -e -L i -v -v -v ", prg); - fprintf(stderr, "(generate EFF frames, incr. length)\n"); - fprintf(stderr, "%s vcan0 -D 11223344DEADBEEF -L 8 ", prg); - fprintf(stderr, "(fixed CAN data payload and length)\n"); - fprintf(stderr, "%s vcan0 -g 0 -i -x ", prg); - fprintf(stderr, "(full load test ignoring -ENOBUFS)\n"); - fprintf(stderr, "%s vcan0 -g 0 -p 10 -x ", prg); - fprintf(stderr, "(full load test with polling, 10ms timeout)\n"); - fprintf(stderr, "%s vcan0 ", prg); - fprintf(stderr, "(my favourite default :)\n\n"); + fprintf(stderr, "%s vcan0 -g 4 -I 42A -L 1 -D i -v -v\n", prg); + fprintf(stderr, "\t(fixed CAN ID and length, inc. data)\n"); + fprintf(stderr, "%s vcan0 -e -L i -v -v -v\n", prg); + fprintf(stderr, "\t(generate EFF frames, incr. length)\n"); + fprintf(stderr, "%s vcan0 -D 11223344DEADBEEF -L 8\n", prg); + fprintf(stderr, "\t(fixed CAN data payload and length)\n"); + fprintf(stderr, "%s vcan0 -g 0 -i -x\n", prg); + fprintf(stderr, "\t(full load test ignoring -ENOBUFS)\n"); + fprintf(stderr, "%s vcan0 -g 0 -p 10 -x\n", prg); + fprintf(stderr, "\t(full load test with polling, 10ms timeout)\n"); + fprintf(stderr, "%s vcan0\n", prg); + fprintf(stderr, "\t(my favourite default :)\n\n"); } void sigterm(int signo) From 1127609357701ab7c5e14ed9128a861595a24fb9 Mon Sep 17 00:00:00 2001 From: Alexander GQ Gerasiov Date: Sat, 11 Apr 2020 13:46:56 +0300 Subject: [PATCH 07/29] cangw.c: Reformat help/usage output to be compatible with help2man. Gbp-Pq: Name 0007-cangw.c-Reformat-help-usage-output-to-be-compatible-.patch --- cangw.c | 79 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/cangw.c b/cangw.c index 52314f6..a6b1697 100644 --- a/cangw.c +++ b/cangw.c @@ -222,55 +222,60 @@ void print_cs_crc8(struct cgw_csum_crc8 *cs_crc8) void print_usage(char *prg) { + fprintf(stderr, "%s - manage PF_CAN netlink gateway.\n", prg); fprintf(stderr, "\nUsage: %s [options]\n\n", prg); - fprintf(stderr, "Commands: -A (add a new rule)\n"); - fprintf(stderr, " -D (delete a rule)\n"); - fprintf(stderr, " -F (flush / delete all rules)\n"); - fprintf(stderr, " -L (list all rules)\n"); - fprintf(stderr, "Mandatory: -s (source netdevice)\n"); + fprintf(stderr, "Commands:\n"); + fprintf(stderr, " -A (add a new rule)\n"); + fprintf(stderr, " -D (delete a rule)\n"); + fprintf(stderr, " -F (flush / delete all rules)\n"); + fprintf(stderr, " -L (list all rules)\n"); + fprintf(stderr, "Mandatory:\n"); + fprintf(stderr, " -s (source netdevice)\n"); fprintf(stderr, " -d (destination netdevice)\n"); - fprintf(stderr, "Options: -X (this is a CAN FD rule)\n"); - fprintf(stderr, " -t (preserve src_dev rx timestamp)\n"); - fprintf(stderr, " -e (echo sent frames - recommended on vcanx)\n"); - fprintf(stderr, " -i (allow to route to incoming interface)\n"); - fprintf(stderr, " -u (user defined modification identifier)\n"); - fprintf(stderr, " -l (limit the number of frame hops / routings)\n"); - fprintf(stderr, " -f (set CAN filter)\n"); - fprintf(stderr, " -m (set Classic CAN frame modifications)\n"); - fprintf(stderr, " -M (set CAN FD frame modifications)\n"); - fprintf(stderr, " -x ::: (XOR checksum)\n"); - fprintf(stderr, " -c ::::: (CRC8 cs)\n"); - fprintf(stderr, " -p :[] (CRC8 checksum profile & parameters)\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -X (this is a CAN FD rule)\n"); + fprintf(stderr, " -t (preserve src_dev rx timestamp)\n"); + fprintf(stderr, " -e (echo sent frames - recommended on vcanx)\n"); + fprintf(stderr, " -i (allow to route to incoming interface)\n"); + fprintf(stderr, " -u (user defined modification identifier)\n"); + fprintf(stderr, " -l (limit the number of frame hops / routings)\n"); + fprintf(stderr, " -f (set CAN filter)\n"); + fprintf(stderr, " -m (set Classic CAN frame modifications)\n"); + fprintf(stderr, " -M (set CAN FD frame modifications)\n"); + fprintf(stderr, " -x ::: (XOR checksum)\n"); + fprintf(stderr, " -c ::::: (CRC8 cs)\n"); + fprintf(stderr, " -p :[] (CRC8 checksum profile & parameters)\n"); fprintf(stderr, "\nValues are given and expected in hexadecimal values. Leading 0s can be omitted.\n"); fprintf(stderr, "\n"); - fprintf(stderr, " is a CAN identifier filter\n"); - fprintf(stderr, " : (matches when & mask == can_id & mask)\n"); - fprintf(stderr, " ~ (matches when & mask != can_id & mask)\n"); + fprintf(stderr, " is a CAN identifier filter:\n"); + fprintf(stderr, " :\t(matches when & mask == can_id & mask)\n"); + fprintf(stderr, " ~\t(matches when & mask != can_id & mask)\n"); fprintf(stderr, "\n"); fprintf(stderr, " is a CAN frame modification instruction consisting of\n"); fprintf(stderr, "::..\n"); - fprintf(stderr, " - is one of 'AND' 'OR' 'XOR' 'SET'\n"); - fprintf(stderr, " - is _one_ or _more_ of 'I'dentifier 'L'ength 'D'ata\n"); - fprintf(stderr, " - is an u32 value containing the CAN Identifier\n"); - fprintf(stderr, " - is an u8 value containing the data length code (0 .. 8)\n"); - fprintf(stderr, " - is always eight(!) u8 values containing the CAN frames data\n"); + fprintf(stderr, " is one of 'AND' 'OR' 'XOR' 'SET'\n"); + fprintf(stderr, " is _one_ or _more_ of 'I'dentifier 'L'ength 'D'ata\n"); + fprintf(stderr, " is an u32 value containing the CAN Identifier\n"); + fprintf(stderr, " is an u8 value containing the data length code (0 .. 8)\n"); + fprintf(stderr, " is always eight(!) u8 values containing the CAN frames data\n"); + fprintf(stderr, "\n"); fprintf(stderr, " is a CAN FD frame modification instruction consisting of\n"); fprintf(stderr, "::...\n"); - fprintf(stderr, " - is one of 'AND' 'OR' 'XOR' 'SET'\n"); - fprintf(stderr, " - is _one_ or _more_ of 'I'd 'F'lags 'L'ength 'D'ata\n"); - fprintf(stderr, " - is an u32 value containing the CAN FD Identifier\n"); - fprintf(stderr, " - is an u8 value containing CAN FD flags (CANFD_BRS, CANFD_ESI)\n"); - fprintf(stderr, " - is an u8 value containing the data length (0 .. 64)\n"); - fprintf(stderr, " - is always 64(!) u8 values containing the CAN FD frames data\n"); + fprintf(stderr, " is one of 'AND' 'OR' 'XOR' 'SET'\n"); + fprintf(stderr, " is _one_ or _more_ of 'I'd 'F'lags 'L'ength 'D'ata\n"); + fprintf(stderr, " is an u32 value containing the CAN FD Identifier\n"); + fprintf(stderr, " is an u8 value containing CAN FD flags (CANFD_BRS, CANFD_ESI)\n"); + fprintf(stderr, " is an u8 value containing the data length (0 .. 64)\n"); + fprintf(stderr, " is always 64(!) u8 values containing the CAN FD frames data\n"); fprintf(stderr, "The max. four modifications are performed in the order AND -> OR -> XOR -> SET\n"); fprintf(stderr, "\n"); - fprintf(stderr, "Example:\n"); - fprintf(stderr, "%s -A -s can0 -d vcan3 -e -f 123:C00007FF -m SET:IL:333.4.1122334455667788\n", prg); - fprintf(stderr, "\n"); fprintf(stderr, "Supported CRC 8 profiles:\n"); - fprintf(stderr, "Profile '%d' (1U8) - add one additional u8 value\n", CGW_CRC8PRF_1U8); - fprintf(stderr, "Profile '%d' (16U8) - add u8 value from table[16] indexed by (data[1] & 0xF)\n", CGW_CRC8PRF_16U8); - fprintf(stderr, "Profile '%d' (SFFID_XOR) - add u8 value (can_id & 0xFF) ^ (can_id >> 8 & 0xFF)\n", CGW_CRC8PRF_SFFID_XOR); + fprintf(stderr, " Profile '%d' (1U8) - add one additional u8 value\n", CGW_CRC8PRF_1U8); + fprintf(stderr, " Profile '%d' (16U8) - add u8 value from table[16] indexed by (data[1] & 0xF)\n", CGW_CRC8PRF_16U8); + fprintf(stderr, " Profile '%d' (SFFID_XOR) - add u8 value (can_id & 0xFF) ^ (can_id >> 8 & 0xFF)\n", CGW_CRC8PRF_SFFID_XOR); + fprintf(stderr, "\n"); + fprintf(stderr, "Examples:\n"); + fprintf(stderr, "%s -A -s can0 -d vcan3 -e -f 123:C00007FF -m SET:IL:333.4.1122334455667788\n", prg); fprintf(stderr, "\n"); } From 65399166c1d6a74354b47e12d08901aef2c219bd Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 08/29] canlogserver.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0008-canlogserver.c-Reformat-help-usage-output-to-be-comp.patch --- canlogserver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/canlogserver.c b/canlogserver.c index 4429ccd..8319684 100644 --- a/canlogserver.c +++ b/canlogserver.c @@ -89,7 +89,8 @@ void print_usage(char *prg) { fprintf(stderr, "\nUsage: %s [options] +\n", prg); fprintf(stderr, " (use CTRL-C to terminate %s)\n\n", prg); - fprintf(stderr, "Options: -m (ID filter mask. Default 0x00000000) *\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -m (ID filter mask. Default 0x00000000) *\n"); fprintf(stderr, " -v (ID filter value. Default 0x00000000) *\n"); fprintf(stderr, " -i <0|1> (invert the specified ID filter) *\n"); fprintf(stderr, " -e (mask for error frames)\n"); From 3e2c1d3cbd1fc6b7affb90bea8ec73a37a589dea Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 09/29] canplayer.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0009-canplayer.c-Reformat-help-usage-output-to-be-compati.patch --- canplayer.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/canplayer.c b/canplayer.c index 7932f7a..8f84f13 100644 --- a/canplayer.c +++ b/canplayer.c @@ -77,8 +77,10 @@ extern int optind, opterr, optopt; void print_usage(char *prg) { + fprintf(stderr, "%s - replay a compact CAN frame logfile to CAN devices.\n", prg); fprintf(stderr, "\nUsage: %s [interface assignment]*\n\n", prg); - fprintf(stderr, "Options: -I (default stdin)\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -I (default stdin)\n"); fprintf(stderr, " -l " "(process input file times)\n" " " @@ -93,13 +95,13 @@ void print_usage(char *prg) "loopback of sent CAN frames)\n"); fprintf(stderr, " -v (verbose: print " "sent CAN frames)\n\n"); - fprintf(stderr, "Interface assignment: 0..n assignments like " - "=\n"); - fprintf(stderr, "e.g. vcan2=can0 ( send frames received from can0 on " - "vcan2 )\n"); - fprintf(stderr, "extra hook: stdout=can0 ( print logfile line marked with can0 on " - "stdout )\n"); - fprintf(stderr, "No assignments => send frames to the interface(s) they " + fprintf(stderr, "Interface assignment:\n"); + fprintf(stderr, " 0..n assignments like =\n\n"); + fprintf(stderr, " e.g. vcan2=can0 (send frames received from can0 on " + "vcan2)\n"); + fprintf(stderr, " extra hook: stdout=can0 (print logfile line marked with can0 on " + "stdout)\n"); + fprintf(stderr, " No assignments => send frames to the interface(s) they " "had been received from.\n\n"); fprintf(stderr, "Lines in the logfile not beginning with '(' (start of " "timestamp) are ignored.\n\n"); From 4568d4a180c09de87f5a77ae6aa6958505a0df2e Mon Sep 17 00:00:00 2001 From: Alexander Gerasiov Date: Sun, 11 Feb 2018 19:03:05 +0300 Subject: [PATCH 10/29] cansniffer.c: Reformat help/usage output to be compatible with help2man. Signed-off-by: Alexander Gerasiov Gbp-Pq: Name 0011-cansniffer.c-Reformat-help-usage-output-to-be-compat.patch --- cansniffer.c | 60 ++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/cansniffer.c b/cansniffer.c index 1a41b8a..b388235 100644 --- a/cansniffer.c +++ b/cansniffer.c @@ -134,26 +134,25 @@ void print_usage(char *prg) { const char manual [] = { "commands that can be entered at runtime:\n" - "\n" - "q - quit\n" - "b - toggle binary / HEX-ASCII output\n" - "B - toggle binary with gap / HEX-ASCII output (exceeds 80 chars!)\n" - "c - toggle color mode\n" - "# - notch currently marked/changed bits (can be used repeatedly)\n" - "* - clear notched marked\n" - "rMYNAME - read settings file (filter/notch)\n" - "wMYNAME - write settings file (filter/notch)\n" - "+FILTER - add CAN-IDs to sniff\n" - "-FILTER - remove CAN-IDs to sniff\n" + " q - quit\n" + " b - toggle binary / HEX-ASCII output\n" + " B - toggle binary with gap / HEX-ASCII output (exceeds 80 chars!)\n" + " c - toggle color mode\n" + " # - notch currently marked/changed bits (can be used repeatedly)\n" + " * - clear notched marked\n" + " rMYNAME - read settings file (filter/notch)\n" + " wMYNAME - write settings file (filter/notch)\n" + " +FILTER - add CAN-IDs to sniff\n" + " -FILTER - remove CAN-IDs to sniff\n" "\n" "FILTER can be a single CAN-ID or a CAN-ID/Bitmask:\n" - "+1F5 - add CAN-ID 0x1F5\n" - "-42E - remove CAN-ID 0x42E\n" - "-42E7FF - remove CAN-ID 0x42E (using Bitmask)\n" - "-500700 - remove CAN-IDs 0x500 - 0x5FF\n" - "+400600 - add CAN-IDs 0x400 - 0x5FF\n" - "+000000 - add all CAN-IDs\n" - "-000000 - remove all CAN-IDs\n" + " +1F5 - add CAN-ID 0x1F5\n" + " -42E - remove CAN-ID 0x42E\n" + " -42E7FF - remove CAN-ID 0x42E (using Bitmask)\n" + " -500700 - remove CAN-IDs 0x500 - 0x5FF\n" + " +400600 - add CAN-IDs 0x400 - 0x5FF\n" + " +000000 - add all CAN-IDs\n" + " -000000 - remove all CAN-IDs\n" "\n" "if (id & filter) == (sniff-id & filter) the action (+/-) is performed,\n" "which is quite easy when the filter is 000\n" @@ -161,18 +160,19 @@ void print_usage(char *prg) }; fprintf(stderr, "\nUsage: %s [can-interface]\n", prg); - fprintf(stderr, "Options: -m (initial FILTER default 0x00000000)\n"); - fprintf(stderr, " -v (initial FILTER default 0x00000000)\n"); - fprintf(stderr, " -q (quiet - all IDs deactivated)\n"); - fprintf(stderr, " -r (read %sname from file)\n", SETFNAME); - fprintf(stderr, " -b (start with binary mode)\n"); - fprintf(stderr, " -B (start with binary mode with gap - exceeds 80 chars!)\n"); - fprintf(stderr, " -c (color changes)\n"); - fprintf(stderr, " -f (filter on CAN-ID only)\n"); - fprintf(stderr, " -t