Commit Graph

582 Commits (1d3125bef2804e99bc3201102bbce73c7809c11b)

Author SHA1 Message Date
Oleksij Rempel 19d41bec45 jcat: allow to re-send rest of the buffer if we was interrupted
latest version of UAPI allows to continue sending on some signals.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2019-04-04 10:53:17 +02:00
Oleksij Rempel 48a4a4bef4 jcat: user recv() instead of recvfrom()
No information from recvfrom() is currently used. So, it is enough to
use plain recv().

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:45:33 +02:00
Oleksij Rempel b931fb514c jcat: add missing close of outfile and j1939 socket
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:45:33 +02:00
Oleksij Rempel 7192b0b9d7 jacd: set SO_BROADCAST
with latest UAPI version we should set this flag to be allowed to send
broadcast frames with broadcast destination address. Even if on CAN
every thing is a broadcast...

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:37:52 +02:00
Oleksij Rempel b8a2fa319a jacd: use sendto instead of send
Accordint to the new UAPI version, bind() with PGN set, should not be used
for destination PGN.

This change should work with new and old version of UAPI.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:37:49 +02:00
Oleksij Rempel 314f8a92ae j1939: use defines instead of magic values
for now cover most of PGN values.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:37:39 +02:00
Marc Kleine-Budde 06d3beb08c include: import header files from linux-5.0 (including new j1939 patches)
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-04-04 10:19:11 +02:00
Marc Kleine-Budde 83667e822c
Merge pull request #130 from marckleinebudde/testj1939
testj1939: use %zu to as format string to print sizeof()
2019-03-12 12:52:13 +01:00
Marc Kleine-Budde 9f60ed6fa0 testj1939: use %zu to as format string to print sizeof()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-03-12 12:37:27 +01:00
Marc Kleine-Budde e1d5ee9907
Merge pull request #129 from marckleinebudde/cleanup
This pull request cleans up the Makefile by sorting things alphabetically and adding a missing newline to the GNUmakefile.am.
2019-03-12 12:34:42 +01:00
Marc Kleine-Budde c59dff1bb1 NUmakefile.am: EXTRA_DIST: add missing \
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-03-12 12:02:44 +01:00
Marc Kleine-Budde 4a1818aa55 Makefile: cleanup
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-03-12 10:14:27 +01:00
Oliver Hartkopp b6cb9a04e5 cansend: enhance help text to point out SFF/EFF identifiers
As suggested by https://github.com/jogo- an example was added that points
out how to send a CAN frame with CAN ID 123 as SFF (11 bit) and EFF (29 bit).

