Commit Graph

768 Commits (f7307b829025d347c816ba4492d5319bc70a53ea)

Author SHA1 Message Date
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
Gary Bisson 46895a41c5 Fix comparison type mismatch warnings
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-28 20:54:37 +02:00
Oliver Hartkopp 2c87dcf468 can-utils: fix unused variable warnings
As pointed out by Gary Bisson clang complains about unused variables in
some valid cases.

Reported-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-28 19:32:20 +02:00
Marc Kleine-Budde 8df3d1dd3f
Merge pull request #205 from josemic/patch-2
Update j1939acd.c
2020-05-27 09:07:24 +02:00
josemic 255e360233
Update j1939acd.c
Minor change, as jacd had been renamed to j1939acd.
2020-05-26 23:11:33 +02:00
Oliver Hartkopp d91288f754 README: cansniffer is now also 29 bit CAN ID capable
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-11 15:26:05 +02:00
Oliver Hartkopp 9b75c6020f asc2log: support milliseconds resolution in date/time string
While strptime() does not support fractions of seconds in the date/time
string some new asc files support the milliseconds resolution.

When detecting this new format the msecs are retrieved by a separate
sscanf() invocation and added to the timeval's tv_usec element.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 19:22:53 +02:00
Oliver Hartkopp 41c8ead6c0
Rework for CAN FD support and fixes for asc to log file conversion tools
Detailed change log:

log2asc:
- support CAN FD tags and Classic CAN frames
- support RTR frames including DLC values
- new option '-r' disable the RTR DLC value for potential compatibility reasons
- new option '-f' to use the CANFD format for Classic CAN too

asc2log:
- support CAN FD tags and Classic CAN frames
- be robust against fractions of seconds in date/time string
- fix reading of RTR frames including DLC values in Classic CAN parsing
- fix date/time string detection

cangen:
- new option '-E' to support ESI bit for CAN FD frame generation
(was needed for reference log file generation)
2020-05-10 16:45:21 +02:00
Oliver Hartkopp 3bb659d18d asc2log: fix handling for RTR frames in Classic CAN mode
Fix reading of the RTR representation without and with DLC (v8.5+ tools).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 15:09:55 +02:00
Oliver Hartkopp 9cde2ebe8f asc2log: fix date string detection
The former check was too complex and did not catch all valid cases.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 14:41:34 +02:00