Commit Graph

1184 Commits (24e0c520b680108b1acd9021f918ca598ccb389e)

Author SHA1 Message Date
Marc Kleine-Budde 4d16dc867d bcmserver: remove trailing whitespace 2024-05-26 16:57:25 +02:00
Marc Kleine-Budde 6c893e5c4f
Merge pull request #531 from yegorich/ignore-tags
Ignore ctags generated tags file
2024-05-26 16:26:08 +02:00
Marc Kleine-Budde 7b6daa3aca
Merge pull request #532 from yegorich/cmake-fixes
Cmake fixes
2024-05-26 16:23:31 +02:00
Yegor Yefremov 0e4c2d35f2 CMakeLists.txt: print the detected CMake version
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2024-05-26 15:22:37 +02:00
Yegor Yefremov 3b5593f499 CMakeLists.txt: bump the minimum required version to 3.5
CMake versions prior to 3.5 are regarded as deprecated and will cause
an error on recent CMake versions.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2024-05-26 15:20:45 +02:00
Yegor Yefremov 2a93b10057 Ignore ctags generated tags file
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2024-05-26 12:51:33 +02:00
Marc Kleine-Budde b76bb3f66c
Merge pull request #530 from olerem/isobusfs-fixes
Isobusfs fixes
2024-05-25 19:23:53 +02:00
Oleksij Rempel 06ab86226a isobusfs_srv_cm: do not try to add padding beyond the buffer
The memset in isobusfs_srv_volume_status_resp() was attempting to make a
padding beyond the buffer. Fix it.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-25 07:57:16 +02:00
Oleksij Rempel fc742c574e isobusfs_srv_cm: make sure we do le16toh/htole16 conversation for name_len
name_len is __le16. We need always convert it to host byte order.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-25 07:57:16 +02:00
Oleksij Rempel 1e8bc8fd34 isobusfs: do not kill application on error_queue error
Kernel may notify us about some error, which may happens if the bus was
in the error state. But this is not a good reason to kill application,
especially the server side.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-25 07:57:16 +02:00
Marc Kleine-Budde d05810f5fe
Merge pull request #522 from SECloudUNIMORE/pr-usage
Refactor the help/usage message for canplayer
2024-05-15 15:26:36 +02:00
GZZ8 23648c8a31
Refactor the help/usage message for canplayer
Limit the error return value only to unknown options.
If the utility is invoked with the help option '-h',
display the usage message and exit successfully.

Co-authored-by: Filip Valgimigli <filip.valgimigli@unimore.it>
Signed-off-by: Filip Valgimigli <filip.valgimigli@unimore.it>
2024-05-14 19:19:35 +02:00
Marc Kleine-Budde 185c14f464
Merge pull request #519 from marckleinebudde/can-calc-bit-timing-fix-option-parsing
can-calc-bit-timing: in case of invalid option exit with error
2024-05-07 15:34:31 +02:00
Marc Kleine-Budde 4a9c00539b can-calc-bit-timing: in case of invalid option exit with error
Link: https://github.com/linux-can/can-utils/issues/518
Reported-by: https://github.com/EnricoMontecaggi
Fixes: f4a9e5b57d ("can-calc-bit-timing.c: Reformat help/usage output to be compatible with help2man.")
2024-05-07 15:21:39 +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 30a46d72bd
Merge pull request #510 from olerem/clang-fixes
isobusfs: fix clang warnings
2024-03-22 11:09:11 +01:00
Oleksij Rempel 91a93353ae isobusfs: fix clang warnings
Fix following clang warnings:
  CC       isobusfs/isobusfs_srv_fa.o
  isobusfs/isobusfs_srv_fa.c:387:6: warning: variable 'handle' is used
  uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (ret < 0) {
            ^~~~~~~
  isobusfs/isobusfs_srv_fa.c:411:15: note: uninitialized use occurs here
        res.handle = handle;
                     ^~~~~~
  isobusfs/isobusfs_srv_fa.c:387:2: note: remove the 'if' if its condition is
  always false
        if (ret < 0) {
        ^~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:368:6: warning: variable 'handle' is used
  uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (name_len > ISOBUSFS_MAX_PATH_NAME_LENGTH) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:411:15: note: uninitialized use occurs here
        res.handle = handle;
                     ^~~~~~
  isobusfs/isobusfs_srv_fa.c:368:2: note: remove the 'if' if its condition is
  always false
        if (name_len > ISOBUSFS_MAX_PATH_NAME_LENGTH) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:362:6: warning: variable 'handle' is used
  uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (name_len > msg->len - sizeof(*req)) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:411:15: note: uninitialized use occurs here
        res.handle = handle;
                     ^~~~~~
  isobusfs/isobusfs_srv_fa.c:362:2: note: remove the 'if' if its condition is
  always false
        if (name_len > msg->len - sizeof(*req)) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:356:6: warning: variable 'handle' is used
  uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (!client) {
            ^~~~~~~
  isobusfs/isobusfs_srv_fa.c:411:15: note: uninitialized use occurs here
        res.handle = handle;
                     ^~~~~~
  isobusfs/isobusfs_srv_fa.c:356:2: note: remove the 'if' if its condition is
  always false
        if (!client) {
        ^~~~~~~~~~~~~~
  isobusfs/isobusfs_srv_fa.c:352:16: note: initialize the variable 'handle' to
  silence this warning
        uint8_t handle;
                      ^
                       = '\0'
  isobusfs/isobusfs_srv_fa.c:505:9: warning: variable 'entry_count' set but not
  used [-Wunused-but-set-variable]
        size_t entry_count = 0;
               ^
  5 warnings generated.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-03-22 10:44:17 +01:00
Marc Kleine-Budde bbd48cb150
Merge pull request #509 from marckleinebudde/mcp251xfd-regmap-fix-compiler-warning
mcp251xfd-regmap: do_mcp251xfd_regmap_read(): fix compiler warning in a more straight forward way
2024-03-19 13:05:06 +01:00
Marc Kleine-Budde 95f12594a6 mcp251xfd-regmap: do_mcp251xfd_regmap_read(): fix compiler warning in a more straight forward way
Link: d294cd928c (r139957294)
Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-19 13:01:46 +01:00
Marc Kleine-Budde 8c94f3f72a
Merge pull request #508 from marckleinebudde/mcp251xfd-regmap-fix-compiler-warning
mcp251xfd-regmap: fix compiler warning
2024-03-19 11:45:32 +01:00
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 001b230b10 cangen: initialize reserved struct CAN(FD) frame elements
With 'cansend' and other tools the reserved elements are set to zero.
Fix this missing initialization in 'cangen'.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2024-03-18 12:35:29 +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