Commit Graph

727 Commits (ef8cea79f0546a3df973a768cc8d97d22ef5c935)

Author SHA1 Message Date
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
Marc Kleine-Budde 13ecaa6d7e canfdtest: make number of frames in flight a command line option
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:59:35 +02:00
Marc Kleine-Budde d7f28a0ffe canfdtest: can_echo_dut(): check received frame for consistency
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde e393697112 canfdtest: can_echo_dut(): move functionality to increment frame data into separate function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde 645cd1b1ba canfdtest: can_echo_dut(): make use of print_frame() instead of open coding it
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde aa5386f1cb canfdtest: print_frame(): add missing cast to uint8_t to avoid overruns
While there, use cast in compare_frame(), too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:48 +02:00
Marc Kleine-Budde ff3d0e0d05 canfdtest: print_frame()/print_compare(): mark parameters "struct can_frame *" as const
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:38:17 +02:00
Marc Kleine-Budde 29605e3314 canfdtest: compare_frame(): remove stray space in front of "!"
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:26:03 +02:00
Marc Kleine-Budde d92adf68e8 canfdtest: main(): remove double ";"
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-22 11:25:21 +02:00
Marc Kleine-Budde 063e361cc5
Merge pull request #194 from marckleinebudde/canfdtest-initialize-tx_frames
canfdtest: can_echo_gen(): initialize tx_frames with zero
2020-06-17 12:53:32 +02:00
Marc Kleine-Budde e9e1a02085
Merge pull request #223 from marckleinebudde/jacd
j1939acd: replace 0x0fed8 by constant J1939_PGN_ADDRESS_COMMANDED
2020-06-17 12:51:32 +02:00
Marc Kleine-Budde 19b3ffe34b j1939acd: replace 0x0fed8 by constant J1939_PGN_ADDRESS_COMMANDED
Reported-by: josemic <josemic@users.noreply.github.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-06-17 12:37:30 +02:00
Marc Kleine-Budde 6553ccaf06
Merge pull request #221 from josemic/patch-4
Changed hardcoded hex number 0x0fed8 to j1939.h constant "J1939_PGN_ADDRESS_COMMANDED"
2020-06-17 12:34:51 +02:00
josemic 1b5d3adbe5
Changed hardcoded hex number 0x0fed8 to j1939.h constant "J1939_PGN_ADDRESS_COMMANDED"
Use include constant instead of hardcoded constant
2020-06-17 10:54:46 +02:00
Marc Kleine-Budde e15b044a1d
Merge pull request #220 from olerem/j1939acd-verbose
J1939acd verbose
2020-06-16 14:35:57 +02:00
Oliver Hartkopp 669fa79b21 j1939: Fix arithmetic on a pointer warning
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 43610bd621 ("Fix arithmetic on a pointer warning") from
Gary Bisson.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-12 20:08:18 +02:00
Oliver Hartkopp 75d9c7e95f j1939: Fix comparison type mismatch warnings
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 46895a41c5 ("Fix comparison type mismatch warnings") from
Gary Bisson.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-12 20:08:18 +02:00
Oliver Hartkopp 85ae5aaecf j1939acd: fix unused variable warning
open_socket() has a parameter to provide a network device name which
is properly assigned by its callers to s.intf in main().
Instead of using the callers value open_socket() directly accesses the
global s.intf which generates an unused variable warning with clang.

Fix this by using the provided parameter (no functional change).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-12 20:08:18 +02:00
Oleksij Rempel 1f5c9638ab j1939acd: unify debug messages
Most of verbose messages are already stderr, make sure, rest of them do
the same.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-06-12 14:37:22 +02:00
Oleksij Rempel 1d3125bef2 j1939acd: do not exit on debug messages
Some debug messages were implemented using err(), which does not return,
but exit the program. This patches replaces the debug messages by
fprintf(stdout, ).

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-06-12 14:24:58 +02:00
Oliver Hartkopp 62f995601e Android.mk: Introduce LOCAL_VENDOR_MODULE to build in AOSP tree
Change path for canutils modules from system/bin to vendor/bin in the
case of building in AOSP tree.

https://github.com/linux-can/can-utils/pull/204

Suggested-by: Pavel Salomatov https://github.com/PsycheEYE
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-04 18:02:10 +02:00
Oliver Hartkopp 647210ee1c Android.mk: Add missing targets
The J1939 tools and asc2log was missing in the Android build.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-04 18:02:10 +02:00
josemic eac93ced80 can-j1939-kickstart.md: fix example in documentation 2020-05-30 19:32:32 +02:00
Gary Bisson da42cf4bb5 Android.mk: fix Android 10 build
Android now uses clang with Werror by default which prevents from
building.
Removing Werror for the current warnings.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-29 17:58:23 +02:00
Gary Bisson 43610bd621 Fix arithmetic on a pointer warning
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-28 20:54:37 +02:00