Commit Graph

1012 Commits (ceda93bd5c56927c72d48dcaa30e17d6ecea86b8)

Author SHA1 Message Date
Marc Kleine-Budde cfc3030080 can-calc-bit-timing: prepare for more algos
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 21:25:40 +02:00
Marc Kleine-Budde 9c38c16437 can-calc-bit-timing: move into subdir
The source file will be split into several files in the next patches.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 20:34:40 +02:00
Marc Kleine-Budde 258f357814 can-calc-bit-timing: add information if printing data bit timing table
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 20:34:40 +02:00
Marc Kleine-Budde ab2b11d9a8 can-calc-bit-timing: add new ref_clk to xilinx_can_fd2
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 20:34:40 +02:00
Marc Kleine-Budde 710fc99961 can-calc-bit-timing: add new ref_clk to mcp2515
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 20:34:40 +02:00
Marc Kleine-Budde 104e3f97a0 can-calc-bit-timing: add new ref_clk to mcan
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 20:34:39 +02:00
Marc Kleine-Budde 2b2d38d06b can-calc-bit-timing: fix indention
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 16:35:59 +02:00
Marc Kleine-Budde 75291c2a88 can-calc-bit-timing: common_bitrates: add more bitrates
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-08-11 16:35:59 +02:00
Marc Kleine-Budde cad1cecf1c
Merge pull request #370 from weichslgartner/master
fix for issue #369
2022-07-04 14:43:57 +02:00
weichslgartner da0326ffc6 fix for issue #369
adding cast preventing int/unsigned comparison (-Wsign-compare warning in lib.c)
2022-06-30 18:40:07 +02:00
Marc Kleine-Budde cfe13a4c7d
Merge pull request #368 from RICCIARDI-Adrien/canfdtest_add_message_length_support
canfdtest: Add message length support
2022-06-28 10:50:52 +02:00
RICCIARDI-Adrien b8af5a6031 canfdtest: Add message length support
Added the '-s' command line option to set the frame payload length in bytes.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-27 23:49:02 +02:00
Marc Kleine-Budde 5e06623b3d
Merge pull request #366 from RICCIARDI-Adrien/canfdtest_add_bit_rate_switch_support
canfdtest: Add CAN FD Bit Rate Switch support
2022-06-22 11:34:09 +02:00
RICCIARDI-Adrien 6d3bf51e0a canfdtest: Add CAN FD Bit Rate Switch support
Added the '-b' command line option, to be used in conjunction with the '-d'
option that enables CAN FD, to set the BRS bit in a CAN FD frame. When
enabled, the data part of the CAN FD frame is transmitted at a higher speed.
All remaining parts of the CAN FD frame use the classic CAN speed.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-22 10:50:12 +02:00
Marc Kleine-Budde 2b0ed067dd
Merge pull request #321 from weichslgartner/master
Fixed some undefined behavior and added CodeQL workflow
2022-06-20 19:40:36 +02:00
weichslgartner ef853f5553 added return value check of snprintf to prevent possible buffer overflows detected by CodeQL 2022-06-20 19:22:11 +02:00
weichslgartner eb2b38790a fixes undefined behavior in parse_canframe (lib.c:187) by chaning tmp to
canid_t

Issue:
mkdir build && cd build
CC=clang cmake -DCMAKE_C_FLAGS="-fsanitize=address,undefined"
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" .. && cmake
--build .

 echo "(0.0) can1 ffffffff#00000000" | ./log2long
can-utils/lib.c:187:23: runtime error: left shift of 15 by 28 places
cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/can-utils/lib.c:187:23 in
(0.0)  can1  3FFFFFFF
2022-06-20 19:11:00 +02:00
Marc Kleine-Budde bace2e7d73
Merge pull request #365 from RICCIARDI-Adrien/canfdtest_add_can_fd_support
canfdtest: Add CAN FD support
2022-06-20 18:30:14 +02:00
RICCIARDI-Adrien d3bb67136f canfdtest: Add CAN FD support
Add the '-d' command line option that allow to transmit CAN FD frames instead
of CAN 2.0 frames. The frames content is the same.

This allows to stress test the flexible data rate part of a CAN FD network.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
2022-06-20 18:13:18 +02:00
weichslgartner 34732eddeb fixed signed integer overflow in asc2log.c:100
Issue:
echo "0.0000 0  Rx   d 8 8D 00 10 01 00 82 01 00
      0.200000000000000000 0- 0000  Rx   d 8 8D 00 10 01 00 82 01 00" |
./asc2log

can-utils/asc2log.c💯20: runtime error: signed integer overflow:
200000000000000000 * 100 cannot be represented in type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior asc2log.c💯20
2022-06-13 17:42:33 +02:00
weichslgartner 2b0ef5c330 Create codeql-analysis.yml 2022-06-13 17:42:33 +02:00
Oliver Hartkopp 6e7f845a68 isotpsend: add support for transmission without flow control
Usually the ISO 15765-2 protocol is a point-to-point protocol to transfer
segmented PDUs to a dedicated receiver. This receiver sends a flow control
message to specify protocol options and timings (e.g. block size / STmin).

The so called functional addressing communication allows a 1:N
communication but is limited to a single frame length.

The new CAN_ISOTP_CF_BROADCAST flag introduced in Linux 5.19 allows an
unconfirmed 1:N communication with PDU lengths that would not fit into a
single frame. This feature is not covered by the ISO 15765-2 standard.

