TxRq messages are internal measurement messages that document the time of
a transmission request (to the CAN driver) to be checked against the real
transmission time, when the CAN message has been sent.
There is no such feature in the SocketCAN log format, so we detect this
tag but skip TxRq messages in the ASC log files.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Add '-s' option for display busload statistic, the output contains
minimal, maximum and exponentially-damped moving sums of one second
average (borrowed from Linux load average algorithm) since start or
reset (press 'r' while running).
canbusload 2024-09-23 17:15:18 (exact bitstuffing)
can0@500k 942 107535 60168 0 18% min: 0%, max: 21%, load: 16% 6% 2% |XXX.................|
Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com>
Signed-off-by: Hubert Streidl <hubert.streidl@de.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Link: https://lore.kernel.org/r/20250120162332.19157-2-mark.jonas@de.bosch.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Add '-P' option for allow user to set the socket priority. This can be
useful in conjuction with queuing discipline.
Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com>
Signed-off-by: Hubert Streidl <hubert.streidl@de.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Link: https://lore.kernel.org/r/20250120162332.19157-1-mark.jonas@de.bosch.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
With the introduction of CAN FD the bitrate has not been printed
correcty. Fix the CAN FD bitrate output and try to shrink the
bitrates by using kilo or Mega suffixes: 500000 -> 500k
Fixes: 6382765bf6 ("canbusload: count databitrate seperately")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Rework to use a single CAN socket for the received CAN traffic.
This allows to shutdown and restart various CAN interfaces without
terminating the application.
Additionally an auto detection has been implemented with the 'any' CAN
interface. E.g. with any@500000,2000000 CAN interfaces that have not
been defined before are assigned with the given 'any' bitrates when a
CAN frame from this CAN interface has been received.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
The CAN interface description can now have two bitrates.
Extend the length check to handle the CAN FD data bitrate correctly.
Fixes: 6382765bf6 ("canbusload: count databitrate seperately")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
- remove legacy '-p' option (prefix to use when logging), fixes uclibc
compile
Fixes:
j1939acd.c: In function 'main':
j1939acd.c:489:38: error: passing argument 1 of 'asprintf' from incompatible pointer type [-Wincompatible-pointer-types]
489 | if (asprintf(&program_invocation_name, "%s.%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char **
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Move part of isobusfs which can be reused by other applications to the
libj1939. By the way, reuse some of new libj1939 code in the j1939cat.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Fix the following error, by converting recvflags into a 64 bit type.
| /home/j1939spy.c: In function 'main':
| /home/j1939spy.c:248:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
| 248 | if (recvflags & (1 << SCM_TIMESTAMP)) {
| | ^~
Modify the isobusfs_log function in isobusfs_cmn.c to explicitly limit
the lengths of the time_buffer, level_str, and log_entry strings in
the snprintf format string to 40, 10, and 150 characters respectively.
This change acknowledges that truncation may still occur, but it is now
explicit and controlled.
This change silences the following warning:
cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=gcc -B build
cmake --build build
/home/isobusfs/isobusfs_cmn.c: In function 'isobusfs_log':
/home/isobusfs/isobusfs_cmn.c:104:30: warning: '%s' directive output
may be truncated writing up to 191 bytes into a region of size between
182 and 245 [-Wformat-truncation=]
104 | "[%s] [%s]: %s", time_buffer, level_str, log_entry);
| ^~ ~~~~~~~~~
/home/isobusfs/isobusfs_cmn.c:103:9: note: 'snprintf' output 12 or more
bytes (assuming 266) into a destination of size 256
103 | snprintf(complete_log_entry, sizeof(complete_log_entry),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104 | "[%s] [%s]: %s", time_buffer, level_str, log_entry);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>