Commit Graph

1113 Commits (d294cd928c363965e989863be99d30b50bb07d9f)

Author SHA1 Message Date
Marc Kleine-Budde d294cd928c mcp251xfd-regmap: fix compiler warning
Fix the following compiler warning:

| mcp251xfd/mcp251xfd-regmap.c:38:4: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
|                         fscanf(reg_file, "%*[^\n]\n");
|                         ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~

Reported-by: https://github.com/Chaitanya84
Link: https://github.com/linux-can/can-utils/pull/506
2024-03-19 09:30:59 +01:00
Oliver Hartkopp 6d47f5c22b
Merge pull request #504 from hartkopp/master
can-utils: support CAN XL

This patch set adds support for CAN XL including VCIDs (Linux v6.9+)

Tools that completely support CAN XL:

    candump
    cangen
    canlogserver
    canplayer
    cansend
    log2long

CC/FD-only tools that have been adapted to the lib.[ch] changes:

    log2asc
    asc2log

Main changes:

    lib/cangen: add documentation for CAN XL ASCII representation
    lib: remove separate maxdlen parameter as every needed info is part of the CAN frame now
    lib: remove fprint functions and only support sprint
    lib: rework for static single buffer to contain a complete ASCII CAN XL frame
    lib: introduce a CAN frame unit type to contain CAN CC/FD/XL frames in one union
    canplayer/log2asc/log2long: make sscanf() buffer length aware
    cangen: fix views for some features for long CAN frame output
    general cleanups and buffer overflow safety measures