The isotpsend tool gets a new option '-C' to enable this unconfirmed 1:N
communication by setting the CAN_ISOTP_CF_BROADCAST flag.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-13 20:00:45 +02:00
Oliver Hartkopp d320a4a871 asc2log: reduce code duplication
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-01 13:57:25 +02:00
Oliver Hartkopp 81e76a7a0d log asc converter: support len8_dlc for Classical CAN frames part 2
In commit 6799180bd0 ("log asc converter: support len8_dlc for Classical
CAN frames") the len8_dlc support was accidentally only implemented for
the new CANFD asc format. This patch adds len8_dlc support for the 'old'
Classical CAN asc format which in fact always supported len8_dlc.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-01 13:47:57 +02:00
Oliver Hartkopp 2bdb93924e asc2log: make sure we have read the dlc value with sscanf()
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-01 13:02:08 +02:00
Oliver Hartkopp afc6a324da asc2log: move check for error frames
We need to check for different sscanf() failures and the number of read
items in the data frames. So move the simple check to the beginning.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-01 12:55:49 +02:00
Marc Kleine-Budde 901c9e519d
Merge pull request #354 from philschenker/master
Return -1 Exit-Code if compare_frame fails
2022-04-12 17:21:43 +02:00
Philippe Schenker 26842295b8 canfdtest: make use of return value of check_frame
check_frame has a return value. Make use of this in can_echo_dut which
then is evaluated and returned thereof in main()

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2022-04-12 17:18:22 +02:00
Philippe Schenker 24de626f33 canfdtest: return -1 if compare_frame fails
Do report errors from function compare_frame also on the exit-code.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2022-04-12 17:10:58 +02:00
Oliver Hartkopp c70d0a8e61 candump: handle individual logfile name for stdout
Since commit ad250a68dc ("candump: add option to define individual
filename for logfile") the option "-f <fname>" allows to define an
individual filename for a logfile.

Usually the "-" is used as filename to represent stdout or stdin on
Linux/Posix systems to be able to concatenate several applications via
pipes. This patch handles this special case by detecting the filename
"-" to print the logfile format on stdout instead of creating a logfile
with the name "-".

Fixes: ad250a68dc ("candump: add option to define individual filename for logfile")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-25 15:15:57 +01:00
Marc Kleine-Budde aa3f029925
Merge pull request #351 from hartkopp/isotp-updates
isotp: support Linux 5.18 features
2022-03-14 20:47:09 +01:00
Oliver Hartkopp dfb607c807 remove obsolete char pointer casts
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-14 18:21:45 +01:00
Oliver Hartkopp 84d3294132 isotp: support Linux 5.18 features
- update isotp.h include file
- update maximum PDU (buffer) size to 64kByte buffer
- support setting of N_As (frame_txtime) to zero

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-12 18:09:48 +01:00
Oliver Hartkopp 5e0895981b candump: fix accidentally disabled traffic timeout feature
With the option '-T <msecs>' candump terminates after getting no CAN traffic
for a specific time. With the introduction of epoll_wait() this feature
has been accidentally disabled.

This patch adds an extra check to detect the timeout again.

Fixes: 639498bc80 ("candump: use epoll_wait() instead of select()")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-07 10:32:41 +01:00
Oliver Hartkopp ad250a68dc candump: add option to define individual filename for logfile
Link: https://github.com/linux-can/can-utils/pull/345
Suggested-by: https://github.com/xR3b0rn
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-02-16 11:46:46 +01:00
Marc Kleine-Budde ec6a573de1
Merge pull request #342 from hartkopp/isotpsend
isotpsend: add new options to generate PDU traffic load
2022-02-10 09:29:19 +01:00
Oliver Hartkopp acec220189 isotpsend: add new options to generate PDU traffic load
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-02-09 18:34:09 +01:00
Marc Kleine-Budde b38d2639ba
Merge pull request #341 from marckleinebudde/mcp251xfd-dump
mcp251xfd-dump: add dump for IOCON register
2022-02-09 08:36:25 +01:00
Marc Kleine-Budde 0ccc3fed91 mcp251xfd-dump: add dump for IOCON register 2022-02-09 08:29:53 +01:00
Marc Kleine-Budde 9f9f2ff721
Merge pull request #340 from marckleinebudde/fix-typo
cansniffer: main(): fix typo comand -> command
2022-02-01 16:14:22 +01:00
Marc Kleine-Budde 00fbc5d536 cansniffer: main(): fix typo comand -> command
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-02-01 16:13:20 +01:00
Marc Kleine-Budde 2758f8eb62
Merge pull request #339 from jaiqc/master
closes #master: Fixed typo error in isodump
2022-02-01 16:07:52 +01:00
Jayachandran Dharuman 2ac24b86fd closes #master: Fixed typo erros in slcan and testj1939 2022-02-01 19:55:27 +05:30
Jayachandran Dharuman a4d2ee75bc closes #master: Fixed typo error in isodump 2022-02-01 19:38:41 +05:30
Marc Kleine-Budde 4984eb702e
Merge pull request #333 from marckleinebudde/bittiming-canfd-support
can-calc-bit-timing: add CAN-FD support
2022-01-27 16:06:40 +01:00
Marc Kleine-Budde 4bd649d73a
Merge pull request #336 from weidmueller/feature/fix-poll-function-calls
Fix error detection of poll function calls
2022-01-27 16:05:50 +01:00
Stefan Herbrechtsmeier 25de6276e8 j1939cat: fix error detection of poll function call
The poll function return -1 on error and set errno to indicate the
error.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2022-01-27 15:53:10 +01:00
Stefan Herbrechtsmeier 7af4264a13 cansequence: exit program with failure in case of poll timeout
The poll function returns 0 to indicate a call timed out.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2022-01-27 15:53:10 +01:00
Stefan Herbrechtsmeier 3342eb42e7 cangen: Do not treat -EINTR as error 2022-01-27 15:53:10 +01:00
Stefan Herbrechtsmeier c142ca63c9 cangen: exit program with failure in case of poll timeout
The poll function returns 0 to indicate a call timed out.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2022-01-27 14:31:37 +01:00