Commit Graph

1257 Commits (master)

Author SHA1 Message Date
Marc Kleine-Budde 51ee436e75 j1939spy: convert towards kernel coding style 2023-10-17 09:50:26 +02:00
Marc Kleine-Budde 46fae98b76
Merge pull request #466 from marckleinebudde/fix-canbusload
canbusload: main(): switch from pselect() to select()
2023-10-06 14:23:27 +02:00
Marc Kleine-Budde 8e2caa8f8a canbusload: main(): switch from pselect() to select()
We don't need to block any signals, so a select() is sufficient. This
also fixes the problem that sigmask is uninitialized and may block the
sig ARLM, which make canbusload hang until a CAN frame is recieved.

Closes: https://github.com/linux-can/can-utils/issues/465
2023-10-06 12:32:42 +02:00
Marc Kleine-Budde c5b64802a1
Merge pull request #464 from marckleinebudde/can-calc-bittiming
can-calc-bit-timing: at91_can: add 66 MHz CAN clock for sama5d3
2023-10-05 12:58:34 +02:00
Marc Kleine-Budde 0e428e36a5 can-calc-bit-timing: at91_can: add 66 MHz CAN clock for sama5d3 2023-10-05 12:52:57 +02:00
Marc Kleine-Budde 4b5b524256
Merge pull request #462 from marckleinebudde/lib
lib: coding style cleanups + fix printing of CAN_ERR_CNT
2023-09-27 16:30:18 +02:00
Marc Kleine-Budde 7d59157d4d lib: snprintf_can_error_frame(): don't bail out if CAN_ERR_CNT is set
If CAN_ERR_CNT is set, the snprintf_can_error_frame() bails out, as it
cannot decode CAN_ERR_CNT.