Reference: https://github.com/linux-can/can-utils/issues/126

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2019-02-14 09:47:46 +01:00
Oliver Hartkopp 46d620b27c cansend: enhance help text for length info in RTR frames
In 'classic' CAN 2.0 the RTR frames contain a length information in the
can_dlc field of a CAN frame control section. This length can be passed
to 'cansend' which has not been documented in the help text so far.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2019-02-13 14:55:47 +01:00
Marc Kleine-Budde 2328c6cfa0
Merge pull request #119 from twasilczyk/master
Don't build libj1939 for Android
2019-01-14 14:48:48 +01:00
Marc Kleine-Budde e0277cc960
Merge pull request #122 from olerem/test
testj1939: split output string in to 8 byte strings
2019-01-14 10:03:42 +01:00
Marc Kleine-Budde 7b70a433cf
Merge pull request #121 from olerem/size
testj1939: fail if we use unsupported size
2019-01-14 10:03:34 +01:00
Oleksij Rempel 5551de5e56 testj1939: split output string in to 8 byte strings
Currently if we send lots of bytes, test1939 output will get unreadable.
Make it easier to read by splitting output dump.
New format will looks as following example:
root@DistroKit:~ testj1939 can0:0x90 -r
80 12300: 01 23 45 67 89 ab cd ef
00008     01 23 45 67 89 ab cd ef
00010     01 23 45 67 89 ab cd ef
00018     01 23 45 67 89 ab cd ef
00020     01 23 45 67 89 ab cd ef
00028     01 23 45 67 89 ab cd ef
00030     01 23 45 67 89 ab cd ef
00038     01 23 45 67 89 ab cd ef
00040     01 23 45 67 89 ab cd ef
00048     01 23 45 67 89 ab cd ef
00050     01 23 45 67 89 ab cd ef
00058     01 23 45 67 89 ab cd ef
00060     01 23 45 67 89 ab cd ef
00068     01 23 45 67 89 ab cd ef
00070     01 23 45 67 89 ab cd ef
00078     01 23 45 67 89 ab cd ef

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-14 09:19:51 +01:00
Oleksij Rempel ed5b495da6 testj1939: fail if we use unsupported size
Currently if we set size which is more then 128 byte
will silently ignore provided value and send only maximal
supported size.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-14 09:16:05 +01:00
Tomasz Wasilczyk 4da344b2aa Don't build j1939 for Android
This library uses if_nameindex symbol, not available at this system.
2019-01-10 12:03:06 -08:00
Oliver Hartkopp 8991b5c47d
Merge pull request #118 from twasilczyk/master
Silence false positive unaligned pointer access warning
2019-01-10 19:28:12 +01:00
Tomasz Wasilczyk f6e07960d3 Silence false positive unaligned pointer access warning
This is a warning coming up on Android (ARM) platform.
Clang 4.x creates a false positive here: the can_id is the first
(and aligned) value in the packed struct modattr, so it's always
aligned if the struct itself is aligned.
2019-01-10 10:04:37 -08:00
Marc Kleine-Budde 02b87eb120
Merge pull request #117 from olerem/jcat-fixup
jcat: inverse if logic
2019-01-04 14:43:25 +01:00
Oleksij Rempel 5b68a2cef1 jcat: inverse if logic
it was if(offset != NULL), so it should be if(offset)

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-04 14:40:07 +01:00
Marc Kleine-Budde 0083a3762b
Merge pull request #114 from olerem/jcat-2018.12.14
add jcat
2019-01-04 13:56:12 +01:00
Oleksij Rempel 23e5e227ac add jcat
jcat is kind of netcat for j1939
for example:
jcat can0:0x90 -r > /tmp/some_file

jcat -i some_file_to_send can0:0x80 :0x90,0x12300

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-04 13:01:11 +01:00
Oleksij Rempel e649b6ee2a libj1939: add libj1939_parse_canaddr and reuse it by testj1939
this function will be needed jcat

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-04 13:00:33 +01:00
Oliver Hartkopp c45a17e96b candump: try to switch bridge socket into CAN FD mode
When using the -b/-B option to send received CAN frames to the brigde interface
the sending failed when processing CAN FD frames. This patch enables CAN FD on
the socket for the bridging interface.

https://github.com/linux-can/can-utils/issues/104

Reported-by: https://github.com/jm3lee
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2018-10-24 09:36:55 +02:00
Oliver Hartkopp 8681e57230 candump: fix EFF CAN ID representation in CAN filter parameter
The documentation stated that the CAN ID is assumed to be an extended CAN
identifier (29 bit ID / EFF) when "can_id and can_mask are both 8 digits".
The check for the CAN ID length to be 8 is common in other CAN utils
(e.g. cansend) but it has never been implemented in candump.

This patch adds that check for EFF CAN IDs and clarifies the documentation.

Thanks to Nick for pointing out this inconsistency!

