Commit Graph

79 Commits (master)

Author SHA1 Message Date
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 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
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
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
Oliver Hartkopp 4b86049167 Makefile: add j1939 datetime tools
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-06-07 09:09:26 +02:00
Oliver Hartkopp 8d7d7650d4
can-utils: fix sign-compare warnings (#513)
Fixing several build issues reported by Gary Bisson when he was building
can-utils with clang (AOSP14).

URL: https://github.com/linux-can/can-utils/pull/512
Reported-by: Gary Bisson (https://github.com/gibsson)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-04-24 20:02:02 +02:00
Marc Kleine-Budde 68e0827fad
Merge pull request #500 from marckleinebudde/isobus
isobus: clean up build system integration, fix cmake
2024-02-19 10:17:52 +01:00
Marc Kleine-Budde eb0e0a30d4 makefile: isobus: remove dependencies to libj1939.h
Fixes: 42edaeaf52 ("Implement ISOBUS File Server (FS) Interface as a Personal Project")
2024-02-19 09:44:32 +01:00
Marc Kleine-Budde f5670b41d9 makefile: isobus: don't link against libj1939 2024-02-19 09:44:32 +01:00
Marc Kleine-Budde 4c2f81f790 Makefile: sort alphabetically
Fixes: a9260eab76 ("Makefile: fix isobusfs tools build")
2024-02-19 08:43:36 +01:00
Oliver Hartkopp a9260eab76 Makefile: fix isobusfs tools build
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-14 20:42:42 +01:00
Oleksij Rempel 42edaeaf52 Implement ISOBUS File Server (FS) Interface as a Personal Project
Introduce the ISOBUS File Server (FS) interface, compatible with ISO
11783-13. The implementation utilizes the kernel's existing CAN J1939
socket support.

For testing following setup can be used:
ip link add type vcan
ip l s dev vcan0 up

j1939acd -r 64-95 -c /tmp/1122334455667788.jacd 1122334455667788 vcan0 &
j1939acd -r 96-127 -c /tmp/1122334455667789.jacd 1122334455667789 vcan0 &

sleep 1

isobusfs-srv -i vcan0 -n 1122334455667788 -v vol1:/path/to/export/
isobusfs-cli -i vcan0 -n 0x1122334455667789 -m 0x1122334455667788 -I

Interactive mode currently support following commands:
exit - exit interactive mode
quit - exit interactive mode
help - show this help
dmesg - show log buffer
selftest - run selftest
ls - list directory
ll - list directory with long listing format
cd - change directory
pwd - print name of current/working directory
get - get file

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-02-02 13:44:07 +01: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
Oliver Hartkopp 3b2248b48e Makefile: add missing defines for CLOCK_TAI, SO_TXTIME and SCM_TXTIME
The commit c6f2cf7c2f ("cangen: add support for SO_TXTIME") relies
on several toolchain features ("CLOCK_TAI", "SO_TXTIME", "SCM_TXTIME")
which are not present in old toolchain.

Add defines to fix compilation on older toolchains.

Reported-by: https://github.com/b-thomson
Link: https://github.com/linux-can/can-utils/issues/398
Fixes: c6f2cf7c2f ("cangen: add support for SO_TXTIME")

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2023-01-28 13:37:49 +01:00
Vincent Mailhol 0cfd56d613 lib: add pr_debug() macro
Add the pr_debug() macro so that:

  #ifdef DEBUG
  	printf("foo");
  #endif

can be replaced by:

  	pr_debug("foo");

Apply the pr_debug() macro wherever relevant.

Currently, there is no consensus whether debug messages should be
printed on stdout or stderr. Most of the modules: canbusload.c,
candump.c and canlogserver.c use stdout but
mcp251xfd/mcp251xfd-dev-coredump.c uses stderr. Harmonize the behavior
by following the major trend and make
mcp251xfd/mcp251xfd-dev-coredump.c also output to stdout.

slcanpty.c does a #define DEBUG, meaning that debug is always turned
on for this file. Remove this and make debug an option like every
other files.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20221114163848.3398-5-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-11-15 09:49:52 +01:00
Vincent Mailhol 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 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
Oliver Hartkopp 622fcbb9b3 Makefile: remove obsolete requirements for lib.h
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2021-10-19 08:57:22 +02:00
Lothar Rubusch 9fd2b2e617 Makefile: clean mcp251xfd/*.o
make distclean depend on clean target in Makefile

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
2021-10-18 22:30:21 +01:00
Marc Kleine-Budde 66de96d337 mcp251xfd-dump: add tool to decode chip and driver state of mcp251xfd
It works on dev coredump data generated by the mcp251xfd driver in
case of failures, as well as on regmap based register dumps.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-02-13 23:36:43 +01:00
Marc Kleine-Budde a726c2a57a Merge branch 'cansequence' of github.com:marckleinebudde/can-utils into master
The PTX flavour canutils have a useful utility for generating a sequence of CAN
frames with an incrementing payload and checking such a sequence for missed and
reordered frames.

Recently, it has helped finding a regression in the kernel pfifo_fast qdisc,
which led to reordered frames.

To bring the utility to a greater audience, import the current state, including
its history, into the linux-can set of utilities.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-10-19 13:44:16 +02:00
Marc Kleine-Budde f3cf4cdf88 Makefile: fix indention
This patch fixes the indention, which was broken while renaming the j1939
tools.

Fixes: 8106214b55 ("Rename j* to j1939\1")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-10-15 18:08:49 +02:00
Alexander GQ Gerasiov 8106214b55 Rename j* to j1939\1
Using j*smthng* for j1939-related tools is not very good for 2 reasons:
1. j prefix is not very informative;
2. jcat name is used by journal cat tool from popular sleuthkit toolkit;
2`. jacd sounds very similar to jackd.
2``. Possible future name conflicts for new tools.

Thus I renamed j* to j1939\1 to deal with this issue.

Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>
2020-04-20 10:18:13 +03:00
Marc Kleine-Budde 6260263ef3 buildsystem: add SCM_TIMESTAMPING_OPT_STATS if not already defined 2019-05-09 14:40:16 +02:00
Marc Kleine-Budde 4a1818aa55 Makefile: cleanup
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-03-12 10:14:27 +01:00
Oleksij Rempel 23e5e227ac add jcat
jcat is kind of netcat for j1939
for example:
jcat can0:0x90 -r > /tmp/some_file

jcat -i some_file_to_send can0:0x80 :0x90,0x12300

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-04 13:01:11 +01:00
Bastian Stender 6133ac94f0 jacd: print relevant API calls on verbose
The output is now comparable to testj1939's -v output.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
2018-01-22 14:12:44 +01:00
Bastian Stender 1f3f2f6163 testj1939: use address to string function from libj1939
canaddr2str() from testj1939 and libj1939's libj1939_addr2str provide
the same functionality. Remove the local helper function and use
libj1939_addr2str instead.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
2018-01-22 12:27:15 +01:00
Marc Kleine-Budde 8839679a4c Merge branch 'master' of https://github.com/kurt-vd/test-can-j1939 2018-01-18 14:53:38 +01:00
Kurt Van Dijck 58c44ea3c4 can-j1939: add jacd address claim daemon
The can-j1939 kernel part only follows & validates inbound & outbound
address claim packets. Jacd implements the part that chooses an address
and emits the address claim packet.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-18 13:13:31 +01:00
Kurt Van Dijck 2cd00814a1 can-j1939: add jsr program
jsr sends data on <stdin> to j1939, and received j1939 data
is put on <stdout>.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-18 11:04:15 +01:00
Kurt Van Dijck c50b5a39de can-j1939: add jspy 'sniffer' program
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-18 11:04:15 +01:00
Kurt Van Dijck 1d3f8a1893 can-j1939: add libj1939
libj1939 provides a parser for struct sockaddr_can with j1939 info

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-18 11:04:15 +01:00
Marc Kleine-Budde cf949a926a unconditionally define _GNU_SOURCE
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-09 14:42:17 +01:00
Oliver Hartkopp 4c8fb05cb4 can-utils: remove strict-aliasing compiler warning
GitHub user 'crossband' raised an issue regarding the strict-aliasing compiler
warning in his specific setup: https://github.com/linux-can/can-utils/issues/42

In fact memcpy() and memset() are a better solution than the former pointer
magics, so remove the issues and the compiler warning flag too.

Reported-by: crossband (https://github.com/crossband)
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-07-01 19:01:01 +02:00
Marc Kleine-Budde 3881e6f673 Makefile: add install stage
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:27:13 +02:00
Marc Kleine-Budde 0a1372cc22 userspace headers: import userspace headers to simplify compilation
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:26:48 +02:00
Kurt Van Dijck 215ca91d26 Makefile: remove .html's with make clean 2016-02-23 09:38:13 +01:00
Kurt Van Dijck 7644a013cd split in Readme+Kickstart guide 2015-12-11 04:22:19 +01:00
Kurt Van Dijck 4f1026e9ff prepare for github 2015-12-11 04:16:41 +01:00
Oliver Hartkopp c1ac5613fd can-utils: added isotpperf tool for performance measurements
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2015-02-04 10:17:38 +01:00
Oliver Hartkopp 57d9fcbf81 Makefile: add large file support (LFS)
Large file support (LFS) in recent C libraries allows 32 bit applications to
create large files with file length values > 0x7FFFFFFF when the filesystem
supports it.

This patch adds large file support to the Makefile, if you don't want LFS use
the autotools version and call configure like this:

    ./configure --disable-largefile

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-26 19:49:08 +01:00
Marc Kleine-Budde 733192a3d0 Makefile: move cpp related flags from CFLAGS to CPPFLAGS
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-26 19:25:11 +01:00
Michal Sojka 2206f92de7 canbusload: Add exact CAN frame length calculation (including bitstuffing)
This adds an algorithm for calculating the exact number of bits a CAN
frame occupies on the bus and uses this algorithm in canbusload. It
also moves the other methods for CAN frame length calculation, already
present in canbusload, to the new file.

The added algorithm calculates the exact number of stuffed bit in a
CAN frame. Note that in order to calculate that correctly, we must
also know the frame's CRC. Hence, the algorithm also includes CRC
calculation routine.

The correctness of the algorithm was verified on an oscilloscope for
several different SFF and EFF frames.

Currently only CAN frames are supported. For CANFD frames, a different
algorithm is needed. CANFD uses different CRC polynomials and
calculates the CRC from the staffed bit-stream (CAN calculates CRC
from de-stuffed bit-stream).

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-30 16:23:25 +01:00
Kurt Van Dijck 198c5801ec import sample program & help page 2013-11-20 11:14:44 +01:00
Uwe Kleine-König 93ef3b1d81 can-utils: Don't overwrite PREFIX and DESTDIR when provided via the environment
For creating a Debian package providing PREFIX and DESTDIR via the
environment is the easiest option. So use ?= to assign these two
variables to honor the values in the environment.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2013-08-18 12:49:50 +02:00
Oliver Hartkopp 836d3cc012 remove obsolete SVN ID tags
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-11-14 20:57:16 +01:00
Marc Kleine-Budde 722a09116d treewide: replace berlios contact email by linux-can@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-01-11 12:14:15 +01:00
Marc Kleine-Budde 1f41714125 Makefile: adopt to new location for kernel headers
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
2012-01-11 12:14:15 +01:00