Fixes: 21fb43532e ("lib: snprintf_can_error_frame: print counter errors if CAN_ERR_CNT is set")
2023-09-27 16:26:50 +02:00
Marc Kleine-Budde 0a43e84bcd lib: convert towards kernel coding style 2023-09-27 16:26:50 +02:00
Marc Kleine-Budde 1be7e0e51d
Merge pull request #461 from marckleinebudde/canbusload
canbusload: coding style cleanups + use less screen estate in redraw mode
2023-09-27 12:46:15 +02:00
Marc Kleine-Budde 84919edbaa canbusload: redraw mode: use less screen estate
Use less screen estate by not printing unneeded newlines in redraw
mode.
2023-09-27 12:40:38 +02:00
Marc Kleine-Budde 92adbda471 canbusload: convert towards kernel coding style 2023-09-27 12:38:48 +02:00
Marc Kleine-Budde 3490282fc7
Merge pull request #460 from marckleinebudde/can-calc-bittiming-add-tq-help-text
can-calc-bit-timing: print_usage(): add --tq parameter to help text
2023-09-19 11:23:41 +02:00
Marc Kleine-Budde 47472cabc3 can-calc-bit-timing: print_usage(): add --tq parameter to help text
In 913311fc15 ("can-calc-bit-timing: add support to decode user
supplied bit timing parameters") support to decide user supplied bit
timing parameters was added. However, it was forgotten to add --tq to
the help text.

Add help text for the --tq paramter.

Reported-by: https://github.com/EnricoMontecaggi
Closes: https://github.com/linux-can/can-utils/issues/459
Fixes: 913311fc15 ("can-calc-bit-timing: add support to decode user supplied bit timing parameters")
2023-09-19 11:18:16 +02:00
Marc Kleine-Budde 39d6bba36a
Merge pull request #458 from marckleinebudde/cansequence-error-messages
cansequence: error messages
2023-09-19 09:07:20 +02:00
Marc Kleine-Budde c8cf342cb2 cansequence: main(): error handling: add "()" to function name in error message
Commit 0be066bee6 ("cansequence: main(): allow to bind on "any"
interface") converted from SIOCGIFINDEX ioctl() to if_nametoindex()
and adjusted the error message, but forgot the "()" after the function
name, which is used in the rest of the error messages in this file.

Add the missing "()".

Fixes: 0be066bee6 ("cansequence: main(): allow to bind on "any" interface")
2023-09-19 08:57:44 +02:00
Marc Kleine-Budde e7c03ee93b cansequence: do_receive(): fix error message if recvmsg() fails
In commit 9567230494 ("cansequence: print out dropped packages by
socket counter"), the read() syscall was replaced by recvmsg(). Adjust
error message accordingly.

Fixes: 9567230494 ("cansequence: print out dropped packages by socket counter")
2023-09-19 08:55:53 +02:00
Marc Kleine-Budde 096d42ab98
Merge pull request #457 from marckleinebudde/cansequence-version
cansequence: remove --version option from help text
2023-09-18 17:15:37 +02:00
Marc Kleine-Budde d7a51a5494 cansequence: remove --version option from help text
It is not implemented and not supported by any of the can-utils, so
remove it.

Reported-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2023-09-18 17:09:00 +02:00
Marc Kleine-Budde 2f9958c699
Merge pull request #447 from triveria/refactor-canplayer
Format code of canplayer
2023-09-05 11:51:56 +02:00
Michael Wagner ad850776c3 canplayer: Format code according to .clang-format 2023-09-05 10:51:30 +02:00
Michael Wagner 4657d02b1f Add .clang-format 2023-09-05 10:50:54 +02:00
Marc Kleine-Budde 33b2ae6f88
Merge pull request #454 from marckleinebudde/fix-poll-errno
Fix poll errno
2023-08-28 16:19:46 +02:00
Marc Kleine-Budde 87e6af1025 j1939cat: do_send(): fix errno check
"errno" hold the positive error value.

Link: https://github.com/linux-can/can-utils/issues/448
Fixes: cc155d2f63 ("j1939cat: make use of new RX UAPI")
Fixes: 19d41bec45 ("jcat: allow to re-send rest of the buffer if we was interrupted")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2023-08-28 16:11:29 +02:00
Marc Kleine-Budde 87a6788e6d cansequence: do_send(): fix errno check
"errno" hold the positive error value.

Link: https://github.com/linux-can/can-utils/issues/448
Reported-by:  Adien Akhmad <adien.akhmad@gmail.com>
Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Fixes: fb5903f226 ("[cansequece] added various improvements")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2023-08-28 16:11:24 +02:00
Oliver Hartkopp 79601bd1d4 canplayer: ensure 6 decimal places in timestamp for first frame
The check has only been applied after the first CAN frame has been read
and evaluated. This lead to an unintended sending of a single handcrafted
frame with a following (intended) failure at the second frame.

Apply the check also for the very first CAN frame that is processed.

Fixes: ee0233505b ("canplayer: ensure 6 decimal places in timestamp")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-08-10 10:31:26 +02:00
Marc Kleine-Budde 3aa72b8208
Merge pull request #445 from marckleinebudde/ccls-cleanups
ccls related cleanups
2023-08-01 22:05:58 +02:00
Marc Kleine-Budde 1d7d37c6ac gitignore: add ccls related files 2023-08-01 21:45:43 +02:00
Marc Kleine-Budde ac0059db12 calc-bit-timing: include compat.h to make ccls happy 2023-08-01 21:45:43 +02:00
Marc Kleine-Budde fd0837f7e6 can-calc-bit-timing: move kernel compatibility stuff into own header 2023-08-01 21:45:43 +02:00
Marc Kleine-Budde 90baa696cd
Merge pull request #444 from marckleinebudde/can-calc-bittiming-v6.3
can-calc-bit-timing: import bit timing calculation algorithm from v6.3
2023-08-01 14:19:05 +02:00
Marc Kleine-Budde ca304faad3 can-calc-bit-timing: import bit timing calculation algorithm from v6.3 2023-08-01 14:13:43 +02:00
Marc Kleine-Budde dc77f54bc1 can-calc-bit-timing: import 64 bit math helpers from kernel 2023-08-01 14:13:43 +02:00
Marc Kleine-Budde 0be066bee6 cansequence: main(): allow to bind on "any" interface
This is handy for running cansequence during an ifdown/ifup or a
rmmod/insmod cycle.
2023-07-07 08:34:11 +02:00
Marc Kleine-Budde 87def9b1fa cansequence: main(): use C99 initializers for struct sockaddr_can addr
By using C99 initializers for struct sockaddr_can addr the not
assigned members are automatically set to 0x0, resulting in not
passing uninitialized memory to the bind() syscall.

Also remove the printing of the socket family, type and proto, this
was interesting back in the days, when the numbers were not fixed, yet.
2023-07-07 08:34:11 +02:00
Marc Kleine-Budde ba5d7de30d
Merge pull request #438 from marckleinebudde/candump-cleanup
candump: main(): use C99 initializers for struct sockaddr_can addr
2023-07-04 09:41:18 +02:00
Marc Kleine-Budde 6c7542a3ff candump: main(): use C99 initializers for struct sockaddr_can addr
By using C99 initializers for struct sockaddr_can addr the not
assigned members are automatically set to 0x0, resulting in not
passing uninitialized memory to the bind() syscall.
2023-07-04 09:19:08 +02:00
Oliver Hartkopp 58083ad34a log2asc: fix logfiles where the timestamp starts with zero
The ASC file banner, e.g.

    date Thu Jan  1 01:00:00 1970
    base hex  timestamps absolute
    no internal events logged

should be printed when the first timestamp from the logfile has been
processed. But for logfiles starting with zero (e.g. candump -tz option)
this banner is printed every time the timestamps seconds equals zero.

As it was obviously not a good idea to stick the condition for printing
the banner based on some assumption about the timestamp a new variable
'print_banner' has been introduced.

Reported-by: https://github.com/CaSchmidt
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-06-12 10:16:08 +02:00
Marc Kleine-Budde 9e08e2272b
Merge pull request #424 from yashi/canbusload-add-error-message
canbusload: Enhance error message for missing bitrate
2023-06-02 14:09:12 +02:00
Yasushi SHOJI 1d43b3c6f3 canbusload: Enhance error message for missing bitrate
When canbusload is executed without bit rate, it exits with an exit
code of 1 and prints help, but without explaining why.  Users cannot
know what was wrong.  When other errors occur, though, canbusload
prints an error message along with the help.

Print an error message when bit rate is not given or "@" is not found.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-06-02 20:59:39 +09:00
Yasushi SHOJI b8e26388f8 canlogserver: Update the description
Update the description of canlogserver in README.md and help message.

This closes #421.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-05-13 17:25:17 +02:00
Oliver Hartkopp a3b60a70fe cangen: update CAN FD check to cope with CAN XL interfaces
The check for CAN FD capable interfaces only checked for CANFD_MTU to
enable the generation of CAN FD frame content. As CAN XL capable CAN
interfaces are able to handle CAN FD frames too the check has to be
extended for CANXL_MTU interfaces.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-05-09 14:30:16 +02:00
Oliver Hartkopp 5f764e73bf cansend: update CAN FD check to cope with CAN XL interfaces
The check for CAN FD capable interfaces only checked for CANFD_MTU to
enable the generation of CAN FD frame content. As CAN XL capable CAN
interfaces are able to handle CAN FD frames too the check has to be
extended for CANXL_MTU interfaces.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-05-09 14:21:46 +02:00
Marc Kleine-Budde 4cfc12e218
Merge pull request #426 from passgat/no-mmu
Add support for Linux/no-mmu with vfork
2023-05-09 10:15:10 +02:00
Dario Binacchi 5ed3b4ded6 Don't compile programs using fork() on MMU-less systems
Systems that lack a MMU cannot use fork() to create the child process.
The patch does not compile the affected programs on MMU-less systems.

Co-developed-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2023-05-08 18:30:50 +02:00
Marc Kleine-Budde e44db7366b
Merge pull request #430 from marckleinebudde/cangen-fix
cangen: main(): avoid loop initial declaration
2023-04-30 21:02:48 +02:00
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