2024-03-13 22:03:02 +01:00
Oliver Hartkopp dd16f2603b can-utils: make local functions static
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-12 20:10:00 +01:00
Oliver Hartkopp 8535b1d217 log2asc: print error message if no valid CAN CC/FD frame is received
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-12 19:38:04 +01:00
Oliver Hartkopp 27030b3e54 lib: make sprint_canframe the buffer size aware snprintf_canframe
Make sure the library functions to convert CAN frames into ASCII
represenation do not exceed the given buffer size. This also applies
to the long CAN frame output library function.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-12 19:11:58 +01:00
Oliver Hartkopp 8e131401c1 lib: remove obsolete brackets
From review feedback.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-06 12:10:32 +01:00
Oliver Hartkopp 7905b632ff canlogserver: unify curly brackets in if statements
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-06 12:01:39 +01:00
Oliver Hartkopp 6f7b146166 cangen: unify curly brackets and apply review feedback
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-06 11:57:54 +01:00
Oliver Hartkopp 09aa4d55bf asc2log: unify curly brackets at function definition
Move the curly brackets to the start of the next line to follow the
common coding style in can-utils.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-06 11:42:13 +01:00
Oliver Hartkopp 87a3058019 cangen: support generation features for CAN XL specific content
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-04 22:50:52 +01:00
SCZeiDan 64dc0b2169
Update testj1939.c, correct verbose information. (#503)
Modify the verbose information for setting the promiscuous mode option;
2024-03-04 14:54:41 +01:00
Oliver Hartkopp 443312d6ce cangen: add initial CAN XL support
TODO:
- Test all features
- make CAN XL content variable

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-03 21:29:49 +01:00
Oliver Hartkopp 09b8a6431f cangen: add missing long CAN frame view for len8_dlc and eff
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-02 22:36:49 +01:00
Oliver Hartkopp 9a21de13f8 cangen: convert to CAN frame unit type
As preparation for CAN XL support.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-02 22:36:36 +01:00
Oliver Hartkopp 2af5e6aaaa canlogserver/log2long: make CAN XL ASCII buffer static
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-01 15:56:21 +01:00
Oliver Hartkopp 740c0ba156 lib/cansend: update documentation for CAN XL frame format
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-29 09:54:47 +01:00
Oliver Hartkopp 7761d8bcf8 canlogserver: add CAN XL support
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-29 08:44:27 +01:00
Oliver Hartkopp 29290505f7 log: finalize unified buffer handling
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-29 08:41:21 +01:00
Oliver Hartkopp 1da219922d unify buffer size for ASCII CAN frame string representations
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-29 07:10:34 +01:00
Oliver Hartkopp 34a1cfad29 lib: make parse_canframe CAN XL aware
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-28 22:00:19 +01:00
Oliver Hartkopp 3644a54d5b candump/lib: make sprint_long_canframe CAN XL aware
The 'long' CAN frame representation does not really fit for CAN XL content.
Therefore just a cropped output is provided to be able to see the CAN XL
header information and up to 64 byte of data (without binary or swap
formating options). To get the full qualified CAN XL content use the log
file format.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 20:11:46 +01:00
Oliver Hartkopp 04312e5a10 candump/lib: make sprint_canframe CAN XL aware
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 18:23:29 +01:00
Oliver Hartkopp 57238d5f81 candump: add sprintf error handling in sprint_timestamp
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 11:33:01 +01:00
Oliver Hartkopp f491175d72 lib: remove obsolete fprint_(long_)canframe functions
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 11:17:49 +01:00
Oliver Hartkopp 3b36edf128 canlogserver: remove fprint_canframe usage
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 11:14:18 +01:00
Oliver Hartkopp 48e10c9c57 canplayer: remove fprint_long_canframe usage
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 11:04:42 +01:00
Oliver Hartkopp 9d900f913c cangen: remove fprint_(long_)canframe usage
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 10:57:55 +01:00
Oliver Hartkopp 8d8d17e25d asc2log: remove fprint_canframe usage
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 10:11:17 +01:00
Oliver Hartkopp c6cc7151b7 candump/lib: convert to single output buffer
Build the CAN frame ASCII output inside a single (big) buffer as
preparation for CAN XL support.

This unifies different output modes (fprintf/sprintf/printf) at
the time of the CAN frame text generation.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-27 09:29:49 +01:00
Oliver Hartkopp 2522ec127b lib: integrate CAN FD indicator into dual-use struct canfd_frame
Replace maxdlen parameter and use CANFD_FDF flags instead.

Since the CANFD_FDF flag has been introduced in can.h the struct canfd_frame
can be used for CAN CC and CAN FD frames as a dual-use data structure.

Remove the extra maxdlen parameter in library calls and only use the
CANFD_FDF flag to differentiate the two CAN CC/FD frames.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-24 11:28:35 +01:00
Marc Kleine-Budde c6f4cbcaa7
Merge pull request #501 from gyatskov/master
Fix musl armv7 build: Include time.h in isobusfs_{cmn_dh,srv_cm}
2024-02-20 11:29:34 +01:00
Gennadij Sergej Yatskov 5bebe13cc1 Fixes musl build for ARMv7
See also 0e0a033
2024-02-20 11:06:13 +01: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 50e3d46b8b cmake: fix build of isobusfs tools
Reported-by: https://github.com/pschichtel
Link: https://github.com/linux-can/can-utils/issues/497
Fixes: 42edaeaf52 ("Implement ISOBUS File Server (FS) Interface as a Personal Project")
2024-02-19 09:45:30 +01:00
Marc Kleine-Budde 53ea0d0218
Merge pull request #499 from marckleinebudde/cleanups
Cleanups
2024-02-19 09:44:58 +01:00
Marc Kleine-Budde d4712c6c55 GNUmakefile: isobus: include scripts in tarball
Fixes: 42edaeaf52 ("Implement ISOBUS File Server (FS) Interface as a Personal Project")
2024-02-19 09:44:32 +01:00
Marc Kleine-Budde 8bdcccf1a1 GNumakefile: isobus: don't link against libj1939
Fixes: 42edaeaf52 ("Implement ISOBUS File Server (FS) Interface as a Personal Project")
2024-02-19 09:44:32 +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 9e57777ecd gitignore: ignore isobusfs dirstamp
Fixes: 42edaeaf52 ("Implement ISOBUS File Server (FS) Interface as a Personal Project")
2024-02-19 09:39:39 +01:00
Marc Kleine-Budde f5ba001bc9 gitignore: sort alphabetically
Fixes: 9c38c16437 ("can-calc-bit-timing: move into subdir")
2024-02-19 09:39:21 +01:00
Marc Kleine-Budde e4ba924b21 slcanpty: print_usage(): factor out help text into separate function
...and use single fprintf() call only.
2024-02-19 08:46:31 +01:00
Marc Kleine-Budde 7683efab41 slcanpty: convert towards kernel coding style 2024-02-19 08:45:55 +01:00
Marc Kleine-Budde 4c2f81f790 Makefile: sort alphabetically
Fixes: a9260eab76 ("Makefile: fix isobusfs tools build")
2024-02-19 08:43:36 +01:00
Phillip Schichtel 0e0a033993 Include time.h in lib.c
this fixes the build on android
2024-02-18 16:44:07 +01:00
Oliver Hartkopp 830a84019d isotprecv: add option to enable dynamic flow control parameters
New feature in Linux 6.9+

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-14 21:18:58 +01:00
Oliver Hartkopp 2643d28a57 slcanpty: silence warning for signed index for the buf array
slcanpty.c: In function ‘pty2can’:
slcanpty.c:105:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  105 |         buf[nbytes] = 0;
      |         ~~~~~~~~~~~~^~~
slcanpty.c:58:21: note: at offset [-2147483647, -1] into destination object ‘buf’ of size 200
   58 |         static char buf[200];
      |                     ^~~

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-14 21:03:11 +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
Oliver Hartkopp 8ba360ea31 include: update includes to Linux v6.9 upstream
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-02-14 20:18:29 +01:00
Marc Kleine-Budde 1a2992e15c
Merge pull request #496 from marckleinebudde/isobus
isobusfs_cmn: isobusfs_get_timeout_ms(): fix print on 32 bit archs
2024-02-13 16:15:38 +01:00