Commit Graph

841 Commits (6e7f845a6886d69e14b6fb3796673dd1efd217e0)

Author SHA1 Message Date
Oliver Hartkopp 4ffb7fe5c7 isotp: added support for separate extended address in rx path
As requested by Laurent Vaudoit the extended address can be different in the
tx and he rx path:

(..) how can i have a segmented transfer like this:
0x6a7  0x55 0x10 0x08 ........
0x687  0xAA 0x30 0x00 0x00
0x6a7  0x55 0x21 .....

The connection i need is between two ECU, using IDs 0x6a7/687 and one has
adress extension 0x55, the other 0xAA (this adressing method is used on some
FIAT ECUs for example).

http://marc.info/?l=linux-can&m=140354647413513&w=2

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-11-16 20:38:31 +01:00
Oliver Hartkopp c517af5a0b isotpsend: add option to automatically create test data with specifc length
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-24 21:05:52 +02:00
Oliver Hartkopp 2fa9b0005b isotp[send|recv]: support PDU sizes greater than 4095
Allow PDU sizes greater than 4095 to be able to check the correct
implementation of the kernel socket API error handlings.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-24 20:41:11 +02:00
Urs Thuermann 0c61f2ac4c candump: fix off-by-one error in dropcount calculation
Calculations using unsigned integer types are done modulo U*INT_MAX+1,
so you get the correct difference of two values by simply subtracting.
No special handling for overflow is neccessary.

Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-23 19:27:09 +02:00
Oliver Hartkopp 9c5bfab229 isotp: fix copy paste error for isotp padding config
Thanks for the anonymous hint, Mr X ;-)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-23 19:07:54 +02:00
Alexander Stein 518faef3ac Add missing header canframelen.h to noinst_HEADERS
This is necessary so this header gets included when running make dist.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-07-08 09:18:12 +02:00
Andre Naujoks 7f24d6adf7 do not use --symlink for autoreconf
When packaging the can-utils, I understand, that the generation step for
autoconf should be done beforehand. However using the --symlink option in the
autoreconf step installs links instead of the actual files, which leads to a
build failure when trying to build on another host with different autotools
installed.

Signed-off-by: Andre Naujoks <nautsch2@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-07-02 16:03:34 +02:00
Marc Kleine-Budde 18f8416a40 cansniffer: increase resolution for timeout values
As requested by Felix Seitz the timeout for screen updates should be
configurable to values smaller than 100ms. Marc Kleine-Budde provided the
original patch to increase the resolution of the timing relevant variables.

The rotating animation was replaced by a rolling screen update counter.
Additionally the CAN-ID is now printed in the same ASCII hex representation
as the CAN data.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-06-24 21:36:55 +02:00
Oliver Hartkopp 53779e43eb candump: use UINT32_MAX define from stdint.h
Use the UINT32_MAX define from stdint.h instead of writing it into a comment.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-24 21:44:51 +02:00
Oliver Hartkopp 4a68366bac lib: optimize sprint_[long_]canframe()
Inspired by the SLCAN rework from Andre Naujoks this patch replaces the
extensive use of sprintf() with simple and efficient ASCII helpers.

valgrind/kcachegrind reported a cyle estimation of about 5.3 million cycles
before and about 1.5 million cycles after the rework (factor 3.55) for the
logging of the exact same CAN content.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-05 22:13:38 +02:00
Oliver Hartkopp 31ccf45dc4 candump: reduce printf calls for logfile format
The creation of the logfile format was using fprint_canframe() and two other
fprintf() calls to produce a single logfile format line. Instead of using
fprint_canframe() use sprint_canframe() directly and reduce the printf() calls
from three to one.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-05 21:29:56 +02:00
Wolfgang Grandegger 67a2bdcd33 can-calc-bit-timing: add a proper GNU license agreement
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-27 22:08:04 +01:00
Marc Kleine-Budde 7720e304fb configure: add checks for large file support (LFS)
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-26 19:49:15 +01:00
Oliver Hartkopp 57d9fcbf81 Makefile: add large file support (LFS)
Large file support (LFS) in recent C libraries allows 32 bit applications to
create large files with file length values > 0x7FFFFFFF when the filesystem
supports it.