Reported-by: Nick Elmschig <nick@ikerobotics.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2018-10-23 21:22:11 +02:00
Marc Kleine-Budde 3f2bc6e1ea
Merge pull request #108 from nick-ike/candump-usage-typo
Fix CAN ID typo in candump usage, to 12345678
2018-10-09 00:02:58 +02:00
Nick Elmschig 371d8e6da4 Fix CAN ID in candump usage, should be 12345678 2018-10-08 13:26:15 -07:00
Marc Kleine-Budde 12664efa9f
Merge pull request #105 from marckleinebudde/cmake-cleanup
Cmake cleanup
2018-10-05 00:08:24 +02:00
Marc Kleine-Budde 04c171c285 CMakeLists.txt: build proper static libraries
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-10-04 23:55:54 +02:00
Marc Kleine-Budde 572a66fb94 CMakeLists.txt: clean up a bit
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-10-04 23:55:54 +02:00
Marc Kleine-Budde a6954bdaae CMakeLists.txt: Add missing N_SLCAN define 2018-10-04 23:55:54 +02:00
Marc Kleine-Budde 1c81f7fb2d
Merge pull request #100 from yegorich/fix-return-value-checks
Add missing return value checks
2018-09-27 12:57:16 +02:00
Marc Kleine-Budde 5b8145f63d
Merge pull request #99 from olerem/canfdtest-2018.09.18
Extend canfdtest to test proper RX and TX-ECHO order
2018-09-21 12:04:05 +02:00
Marc Kleine-Budde 3e4d589fec
Merge pull request #101 from olerem/testj1938
add bind related options to testj1939
2018-09-21 11:44:49 +02:00
Bastian Stender 54ff81cc40 testj1939: add omit bind option
This option is needed for j1939 socket functionality test.
Connects wihout bind should not work.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2018-09-21 11:31:22 +02:00
Bastian Stender 1ba9b86451 testj1939: add re-bind support
This option is needed for j1939 socket functionality test.
Binding to a socket and rebinding to the socket with e.g. a different SA
should work.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
2018-09-21 11:31:04 +02:00
Yegor Yefremov 1ce4dc7b39 Add missing return value checks
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2018-09-18 13:43:29 +02:00
Oleksij Rempel ba603c59ae canfdtest: test if TX and RX msg are properly ordered
In some cases we can get local TX echo after remote response
for same TXed message was already received.

For applications which relay on proper order of TXed and RXed
message this will be fatal.

With this patch the package generating side will test if TX and RX are
properly ordered.
Currently with following commands, this issue can be easily
reproducible:
canfdtest -g can0 &
while(true); do chrt 40 dd if=/dev/zero of=/dev/null count=10000; done

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2018-09-18 11:57:33 +02:00
Oleksij Rempel 18834410ac canfdtest: don't remap SIG to 0
Scripts can be configured to handle different SIGnals and
return codes in different ways. In this case it is better
to forward received signal, instead of converting it to return 0.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2018-09-18 11:57:33 +02:00
Marc Kleine-Budde 0ff988eeef
Merge pull request #97 from yegorich/travis-warnings
CI: treat gcc warnings as errors
2018-09-18 11:48:23 +02:00
Yegor Yefremov 55b0ba8308 CI: treat gcc warning as errors
For now exclude unused-result warnings in order not to
affect current builds.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2018-09-13 10:38:19 +02:00
Marc Kleine-Budde 7a4dd732af
Merge pull request #92 from marckleinebudde/improve-readme
Improve readme
2018-08-17 10:08:46 +02:00
Marc Kleine-Budde db7261d403 README: properly annotate codeblocks 2018-08-17 10:02:02 +02:00
Marc Kleine-Budde 6cedc8a5c6 README: remove stray bullet point 2018-08-17 10:02:02 +02:00
Marc Kleine-Budde d0c855c558 README: replace /home/joel by ~/ 2018-08-17 10:02:02 +02:00
Joel Winarske 8a3e0453aa CMake first pass (#90)
* CMake first pass

* canbusload dep fix

* Add Eclipse Debug, and Android Studio generation examples

* travis additions

* Update .travis.yml

CMAKE_BUILT_TYPE typo fix

* add android ndk variants(less mips)
2018-08-17 09:50:30 +02:00