Commit Graph

1257 Commits (master)

Author SHA1 Message Date
Marc Kleine-Budde 88a0417a6b
Merge pull request #609 from dphipps-qnx/fix_cmsg_types
candump: Use SCM_* consts instead of SO_* for cmsg_type
2025-12-05 16:26:30 +01:00
Darcy Phipps 65e715d56d candump: Use SCM_* consts instead of SO_* for cmsg_type
There are explicit #defines for SCM_TIMESTAMP and SCM_TIMESTAMPING. They
currently happen to have the same value as SO_TIMESTAMP and
SO_TIMESTAMPING but the former should be used when checking cmsg_type in
case one day they do not.
2025-12-05 09:35:50 -05:00
Oliver Hartkopp 374fecde09 cangen: disable generation of unsupported CAN frame types in mixed mode
The mixed mode is able to automatically detect the potential supported
CAN frame types CAN CC/FD/XL by checking the CAN device MTU at startup.

Usually the MTU shows which CAN frame types can be sent but in the case of
CAN XL in CANXL-only mode CC and FD frames can not be sent on the CAN_RAW
socket.

Since this patch [1] the CAN_RAW socket rejects unsupported CAN frames and
returns -EINVAL as error code. With this change in cangen the CC and FD
frame generation can be disabled in mixed mode at runtime.

[1] https://lore.kernel.org/linux-can/20251125123859.3924-17-socketcan@hartkopp.net/T/#u

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2025-12-03 16:09:12 +01:00
Oliver Hartkopp bfbf0c851f cangen: auto enable FD/XL content in mixed mode
Automatically create FD/XL content in mixed mode when the CAN interface
is capable to deal with it.

Suggested-by: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2025-12-03 16:09:12 +01:00
Oliver Hartkopp ed7822c9a2 candump: print CAN XL specific flags as extra message infos
The extra message infos BRS and ESI have been printed when enabled with
the '-x' option. Since CAN XL has similar flags (SEC and RRS) those flags
have been wrongly printed as CAN FD flags.

This patch introduces separate flags for the CAN XL frames and prints them
when a CAN XL frame is processed.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2025-11-26 19:04:50 +01:00
Marc Kleine-Budde e9ea9d1168
Merge pull request #607 from marckleinebudde/cansend-fix-typo
cansend: fix typo in CANFD_FDF flag name
2025-11-07 12:55:39 +01:00
Marc Kleine-Budde 2d793d38d2 cansend: fix typo in CANFD_FDF flag name
Closes: https://github.com/linux-can/can-utils/issues/606
Fixes: 3e0e6ae3a4 ("cansend: print canfd_frame.flags in help text")
2025-11-07 12:51:19 +01:00
Marc Kleine-Budde 340a3b8c92
Merge pull request #605 from marckleinebudde/lib_h-selfcontained
lib.h: include linux/can.h
2025-11-07 12:34:08 +01:00
Marc Kleine-Budde 8838ce80fc
Merge pull request #604 from marckleinebudde/cansend-canfd-flags
cansend: print canfd_frame.flags in help text
2025-11-07 12:33:02 +01:00
Marc Kleine-Budde d6c57240ed lib.h: include linux/can.h
Make lib.h self contained, so that language servers can parse it without
errors.
2025-11-07 12:30:15 +01:00
Marc Kleine-Budde 3e0e6ae3a4 cansend: print canfd_frame.flags in help text 2025-11-07 12:05:04 +01:00
Oliver Hartkopp 8bf5f8873f Fix optional nanosecond timestamp
The extension of the timestamp size is missing in log2asc.c and canplayer.c