This patch adds large file support to the Makefile, if you don't want LFS use
the autotools version and call configure like this:

    ./configure --disable-largefile

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-26 19:49:08 +01:00
Marc Kleine-Budde 733192a3d0 Makefile: move cpp related flags from CFLAGS to CPPFLAGS
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-26 19:25:11 +01:00
Oliver Hartkopp 110af11db1 canbusload: print bitstuffing mode when showing current time is enabled
When printing the current time on the first line the bitstuffing mode is
displayed depending on the command line settings.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-02-01 21:30:12 +01:00
Yegor Yefremov e4aac687eb slcand: include <sys/socket.h>
Linux build compiles without errors, but Android build
complains about undefined routines and macros.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-31 12:00:19 +01:00
Marc Kleine-Budde 02d32df1dc Android.mk: canbusload: fix compilation, make use of libcan
In commit

    2206f92 canbusload: Add exact CAN frame length calculation (including bitstuffing)

the function to calculate the can_frame_length was moved into a seperate file
(canframelen.c). This patch for the Android makefile adds canframelen.c to the
lib, too and lets canbusload link against the lib.

Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-31 11:52:20 +01:00
Michal Sojka f878a5fa2c Add license to canframelen.h
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-31 11:52:15 +01:00
Michal Sojka d6b576c012 canbusload: Fix worst-case frame length estimation
The Tindell's method used previously is incorrect. It does not account for
the fact that the stuffed bits are themselves also subject to bit stuffing.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-30 16:23:32 +01:00
Michal Sojka 2206f92de7 canbusload: Add exact CAN frame length calculation (including bitstuffing)
This adds an algorithm for calculating the exact number of bits a CAN
frame occupies on the bus and uses this algorithm in canbusload. It
also moves the other methods for CAN frame length calculation, already
present in canbusload, to the new file.

The added algorithm calculates the exact number of stuffed bit in a
CAN frame. Note that in order to calculate that correctly, we must
also know the frame's CRC. Hence, the algorithm also includes CRC
calculation routine.

The correctness of the algorithm was verified on an oscilloscope for
several different SFF and EFF frames.

Currently only CAN frames are supported. For CANFD frames, a different
algorithm is needed. CANFD uses different CRC polynomials and
calculates the CRC from the staffed bit-stream (CAN calculates CRC
from de-stuffed bit-stream).

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-30 16:23:25 +01:00
Uwe Kleine-König 4ddde7b966 trivial: fix typo concerning "bandwidth"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 21:25:15 +01:00
Oliver Hartkopp 111f8d3acf isotp: fix path mentioned in file
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-01-23 14:31:10 +01:00
Marc Kleine-Budde a51381e548 include: import copyright information from the kernel
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 14:22:43 +01:00
Marc Kleine-Budde 8d7a603c18 include: gw.h: update comment
This comment was added to the kernel in patch:

    391ac12 can: gw: add a per rule limitation of frame hops

The corresponding can-utils commit is:

    ad7f44095a (cangw: add an option for the per rule limitation of frame hops)

which somehow introduced the difference even though it referenced commit
391ac12.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 14:22:19 +01:00
Marc Kleine-Budde 9db35b68ef include: can.h: add typedef for __kernel_sa_family_t to make headers self-contained
This patch adds the typedef for __kernel_sa_family_t that was introduced in
Linux v3.1-rc2 (commit 6602a4b net: Make userland include of netlink.h more sane)
in <linux/socket.h>. It must be duplicated here to make the CAN headers
self-contained.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:57:29 +01:00
Marc Kleine-Budde fb5f0cca7d include: can.h: remove unused include of version.h
This patch remove the include of version.h, as it's not used and also not
present in the kernel headers.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:57:12 +01:00
Marc Kleine-Budde 08d2c63e00 include: fix paths mentioned in files
This patch fixes paths mentioned in the files which are wrong now, due the move
of the files in the previous patch.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:09 +01:00
Uwe Kleine-König ed7bc7d366 include: Move all includes from include/socketcan to include/linux
This makes it possible to import header from the kernel more easily, e.g.:

	cd $path_to_linux_repo
	make headers_install
	rsync -a --exclude .\* usr/include/linux/can* $path_to_can_utils/include/linux

