Commit Graph

1012 Commits (ceda93bd5c56927c72d48dcaa30e17d6ecea86b8)

Author SHA1 Message Date
Marc Kleine-Budde 085b5546a5 cangen: main(): avoid loop initial declaration
| cangen.c: In function ‘parse_dataoptarg’:
| cangen.c:422:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
|   for (int i = 0; i < CANFD_MAX_DLEN && i < arglen / 2; i++) {
|   ^
| cangen.c:422:2: note: use option -std=c99 or -std=gnu99 to compile your code
| cangen.c: In function ‘main’:
| cangen.c:796:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
|     for (int i = 0; i < frame.len; i++) {
|     ^

Reported-by: https://github.com/yannS2016
Link: https://github.com/linux-can/can-utils/issues/428
Fixes: e409aa4c8c ("cangen: new generation mode - partially randomized payload (-D)")
2023-04-30 21:01:19 +02:00
Marc Kleine-Budde 28a9a6c42f
Merge pull request #429 from marckleinebudde/cangen-fix
cangen: parse_dataoptarg(): avoid loop initial declaration
2023-04-30 20:12:45 +02:00
Marc Kleine-Budde 3c9fd96881 cangen: parse_dataoptarg(): avoid loop initial declaration
| cangen.c: In function ‘parse_dataoptarg’:
| cangen.c:422:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
|   for (int i = 0; i < CANFD_MAX_DLEN && i < arglen / 2; i++) {
|   ^
| cangen.c:422:2: note: use option -std=c99 or -std=gnu99 to compile your code
| cangen.c: In function ‘main’:
| cangen.c:796:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
|     for (int i = 0; i < frame.len; i++) {
|     ^

Reported-by: https://github.com/yannS2016
Link: https://github.com/linux-can/can-utils/issues/428
Fixes: e409aa4c8c ("cangen: new generation mode - partially randomized payload (-D)")
2023-04-30 20:07:24 +02:00
Marc Kleine-Budde c8fef7d60d
Merge pull request #416 from yashi/exit-status-when-signaled
Exit status when signaled
2023-03-22 16:37:40 +01:00
Marc Kleine-Budde dc04751cb3
Merge pull request #418 from Hyatche/master
[fix] Adding lib.c to rule of slcanpty build for AOSP / AAOS
2023-03-22 15:06:49 +01:00
Hyatche 3352b156a9
[fix] Adding lib.c to rule of slcanpty build
See issue : https://github.com/linux-can/can-utils/issues/417
2023-03-22 14:51:39 +01:00
Yasushi SHOJI 69ded0fbad slcand: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

slcand was returning 0 when SIGINT and SIGTERM is received.  This
commit, instead, return 128 + signum when it gets a signal.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:23:18 +09:00
Yasushi SHOJI 7490986650 j1939acd: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

For j1939acd.c, it was using s.sig_term as a boolean key to exit from
the while loop.  This commit replaces a.sig_term with a.signal_num,
which holds the signal it received.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:23:10 +09:00
Yasushi SHOJI 7e35c7e1de canfdtest: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

canfdtest.c was effectively raising the received signal again to run
the default signal handler.  This has been declined by the maintainer
because it's over-engineering.  This commit replaces it with the
method proposed by the maintainer.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:23:01 +09:00
Yasushi SHOJI f45de1b782 canlogserver: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

canlogserver.c was using a non-safe function, exit(3), in the signal
handler.  This commit replaces it with the way other programs in
can-utils are using; set running = 0 to exit from the while loop.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:53 +09:00
Yasushi SHOJI 16a717c81e canbusload: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

canbusload.c was using a non-safe function, exit(3), in the signal
handler.  This commit replaces it with the way other programs in
can-utils are using; set running = 0 to exit from the while loop.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:41 +09:00
Yasushi SHOJI 180eceff4d isotptun: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:30 +09:00
Yasushi SHOJI 3ef3d72738 cansniffer: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:21 +09:00
Yasushi SHOJI 3caf692925 cansequence: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:12 +09:00
Yasushi SHOJI 74e0d28d1a cangen: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:22:01 +09:00
Yasushi SHOJI 4ec42fa089 candump: Follow Bash exit status when signaled
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-03-20 10:21:54 +09:00
Oliver Hartkopp cfe41963f3 include: update includes to latest Linux v6.2 upstream
Update includes to support CAN XL and latest CAN netlink features.

Upstream commits:

(1a3e3034c049) "can: canxl: introduce CAN XL data structure"
(061834624c87) "can: set CANFD_FDF flag in all CAN FD frame structures"
(94dfc73e7cf4) "treewide: uapi: Replace zero-length arrays with flexible-array members"
(383f0993fc77) "can: netlink: report the CAN controller mode supported flags"
(d99755f71a80) "can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC)"
(63dfe0709643) "can: bittiming: allow TDC{V,O} to be zero and add can_tdc_const::tdc{v,o,f}_min"
(626332696d75) "can: raw: add CAN XL support"

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-02-25 14:55:00 +01:00
Ashcon Mohseninia 999c650e87 slcan: increase BTR char limit to 8 for 32bit BTR
As required by some Atmel MCU SLCAN implementations.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-02-23 16:36:33 +01:00
Marc Kleine-Budde 2323d506d6
Merge pull request #406 from marckleinebudde/cangen-fix-usage
cangen: print_usage(): add missing newlines
2023-02-07 19:59:04 +01:00
Marc Kleine-Budde cdc617545f cangen: print_usage(): add missing newlines
Fixes: f55ea38d14 ("cangen: add option for absolute timeouts")
Fixes: c6f2cf7c2f ("cangen: add support for SO_TXTIME")
2023-02-07 19:57:08 +01:00
majkk1 e409aa4c8c cangen: new generation mode - partially randomized payload (-D)
Part of the fixed data payload can be randomized using the 'x' character.
Nibbles marked with 'x' will be randomized.

For example $ vcan0 -D 11xx3344DEADBEEF -L 8:
 -> second byte of the payload will be randomized.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-01-28 19:00:57 +01:00
Oliver Hartkopp 3b2248b48e Makefile: add missing defines for CLOCK_TAI, SO_TXTIME and SCM_TXTIME
The commit c6f2cf7c2f ("cangen: add support for SO_TXTIME") relies
on several toolchain features ("CLOCK_TAI", "SO_TXTIME", "SCM_TXTIME")
which are not present in old toolchain.

Add defines to fix compilation on older toolchains.

Reported-by: https://github.com/b-thomson
Link: https://github.com/linux-can/can-utils/issues/398
Fixes: c6f2cf7c2f ("cangen: add support for SO_TXTIME")

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-01-28 13:37:49 +01:00
Marc Kleine-Budde fe3717948b
Merge pull request #399 from marckleinebudde/fix-old-toolchains
buildsystem: add missing defines for CLOCK_TAI, SO_TXTIME and SCM_TXTIME
2023-01-24 11:54:14 +01:00
Marc Kleine-Budde e898c8a854 buildsystem: add missing defines for CLOCK_TAI, SO_TXTIME and SCM_TXTIME
The commit c6f2cf7c2f ("cangen: add support for SO_TXTIME") relies
on several toolchain features ("CLOCK_TAI", "SO_TXTIME", "SCM_TXTIME")
which are not present in old toolchain.

Add defines to fix compilation on older toolchains.

Reported-by: https://github.com/b-thomson
Link: https://github.com/linux-can/can-utils/issues/398
Fixes: c6f2cf7c2f ("cangen: add support for SO_TXTIME")
2023-01-24 10:04:06 +01:00
Marc Kleine-Budde 77ec9b3c2d Revert "cangen: use if_nametoindex() to avoid overflows"
This reverts commit 1f96d674c0.

Link: https://github.com/linux-can/can-utils/pull/396
Link: 1f96d674c0 (commitcomment-97455025)
2023-01-20 09:58:44 +01:00
Marc Kleine-Budde 5aa72c5e9e
Merge pull request #395 from marckleinebudde/mcp251xfd-dump
mcp251xfd dump: add support for dumps created with Linux kernel >= v5.18
2023-01-03 20:45:26 +01:00
Marc Kleine-Budde f3b35e8e80 mcp251xfd-dump: add support for dumps created with Linux kernel >= v5.18 2023-01-03 20:31:54 +01:00
Marc Kleine-Budde b4042d0205 mcp251xfd-dump: add test data 2023-01-03 20:31:54 +01:00
Marc Kleine-Budde 0847fb34b4 mcp251xfd-gen-testdata: add script to generate mcp251xfd-dump data 2023-01-03 20:18:47 +01:00
Marc Kleine-Budde ceb9761544 mcp251xfd-dump: regmap: skip lines that cannot be read 2023-01-03 15:46:07 +01:00
Marc Kleine-Budde 088176e4e0 mcp251xfd-dump: fail if no registers can be read from regmap file 2023-01-03 15:46:07 +01:00
Marc Kleine-Budde aadf98b49b
Merge pull request #394 from marckleinebudde/candump-cleanups
candump cleanups
2023-01-03 10:49:40 +01:00
Marc Kleine-Budde 92ae2b0e3d candump: sort getopt() by order of option in usage 2023-01-03 10:37:15 +01:00
Marc Kleine-Budde 306254b950 candump: checkpatch: fix space and newline usage
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2023-01-03 10:37:15 +01:00
Marc Kleine-Budde 34bd45861b
Merge pull request #392 from marckleinebudde/cleanups
cleanups
2022-12-19 15:42:42 +01:00
Juergen Borleis 578f42aac8 Buildsystem: provide missing network/CAN related definitions on demand only
Without the corresponding include file, these macros get always defined
locally and thus, shadows the ones from the system. This change ensures,
if the macros are found already defined in the system, then they are used.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
2022-12-19 15:31:23 +01:00
Juergen Borleis 3c88cfc1ec Buildsystem: don't define _GNU_SOURCE unconditionally
The "AC_USE_SYSTEM_EXTENSIONS" macros tests it for us.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
2022-12-19 15:31:23 +01:00
Juergen Borleis 40819fd038 lib.h: add forgotten declaration
The compiler misses the structure in some source files.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
2022-12-19 15:31:23 +01:00
Marc Kleine-Budde 12f1d94856
Merge pull request #391 from marckleinebudde/cansequence
cansequence: do_receive(): improve output in case of packet miss-match
2022-12-19 15:30:42 +01:00
Marc Kleine-Budde 7d375df741 cansequence: do_receive(): improve output in case of packet miss-match 2022-12-19 15:26:28 +01:00
Marc Kleine-Budde 1969f943a2
Merge pull request #390 from marckleinebudde/can-tc-init-etf
can-tc-init-etf: document required kernel config options
2022-12-13 22:39:08 +01:00
Marc Kleine-Budde 1322afa6e4 can-tc-init-etf: document required kernel config options 2022-12-13 22:13:37 +01:00
Marc Kleine-Budde f662b32082
Merge pull request #389 from marckleinebudde/cangen-so_txtime
cangen: add support for SO_TXTIME
2022-12-12 15:08:12 +01:00
Marc Kleine-Budde 5b5f1523c4 can-tc-init-etf: add example script to setup queuing for etf 2022-12-12 13:25:09 +01:00
Marc Kleine-Budde c6f2cf7c2f cangen: add support for SO_TXTIME
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-09 19:47:21 +01:00
Marc Kleine-Budde 9dff4b6393 cangen: do_send_one(): use sendmsg() instead of write()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-08 10:55:19 +01:00
Marc Kleine-Budde 759524f02c cangen: move write() into separate function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-08 10:55:18 +01:00
Marc Kleine-Budde f55ea38d14 cangen: add option for absolute timeouts
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-08 10:49:21 +01:00
Marc Kleine-Budde df232c845a cangen: import timespec helper functions
Imported from:

0b5b9845eb

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-07 16:45:21 +01:00
Marc Kleine-Budde 1ec8eb9ca1 cangen: move sleep directly in font of send()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-07 16:45:21 +01:00