Vincent Mailhol and Marc Kleine-Budde
f3ce3efe66
include: update linux/can/error.h
...
Update the linux/can/error.h hearder to incorporate the changes made
in Linux 6.0.0. Namely:
- commit 3e5c291c7942 ("can: add CAN_ERR_CNT flag to notify
availability of error counter")
Link: https://git.kernel.org/torvalds/linux/c/3e5c291c7942
- commit 3f9c26210cf8 ("can: error: add definitions for the
different CAN error thresholds")
Link: https://git.kernel.org/torvalds/linux/c/3f9c26210cf8
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net >
Link: https://lore.kernel.org/all/20221114163848.3398-3-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-11-15 09:44:51 +01:00
Vincent Mailhol and Marc Kleine-Budde
4c9f046615
slcanpty: remove redundant asc2nibble()
...
asc2nibble() is already defined in lib.h. Include lib.h in slcnpty.c
so that asc2nibble() does not need to be redefined a second time and
adjust the Makefile accordingly.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net >
Link: https://lore.kernel.org/all/20221114163848.3398-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-11-15 09:44:51 +01:00
Marc Kleine-Budde and GitHub
71a0156bd5
Merge pull request #380 from marckleinebudde/fix-fname-scope
...
candump: main(): fix scope of fname
2022-09-29 12:50:05 +02:00
Marc Kleine-Budde
e54d677999
candump: main(): fix scope of fname
...
Reported-by: https://github.com/HBLocker
Link: https://github.com/linux-can/can-utils/issues/379
2022-09-29 12:47:17 +02:00
Marc Kleine-Budde and GitHub
2b3b5c498f
Merge pull request #378 from RICCIARDI-Adrien/canfdtest_add_extended_frame_format_support
...
canfdtest: Add extended frame format support
2022-09-09 11:28:19 +02:00
RICCIARDI-Adrien
8e66a0bae3
canfdtest: Add extended frame format support
...
Added the '-e' command line option to enable 29-bit CAN ID.
Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr >
2022-09-09 11:01:43 +02:00
Marc Kleine-Budde and GitHub
e602e391a5
Merge pull request #376 from marckleinebudde/fix-candump
...
candump: fix HW timestamps + dropcount
2022-08-28 00:21:27 +02:00
Marc Kleine-Budde
2b5e93744b
candump: reserve enough space for ctrlmsg
...
The ctrlmsg must be large enough to contains 3 elements of various
sizes, not a single element of the sum of the size.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-27 23:26:39 +02:00
Marc Kleine-Budde
0d26ba9ea3
candump: print number of dropped frames as unsigned values
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-27 23:25:18 +02:00
Marc Kleine-Budde and GitHub
5736818292
Merge pull request #375 from jhofstee/fix_snprintf_error_data
...
lib: fix seperator in snprintf_error_data
2022-08-17 17:11:34 +02:00
Jeroen Hofstee
3bb412e072
lib: fix seperator in snprintf_error_data
...
When multiple error flags are set, snprintf_error_data created a comma
seperated textual presentation of it. Commit ef853f5553 ("added return value
check of snprintf to prevent possible buffer overflows detected by CodeQL")
removed the increment of count, so the delimiter is no longer added. Fix this
by incrementing count again.
Fixes: Commit ef853f5553 ("added return value check of snprintf to prevent possible buffer overflows detected by CodeQL")
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com >
2022-08-17 16:57:26 +02:00
Marc Kleine-Budde and GitHub
f020f563e7
Merge pull request #374 from marckleinebudde/fix-android
...
Android.mk: fix compilation of can-calc-bit-timing
2022-08-17 11:54:50 +02:00
Marc Kleine-Budde
e0945d867e
CMakeLists: fix compilation of can-calc-bit-timing
...
Fixes: 9c38c16437 ("can-calc-bit-timing: move into subdir")
Reported-by: Tompee Balauag <tompee26@gmail.com >
Link: https://github.com/linux-can/can-utils/issues/373
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-17 11:39:16 +02:00
Marc Kleine-Budde
f81ce85730
Android.mk: fix compilation of can-calc-bit-timing
...
Fixes: 9c38c16437 ("can-calc-bit-timing: move into subdir")
Reported-by: Tompee Balauag <tompee26@gmail.com >
Link: https://github.com/linux-can/can-utils/issues/373
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-17 09:07:01 +02:00
Marc Kleine-Budde and GitHub
a44238c9e2
Merge pull request #372 from marckleinebudde/calc-bit-timing
...
improve can-calc-bittiming
2022-08-12 15:16:02 +02:00
Marc Kleine-Budde
7e2010a1c0
can-calc-bit-timing: import bit timing calculation algorithm from v5.19
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 22:42:16 +02:00
Marc Kleine-Budde
0654d4e711
can-calc-bit-timing: import bit timing calculation algorithm from v5.16
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 22:42:16 +02:00
Marc Kleine-Budde
18eb0ab784
can-calc-bit-timing: import bit timing calculation algorithm from v4.8
...
The bit timing algorithm is not identical with the referenced commit.
So re-import from that commit.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 22:25:51 +02:00
Marc Kleine-Budde
b777ce2e6d
can-calc-bit-timing: import bit timing calculation algorithm from v3.18
...
add missing can_fixup_bittiming()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 22:25:16 +02:00
Marc Kleine-Budde
c1f5dc53ec
can-calc-bit-timing: import bit timing calculation algorithm from v2.6.31
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 22:24:43 +02:00
Marc Kleine-Budde
ee2f48f33b
can-calc-bit-timing: move algorithms into separate files
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 21:47:47 +02:00
Marc Kleine-Budde
a7062893da
can-calc-bit-timing: add can_fixup_bittiming to alg
...
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
2022-08-11 21:45:50 +02:00
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 and GitHub
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 and GitHub
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 and GitHub
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 and GitHub
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 and GitHub
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:100:20: runtime error: signed integer overflow:
200000000000000000 * 100 cannot be represented in type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior asc2log.c:100: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 and GitHub
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