[mkl: also move isotp.h although Uwe skipped it as it is not
      part of the upstream kernel; adapt commit log accordingly]

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:09 +01:00
Marc Kleine-Budde 7c05512317 include/socketcan: prepare headers to be moved to include/linux
This patch changes the include from the socketcan folder to the linux folder:

-#include <socketcan/can.h>
+#include <linux/can.h>

so that the socketcan folder can be eliminated in a later patch.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:08 +01:00
Uwe Kleine-König e18841ee53 isotp.h: add explicit license information
The copyright suggests to use the license used by the other files created by
Volkswagen.

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:08 +01:00
Uwe Kleine-König 5c163123e5 ioctl.h: drop unused header
This header doesn't exist in the Linux tree and it's unused by can-utils,
so drop it.

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:08 +01:00
Uwe Kleine-König a9dbbbc214 include: Remove two unused header files
These seem to have never been used. They entered can-utils in commit
77de10356f (include: import kernel header files into tree) and already
back then only consisted in an #include of a non-existing file.

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:48:07 +01:00
Yegor Yefremov 49801ea8a6 slcand: accept both tty* and /dev/tty* device names
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-23 13:46:19 +01:00
Marc Kleine-Budde 9c82d462f4 Android.mk: remove executable bit
This was added, probably by accident in commit:

    103fd96 can-utils: fix local header path for AOSP build

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-16 16:50:42 +01:00
Yegor Yefremov 393a91c7d8 slcand: reimplement daemonize routine
Replace daemonize() routine with daemone() system call, because of
conflicting licenses. daemonize() routine was derived from under
GNU Free Documentation License licensed code. This license is
incompatible with GPL-2+.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-16 16:31:50 +01:00
Yegor Yefremov 38fb68fb50 slcand: add flow control option
Add option '-t' to specify flow control type. Two types are
supported: 'hw' - RTS/CTS and 'sw' - XON/XOFF.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-16 16:31:50 +01:00
Yegor Yefremov c7aa0b7051 slcanpty: declare command buffer static
ASCII command buffer char buf[200] must be declared as static,
because it holds incomplete commands between pty2can() calls.
Without static it is not guaranteed, that buf retains the same
data between calls.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-16 16:31:50 +01:00
Brennan Ashton 31936b5a17 can-calc-bit-timing: fix MCP251x bit rate calculation
This patch adds the missing -1 to "bt->brp", as correctly used in the kernel
driver.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-06 10:35:45 +01:00
Oliver Hartkopp 61733e322a asc2log: inform about uninstalled locales at date conversion failures
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2013-11-28 16:12:17 +01:00
Kurt Van Dijck 75dfd666c4 testj1939: print API calls 2013-11-28 10:58:59 +01:00
Kurt Van Dijck 234729507e j1939.page: add relevant API calls 2013-11-28 09:56:54 +01:00
Kurt Van Dijck 7fb5f009fd j1939.page: restructure 2013-11-28 09:56:37 +01:00
Kurt Van Dijck 854f47fa84 testj1939: use send() when connect()ed
When using connect(), don't re-use the peername but use send() without
destination information
2013-11-20 11:21:07 +01:00
Kurt Van Dijck d66e6ce4ee testj1939: remember if peername was provided
When peername was not provided, the program uses send() rather than
sendto() so the API calls are better demonstrated
2013-11-20 11:21:07 +01:00
Kurt Van Dijck 77c08edead add .gitignore 2013-11-20 11:21:07 +01:00
Kurt Van Dijck 198c5801ec import sample program & help page 2013-11-20 11:14:44 +01:00
Kurt Van Dijck fe748b1c2c initial 2013-11-18 23:30:03 +01:00
Oliver Hartkopp 16c970d40e slcand: silence warning about set but unused variable
The dummyFile pointer was only needed to redirect stdxxx streams but it's
content was never used. Re-use the pFile pointer for this reason which is
unused at that point to silent the compiler warning about the set and unused
dummyFile variable.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2013-09-16 09:08:56 +02:00
Oliver Hartkopp 35d2bc1381 slcand: fix whitespace issues and unify coding style
Fixed coding style inspired by Linux checkpatch.pl
Additionally removed a comment in the write() result check in the 'if (speed)'
statement to make sure the write() is not optimized away as the executed code
was empty.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2013-09-15 21:54:37 +02:00