Fixes: 987bc8aac2 ("Optional nanosecond timestamp logging")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2025-09-03 12:55:26 +02:00
Rikus Wessels 0094905376 Fix possible sscanf buffer overflow 2025-09-03 12:42:51 +02:00
Rikus Wessels 987bc8aac2
Optional nanosecond timestamp logging (#592)
* Optional nanosecond timestamp logging

* Removed limited string reading
2025-09-03 11:11:47 +02:00
Oliver Hartkopp 6b46063eee cangen: add CAN XL RRS bit generation
Allow to generate Remote Request Substitution bit content.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2025-06-24 19:48:14 +02:00
Marc Kleine-Budde 93a7b2dfd3
Merge pull request #596 from inomotech-foss/master
Allow more fine-grained control over CMake targets
2025-05-22 10:22:19 +02:00
Simon Berger af09afb734
Update CMakeLists.txt
Co-authored-by: Marc Kleine-Budde <mkl@blackshift.org>
2025-05-22 10:14:39 +02:00
Simon Berger 69efecc428
Allow more fine-grained control over CMake targets 2025-05-21 16:40:24 +00:00
Marc Kleine-Budde 3698814740
Merge pull request #595 from marckleinebudde/can-calc-bittiming-more-data-bitrates
can-calc-bit-timing: common_data_bitrates: add some slower bitrates
2025-05-03 15:02:56 +02:00
Marc Kleine-Budde 6ed0f0ea7f can-calc-bit-timing: common_data_bitrates: add some slower bitrates
There are real world use cases for CAN-FD data bitrates below 1
MBit/s. Add some to the common_data_bitrates array.

Link: https://lore.kernel.org/79BCE02A-D4EC-4362-B0D3-3FE76FB17B78@vpprocess.com
2025-05-03 14:53:54 +02:00
Marc Kleine-Budde 287469245c
Merge pull request #123 from twasilczyk/slcand-android
Don't fail when it wasn't possible to fetch the interface name.
2025-04-06 10:11:38 +02:00
Tomasz Wasilczyk 7a318636e7 slcand: Don't fail when it wasn't possible to fetch the interface name.
On some systems SIOCGIFNAME may fail with ENOTTY, but the actual
slcanX interface gets properly configured. Instead of crashing hard on
such case, let's gracefuly degrade and just not display the interface
name.
2025-04-06 10:03:36 +02:00
Marc Kleine-Budde 7fb81e6779
Merge pull request #593 from yegorich/static-libs
CMakeLists.txt: add an option to control shared library creation
2025-03-12 09:27:14 +01:00
Yegor Yefremov a904183b4e CMakeLists.txt: add an option to control shared library creation
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-03-11 18:19:08 +01:00
Marc Kleine-Budde e2172546aa
Merge pull request #591 from zeljkoavramovic/master
README.md : mention new canerrsim tool and add a link to existing J1939 kernel module installation document
2025-03-03 15:47:02 +01:00
Zeljko Avramovic 705b3202a9 added new canerrsim tool and a link to already existing can-j1939-install-kernel-module.md 2025-03-03 15:27:02 +01:00
Marc Kleine-Budde 31a59be02f
Merge pull request #588 from marckleinebudde/makefile-detect-libgps
Makefile: rely on pkg-config to detect presence of libgps
2025-03-03 13:24:18 +01:00
Marc Kleine-Budde 4d908bd7cf
Merge pull request #590 from marckleinebudde/fix-makefile-into-ci
github-actions: fix used compiler
2025-03-03 13:22:57 +01:00
Marc Kleine-Budde 837e2bb343 github-actions: fix used compiler
Fixes: 130e0dced2 ("github-actions: compile with gcc and clang using Makefile")
2025-03-03 13:20:50 +01:00
Marc Kleine-Budde ec16ef97ff Makefile: rely on pkg-config to detect presence of libgps
Link: 71b2aec834 (commitcomment-153191516)
Fixes: 71b2aec ("j1939-vehicle-position-srv: Introduce J1939 and NMEA 2000 Vehicle Position Server")
2025-03-03 13:14:05 +01:00
Marc Kleine-Budde 651c8818dd
Merge pull request #589 from marckleinebudde/integrate-makefile-into-ci
github-actions: compile with gcc and clang using Makefile
2025-03-03 13:13:02 +01:00
Marc Kleine-Budde 130e0dced2 github-actions: compile with gcc and clang using Makefile 2025-03-03 13:08:26 +01:00
Marc Kleine-Budde ff90f4ec21
Merge pull request #586 from marckleinebudde/fix-typo-update-gitignore
Fix typos and update gitignore
2025-03-03 10:24:07 +01:00
Marc Kleine-Budde e3ee283443 gitignore: ignore new tools if building with Makefile 2025-03-03 10:18:25 +01:00
Marc Kleine-Budde e8130a3575 treewide: fix typos 2025-03-03 10:18:25 +01:00
Marc Kleine-Budde 1250c12a30
Merge pull request #585 from marckleinebudde/fix-makefile
Makefile: remove erroneous '\'
2025-03-03 10:14:53 +01:00
Marc Kleine-Budde 9b5b030877 Makefile: remove erroneous '\'
This should at least fix the `No rule to make target` error:

```
cc -O2 -Wall -Wno-parentheses -Wsign-compare -I. -Iinclude -DAF_CAN=PF_CAN -DPF_CAN=29 -DSO_RXQ_OVFL=40 -DSCM_TIMESTAMPING_OPT_STATS=54 -DCLOCK_TAI=11 -DSO_TXTIME=61 -DSCM_TXTIME=SO_TXTIME -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE  -c -o j1939_vehicle_position/j1939_vehicle_position_srv.o j1939_vehicle_position/j1939_vehicle_position_srv.c
j1939_vehicle_position/j1939_vehicle_position_srv.c:7:10: fatal error: gps.h: No such file or directory
    7 | #include <gps.h>
      |          ^~~~~~~
compilation terminated.
make: *** [<builtin>: j1939_vehicle_position/j1939_vehicle_position_srv.o] Error 1
make: *** No rule to make target 'cc', needed by 'j1939-vehicle-position-srv'.
make: *** No rule to make target '-lgps', needed by 'j1939-vehicle-position-srv'.
make: *** No rule to make target '-o', needed by 'j1939-vehicle-position-srv'.
```

Link: 71b2aec834 (commitcomment-153191516)
Fixes: 71b2aec834 ("j1939-vehicle-position-srv: Introduce J1939 and NMEA 2000 Vehicle Position Server")
2025-03-03 10:09:48 +01:00
Marc Kleine-Budde da3914c491
Merge pull request #528 from marckleinebudde/canerrsim
canerrsim
2025-03-02 17:19:38 +01:00
Marc Kleine-Budde 18b1e7970a
Merge pull request #553 from olerem/j1939_vehicle_position
J1939 vehicle position
2025-03-02 17:19:09 +01:00
Zeljko Avramovic 491cabea07 canerrsim: add
Link: https://github.com/linux-can/can-utils/issues/525#issue-2311379340
2025-03-02 17:16:21 +01:00
Marc Kleine-Budde f1cea504a4
Merge pull request #583 from yegorich/typos
isobusfs: fix typos
2025-03-02 17:09:17 +01:00
Marc Kleine-Budde 900c7e9f6e
Merge pull request #584 from yegorich/fix-switch-case
slcand.c: add the missing case colon
2025-03-02 17:08:23 +01:00
Yegor Yefremov b208876e65 slcand.c: add the missing case colon
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-03-02 15:51:45 +01:00
Yegor Yefremov 72a9fd8ccd isobusfs: fix typos
Typos were found with codespell.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-03-02 15:44:40 +01:00
Marc Kleine-Budde e448d542e8 github-actions: install libgps-dev where available 2025-03-01 22:30:29 +01:00
Oleksij Rempel 71b2aec834 j1939-vehicle-position-srv: Introduce J1939 and NMEA 2000 Vehicle Position Server
This patch adds `j1939-vehicle-position-srv`, a server for sending
vehicle position data over CAN using J1939 or NMEA 2000 protocols. It
retrieves GPS data from gpsd or simulates data if gpsd is unavailable.
By default, it operates in J1939 profile but can switch to NMEA 2000
with the `-p nmea2000` option.

Usage Examples:
1. With gpsd:
   j1939acd -r 64-95 -c /tmp/1122334455667789.jacd 1122334455667789 vcan0 &
   j1939-vehicle-position-srv -i vcan0 -n 0x1122334455667789

2. In simulation mode without gpsd:
   j1939-vehicle-position-srv -i vcan0 -s -p nmea2000

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
[Yegor: add CMakeLists.txt integration]
Co-developed-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-03-01 22:29:11 +01:00
Marc Kleine-Budde a24bff8b08
Merge pull request #582 from yegorich/clangd
CMakeLists.txt: enable CMAKE_EXPORT_COMPILE_COMMANDS by default
2025-03-01 16:47:48 +01:00
Yegor Yefremov fe9ea67814 CMakeLists.txt: enable CMAKE_EXPORT_COMPILE_COMMANDS by default
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-03-01 16:15:08 +01:00
Oleksij Rempel e8559479fb libj1939: Add function to connect a socket
Introduce `libj1939_connect_socket` function to handle socket
connections.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2025-03-01 13:28:52 +01:00
Marc Kleine-Budde 6050aa155d
Merge pull request #581 from yegorich/cmake-linting
CMakeLists.txt: remove unneeded spaces
2025-03-01 12:33:50 +01:00