Commit Graph

701 Commits (c3348ed51ec2fe38cb551ab23b2c1e4d693f65fe)

Author SHA1 Message Date
Oliver Hartkopp 5e713b3ee0 cansniffer: remove obsolete semicolons
Silence compiler warning.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-10-13 10:16:52 +02:00
Oliver Hartkopp 5d5ccf38ee fix include order and unify local include placement
In commit https://github.com/linux-can/can-utils/commit/b153fe3f3591
("clang-tidy: sort includes alphabetically") the position of the "lib.h"
include has been moved in a way that struct canfd_frame has not been
defined anymore and lead to a warning when compiling cangen.c

This patch reverts that specific move and unifies the location of local
includes at the end of the include list.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-10-13 10:03:19 +02:00
Marc Kleine-Budde bda4b0ad8c
Merge pull request #251 from neheb/clng
custom if statement reordering
2020-10-13 08:55:34 +02:00
Rosen Penev f766174677
custom if statement reordering
It makes more sense to return before hitting else.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:48:38 -07:00
Marc Kleine-Budde 7759b00c58
Merge pull request #250 from neheb/clng
clang-tidy fixes
2020-10-13 08:44:49 +02:00
Rosen Penev 48bb69bc7b
remove basic usages of memset with {}
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Rosen Penev b153fe3f35
clang-tidy: sort includes alphabetically
Found with llvm-include-order

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Rosen Penev 3e85fc5422
clang-tidy: fix cmp function usage
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Rosen Penev 33f3593436
clang-tidy: use uppercase literal
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:57 -07:00
Rosen Penev 3e67b5cbd1
clang-tidy: remove pointless return
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:57 -07:00
Rosen Penev d5320d554e
clang-tidy: fix wrong identation
Found with readability-misleading-indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:57 -07:00
Rosen Penev 17a5fe6022
clang-tidy: do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:22 -07:00
Marc Kleine-Budde 5a93509655
Merge pull request #249 from neheb/nanosleep
convert usleep to nanosleep
2020-10-12 08:48:33 +02:00
Rosen Penev d7df79e687
convert usleep to nanosleep
usleep is removed in POSIX 2008.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-11 23:35:31 -07:00
Marc Kleine-Budde 18573d1dd2
Merge pull request #248 from neheb/bzr
j1939cat: remove bzero
2020-10-12 08:12:05 +02:00
Rosen Penev 8d2ed4c959
j1939cat: remove bzero
bzero is removed in POSIX 2008. malloc/bzero can also be replaced with
calloc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-11 22:02:23 -07:00
zeljkoavramovic c27c61424f
can utils [can-j1939-install-kernel-module.md]: better explanation for adding backports, fixed typos and grammar (#247)
* Add tutorial how to compile kernel with can-j1939 module

* cosmetic changes

* improvement by adding debian backports to separate sources list

* better explanation for adding backports

* fixed typos

* fixed grammar

* improvement by adding debian backports to separate sources list

* better explanation for adding backports

* fixed typos

* fixed grammar

Co-authored-by: Zeljko Avramovic <avr0833@zelsd.rs>
2020-10-06 15:33:57 +02:00
zeljkoavramovic 194959270f
Added tutorial how to compile kernel with can-j1939 module (#246)
Add tutorial how to compile kernel with can-j1939 module
2020-10-05 16:15:08 +02:00
Oliver Hartkopp f6d963b5d9 isotpsend: add support for blocking write flag
With the new flag 'CAN_ISOTP_WAIT_TX_DONE' the send()/write() syscall returns
when the PDU is completely passed to the CAN netdevice queue. Depending on
STmin and other settings for the tx-queue-len this does not necessarily mean
that the PDU has been completely sent on the CAN interface at that time.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-10-01 20:42:50 +02:00
Marc Kleine-Budde 485d813545
Merge pull request #244 from marckleinebudde/canfdtest-check-device
canfdtest: bail out if trying to use non-existing CAN interface
2020-09-29 09:14:29 +02:00
Marc Kleine-Budde ce7f22928d canfdtest: bail out if trying to use non-existing CAN interface
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-29 09:06:12 +02:00
Marc Kleine-Budde dd8fb0b697
Merge pull request #241 from marckleinebudde/travis
travis: fix indention
2020-09-25 15:33:55 +02:00
genisysram b7ba7f32fc added script to run on power 2020-09-25 15:33:00 +02:00
Marc Kleine-Budde b99f540039 travis: add architecture marker
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-25 15:33:00 +02:00
Marc Kleine-Budde 7fb2585641 travis: fix indention
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-25 15:24:25 +02:00
Marc Kleine-Budde e1f75da433
Merge pull request #240 from marckleinebudde/canfdtest
canfdtest: remove trailing whitespace and print RX'ed frame in case of RX before TX
2020-09-24 11:27:10 +02:00
Marc Kleine-Budde 435a59a394 canfdtest: can_echo_gen(): print RX'ed frame in case of RX before TX
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-24 11:13:41 +02:00
Marc Kleine-Budde 73e421557f canfdtest: remove trailing whitespace
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-09-24 11:13:38 +02:00
Oleksij Rempel ea844bdc5e Document J1939 commands
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-08-21 16:11:41 +02:00
Marc Kleine-Budde e6dfcb773e
Merge pull request #237 from marckleinebudde/fix-canfdtest
canfdtest: fix frame consistency check
2020-08-20 09:33:11 +02:00
Marc Kleine-Budde c43a168c68 canfdtest: fix frame consistency check
This patch fixes the issue reported in:

d7f28a0ffe
https://github.com/linux-can/can-utils/issues/236

Reported-by: https://github.com/ronitnvidia
Fixes: d7f28a0ffe ("canfdtest: can_echo_dut(): check received frame for consistency")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-08-20 09:30:27 +02:00
Oliver Hartkopp 7cb3e760fe logfile: add new extra info field
This patch adds a fourth string field in the can logfile format.
This new field contains the rx/tx direction information R/T as the
first entry (only one character separated from the CAN frame by space).

To generate the logfile format with this extra field candump has to be
called with the '-x' option for extra message infos,
e.g. 'candump -x -l can0' or 'candump -x -L can0'

log2asc and asc2log are extended to support the direction information
but still support the previous format without direction information.

The format extension does not affect legacy tools, e.g. the existing
canplayer ignores this extra information and does not need to be changed.

Therefore the existing logfiles remain valid and usable.

The extra message infos will be colon separated when there's need for
additional content beyond the rx/tx direction information, e.g. R:xx:yyy

Suggested-by: Pallavi Revanna https://github.com/brpallu
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-08-18 13:29:36 +02:00
Oliver Hartkopp a4905ed7c8 fix timeval to ASCII unsigned value conversion
As reported by Oleksij Rempel here
https://github.com/linux-can/can-utils/issues/233#issuecomment-674818935
the representation of timeval timestamps are signed values which leads to
negative values on 32 bit machines addressing the year 2038 unix sec counter
overflow.

Fix the issue on 32 bit systems by converting the timeval values to unsigned
ASCII value representations.

Fixes: https://github.com/linux-can/can-utils/issues/234
Reported-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-08-18 12:51:35 +02:00
Marc Kleine-Budde ab23c6f7e7
Merge pull request #232 from olerem/testj1939
testj1939: print proper offset in the data damp
2020-08-07 15:06:36 +02:00
Oleksij Rempel c912d6f8d5 testj1939: print proper offset in the data damp
without this patch we will always print "0008" on each line

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-08-07 15:01:43 +02:00
Marc Kleine-Budde 58dc257e11
Merge pull request #231 from olerem/jcat-bam
j1939cat: add broadcast support
2020-08-07 14:23:46 +02:00
Oleksij Rempel 327587b2c8 j1939cat: add broadcast support
Allow to use j1939cat to send and receive broadcast (TP.BAM) messages.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-08-07 14:14:38 +02:00
Marc Kleine-Budde 659e0acfe6
Merge pull request #230 from marckleinebudde/j1939acd
j1939acd help text improvements
2020-08-07 14:10:29 +02:00
josemic 88ad7e5755 j1939acd: add example showing optional interface parameter
Changed j1939acd help examples by adding one example showing optional interface
parameter.
2020-08-07 14:01:34 +02:00
josemic 112421dc22 j1939acd: fix help examples
Changed j1939acd help examples by removing duplicate example.

Fixes: 506252e9bc ("jacd.c: Reformat help/usage output to be compatible with help2man.")
2020-08-07 14:00:57 +02:00
Marc Kleine-Budde dec3c5eda1
Merge pull request #225 from marckleinebudde/fix-warnings
Fix warnings
2020-08-07 13:53:48 +02:00
Marc Kleine-Budde bad90515f0
Merge pull request #229 from joseogandoj/patch-1
Update testj1939.c
2020-07-31 08:21:17 +02:00
joseogandoj da87d595c5
Update testj1939.c
When receiving multi chunk messages, only the first 8 are printed.

Simple coding mistake. Should print dat[i] instead of dat[j]
2020-07-30 16:21:45 -05:00
Göran Mannberg af531c3d52 Update Android.mk
Fixed typo in LOCAL_MODULE isotpsniffer
2020-07-06 08:47:35 +02:00
Marc Kleine-Budde 8e3c050b1c CMakeLists.txt: update test for _GNU_SOURCE to fix warnings
../asc2log.c:264:8: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
        ptr = strcasestr(buf, tmp1);
              ^
../asc2log.c:264:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
        ptr = strcasestr(buf, tmp1);
            ^ ~~~~~~~~~~~~~~~~~~~~~
../asc2log.c:328:6: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
        if (strcasestr(date, " pm ") != NULL) {
            ^
../asc2log.c:328:31: warning: comparison between pointer and integer ('int' and 'void *') [-Wpointer-integer-compare]
        if (strcasestr(date, " pm ") != NULL) {
            ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
../asc2log.c:336:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
                if (!strptime(date, "%B %d %I:%M:%S %p %Y", &tms)) {
                     ^
../asc2log.c:354:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
                if (!strptime(date, "%B %d %H:%M:%S %Y", &tms)) {

../slcanpty.c:476:7: warning: implicit declaration of function 'grantpt' is invalid in C99 [-Wimplicit-function-declaration]
                if (grantpt(p) < 0) {
                    ^
../slcanpty.c:481:7: warning: implicit declaration of function 'unlockpt' is invalid in C99 [-Wimplicit-function-declaration]
                if (unlockpt(p) < 0) {
                    ^
../slcanpty.c:486:14: warning: implicit declaration of function 'ptsname' is invalid in C99 [-Wimplicit-function-declaration]
                name_pts = ptsname(p);
                           ^
../slcanpty.c:486:12: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
                name_pts = ptsname(p);
                         ^ ~~~~~~~~~~

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-29 18:20:18 +02:00
Marc Kleine-Budde a5c049d37a slcanpty: add missing include sys/select.h
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-29 18:20:18 +02:00
Marc Kleine-Budde 57949154cc slcanpty: sort includes alphabetically
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-29 18:20:11 +02:00
Marc Kleine-Budde 24b73044c5
Merge pull request #224 from marckleinebudde/canfdtest
Canfdtest
2020-06-29 18:18:18 +02:00
Marc Kleine-Budde b29a75d4c6 j1939cat: j1939cat_parse_args(): fix warning
although it looks like a false positive:

/home/travis/build/linux-can/can-utils/j1939cat.c: In function ‘main’:
/home/travis/build/linux-can/can-utils/j1939cat.c:648:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int ret;
      ^

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 12:41:48 +02:00
Marc Kleine-Budde 0f9c69c193 can-calc-bit-timing: fix warning
although it looks like a false positive:

/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c: In function ‘print_bit_timing.isra.6’:
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:42: warning: ‘tseg2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  unsigned int brp, tsegall, tseg, tseg1, tseg2;
                                          ^
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:35: warning: ‘tseg1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  unsigned int brp, tsegall, tseg, tseg1, tseg2;
                                   ^

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 12:41:48 +02:00