]> rtime.felk.cvut.cz Git - can-utils.git/log
can-utils.git
9 years agoisotpperf: print link layer data length of measured PDU
Oliver Hartkopp [Mon, 23 Feb 2015 09:37:13 +0000 (10:37 +0100)]
isotpperf: print link layer data length of measured PDU

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotpperf: display bitrate setting status in summary
Oliver Hartkopp [Mon, 23 Feb 2015 09:22:59 +0000 (10:22 +0100)]
isotpperf: display bitrate setting status in summary

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotpperf: fix printed FC STMin value
Oliver Hartkopp [Mon, 23 Feb 2015 09:03:12 +0000 (10:03 +0100)]
isotpperf: fix printed FC STMin value

Additionally remove the already removed -f option from the help text.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agocan-utils: added isotpperf tool for performance measurements
Oliver Hartkopp [Wed, 4 Feb 2015 09:17:38 +0000 (10:17 +0100)]
can-utils: added isotpperf tool for performance measurements

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agouse line discipline number from linux/tty.h
Jeremiah Mahler [Fri, 19 Dec 2014 15:22:19 +0000 (07:22 -0800)]
use line discipline number from linux/tty.h

The line discipline number is provided in include/linux/tty.h.
Use that instead of a #define in each program.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoslcand: consistent use of exit(EXIT_FAILURE)
Jeremiah Mahler [Fri, 19 Dec 2014 15:22:18 +0000 (07:22 -0800)]
slcand: consistent use of exit(EXIT_FAILURE)

Some places used exit(1) and others used exit(EXIT_FAILURE).
Be consistent and use exit(EXIT_FAILURE) for all of these instances.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoslcand: remove #define EXIT_FAILURE, EXIT_SUCCESS
Jeremiah Mahler [Fri, 19 Dec 2014 15:22:17 +0000 (07:22 -0800)]
slcand: remove #define EXIT_FAILURE, EXIT_SUCCESS

slcand has #defines for EXIT_FAILURE and EXIT_SUCCESS but this is
unnecessary since they are already provided by stdlib.h.  Remove them.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoslcand: improve usage examples
Jeremiah Mahler [Fri, 19 Dec 2014 15:22:16 +0000 (07:22 -0800)]
slcand: improve usage examples

The examples in the usage of slcand use a 'ttyslcan0' device which
is an uncommon name.  Use a more common ttyUSB0 name which is seen
with CANUSB devices.  Also, add an example showing that /dev/ttyUSB0
can be use as well.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agolib: Update error messages according to new state change handling
Andri Yngvason [Thu, 18 Dec 2014 12:58:24 +0000 (13:58 +0100)]
lib: Update error messages according to new state change handling

This patch updates the error messages for the reworked state change handling
from Andri Yngvason you find in mainline Linux 3.19+

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp[server|tun]: update padding and CAN FD features
Oliver Hartkopp [Sun, 23 Nov 2014 11:15:57 +0000 (12:15 +0100)]
isotp[server|tun]: update padding and CAN FD features

Update padding and CAN FD features according to the latest isotpsend and
isotprecv changes.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp[send|recv]: change command line option for padding bytes
Oliver Hartkopp [Thu, 20 Nov 2014 22:13:37 +0000 (23:13 +0100)]
isotp[send|recv]: change command line option for padding bytes

Allow to specify the TX and RX padding content separately.
Due to the optional values it is possible to provide either TX or RX values
which enables and set the given values.

-p 55:AA => TX padding 0x55, RX padding 0xAA
-p 55    => TX padding 0x55
-p 55:   => TX padding 0x55
-p :AA   => RX padding 0xAA

Additionally the comment for the -P <mode> option was updated to point out the
checking mode of the padding in the received PDUs (rx padding).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp[send|recv]: change command line option for extended addressing
Oliver Hartkopp [Wed, 19 Nov 2014 19:44:41 +0000 (20:44 +0100)]
isotp[send|recv]: change command line option for extended addressing

Enable to pass the optional second extended address with the '-x' option and
do not pollute the command line options with just another '-X' option.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp: add tool support for ISO 15765-2:2015 with CAN FD
Oliver Hartkopp [Sun, 16 Nov 2014 21:24:04 +0000 (22:24 +0100)]
isotp: add tool support for ISO 15765-2:2015 with CAN FD

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotpdump: add support for FF_DL escape sequence for 32 bit PDU length
Oliver Hartkopp [Sun, 16 Nov 2014 21:14:02 +0000 (22:14 +0100)]
isotpdump: add support for FF_DL escape sequence for 32 bit PDU length

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp: added support for separate extended address in rx path
Oliver Hartkopp [Sun, 16 Nov 2014 19:38:31 +0000 (20:38 +0100)]
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>
9 years agoisotpsend: add option to automatically create test data with specifc length
Oliver Hartkopp [Fri, 24 Oct 2014 19:05:52 +0000 (21:05 +0200)]
isotpsend: add option to automatically create test data with specifc length

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoisotp[send|recv]: support PDU sizes greater than 4095
Oliver Hartkopp [Fri, 24 Oct 2014 18:41:11 +0000 (20:41 +0200)]
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>
9 years agocandump: fix off-by-one error in dropcount calculation
Urs Thuermann [Thu, 23 Oct 2014 17:23:00 +0000 (19:23 +0200)]
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>
9 years agoisotp: fix copy paste error for isotp padding config
Oliver Hartkopp [Thu, 23 Oct 2014 17:07:54 +0000 (19:07 +0200)]
isotp: fix copy paste error for isotp padding config

Thanks for the anonymous hint, Mr X ;-)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoAdd missing header canframelen.h to noinst_HEADERS
Alexander Stein [Tue, 8 Jul 2014 06:34:38 +0000 (08:34 +0200)]
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>
9 years agodo not use --symlink for autoreconf
Andre Naujoks [Wed, 2 Jul 2014 12:12:58 +0000 (14:12 +0200)]
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>
9 years agocansniffer: increase resolution for timeout values
Marc Kleine-Budde [Tue, 24 Jun 2014 19:16:48 +0000 (21:16 +0200)]
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>
9 years agocandump: use UINT32_MAX define from stdint.h
Oliver Hartkopp [Sat, 24 May 2014 19:44:51 +0000 (21:44 +0200)]
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>
10 years agolib: optimize sprint_[long_]canframe()
Oliver Hartkopp [Mon, 5 May 2014 20:13:38 +0000 (22:13 +0200)]
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>
10 years agocandump: reduce printf calls for logfile format
Oliver Hartkopp [Mon, 5 May 2014 19:29:56 +0000 (21:29 +0200)]
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>
10 years agocan-calc-bit-timing: add a proper GNU license agreement
Wolfgang Grandegger [Thu, 27 Feb 2014 20:56:26 +0000 (21:56 +0100)]
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>
10 years agoconfigure: add checks for large file support (LFS)
Marc Kleine-Budde [Wed, 26 Feb 2014 18:10:11 +0000 (19:10 +0100)]
configure: add checks for large file support (LFS)

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
10 years agoMakefile: add large file support (LFS)
Oliver Hartkopp [Fri, 21 Feb 2014 20:21:04 +0000 (21:21 +0100)]
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>
10 years agoMakefile: move cpp related flags from CFLAGS to CPPFLAGS
Marc Kleine-Budde [Wed, 26 Feb 2014 18:16:10 +0000 (19:16 +0100)]
Makefile: move cpp related flags from CFLAGS to CPPFLAGS

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
10 years agocanbusload: print bitstuffing mode when showing current time is enabled
Oliver Hartkopp [Sat, 1 Feb 2014 20:30:12 +0000 (21:30 +0100)]
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>
10 years agoslcand: include <sys/socket.h>
Yegor Yefremov [Fri, 31 Jan 2014 10:54:09 +0000 (11:54 +0100)]
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>
10 years agoAndroid.mk: canbusload: fix compilation, make use of libcan
Marc Kleine-Budde [Fri, 31 Jan 2014 10:21:00 +0000 (11:21 +0100)]
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>
10 years agoAdd license to canframelen.h
Michal Sojka [Fri, 31 Jan 2014 10:39:26 +0000 (11:39 +0100)]
Add license to canframelen.h

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
10 years agocanbusload: Fix worst-case frame length estimation
Michal Sojka [Thu, 30 Jan 2014 13:38:59 +0000 (14:38 +0100)]
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>
10 years agocanbusload: Add exact CAN frame length calculation (including bitstuffing)
Michal Sojka [Thu, 30 Jan 2014 13:38:58 +0000 (14:38 +0100)]
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>
10 years agotrivial: fix typo concerning "bandwidth"
Uwe Kleine-König [Thu, 23 Jan 2014 19:25:41 +0000 (20:25 +0100)]
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>
10 years agoisotp: fix path mentioned in file
Oliver Hartkopp [Thu, 23 Jan 2014 13:31:10 +0000 (14:31 +0100)]
isotp: fix path mentioned in file

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agoinclude: import copyright information from the kernel
Marc Kleine-Budde [Tue, 21 Jan 2014 11:47:02 +0000 (12:47 +0100)]
include: import copyright information from the kernel

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
10 years agoinclude: gw.h: update comment
Marc Kleine-Budde [Tue, 21 Jan 2014 11:51:01 +0000 (12:51 +0100)]
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:

    ad7f44095ac3 (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>
10 years agoinclude: can.h: add typedef for __kernel_sa_family_t to make headers self-contained
Marc Kleine-Budde [Tue, 21 Jan 2014 11:49:54 +0000 (12:49 +0100)]
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>
10 years agoinclude: can.h: remove unused include of version.h
Marc Kleine-Budde [Tue, 21 Jan 2014 11:48:41 +0000 (12:48 +0100)]
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>
10 years agoinclude: fix paths mentioned in files
Marc Kleine-Budde [Tue, 21 Jan 2014 11:47:44 +0000 (12:47 +0100)]
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>
10 years agoinclude: Move all includes from include/socketcan to include/linux
Uwe Kleine-König [Mon, 13 Jan 2014 21:57:14 +0000 (22:57 +0100)]
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>
10 years agoinclude/socketcan: prepare headers to be moved to include/linux
Marc Kleine-Budde [Thu, 16 Jan 2014 15:57:50 +0000 (16:57 +0100)]
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>
10 years agoisotp.h: add explicit license information
Uwe Kleine-König [Mon, 13 Jan 2014 21:57:16 +0000 (22:57 +0100)]
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>
10 years agoioctl.h: drop unused header
Uwe Kleine-König [Mon, 13 Jan 2014 21:57:15 +0000 (22:57 +0100)]
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>
10 years agoinclude: Remove two unused header files
Uwe Kleine-König [Mon, 13 Jan 2014 21:57:13 +0000 (22:57 +0100)]
include: Remove two unused header files

These seem to have never been used. They entered can-utils in commit
77de10356fe0 (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>
10 years agoslcand: accept both tty* and /dev/tty* device names
Yegor Yefremov [Thu, 23 Jan 2014 08:49:23 +0000 (09:49 +0100)]
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>
10 years agoAndroid.mk: remove executable bit
Marc Kleine-Budde [Thu, 16 Jan 2014 15:48:19 +0000 (16:48 +0100)]
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>
10 years agoslcand: reimplement daemonize routine
Yegor Yefremov [Mon, 13 Jan 2014 08:54:05 +0000 (09:54 +0100)]
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>
10 years agoslcand: add flow control option
Yegor Yefremov [Mon, 13 Jan 2014 08:54:04 +0000 (09:54 +0100)]
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>
10 years agoslcanpty: declare command buffer static
Yegor Yefremov [Mon, 13 Jan 2014 13:29:16 +0000 (14:29 +0100)]
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>
10 years agocan-calc-bit-timing: fix MCP251x bit rate calculation
Brennan Ashton [Sat, 26 Oct 2013 17:26:03 +0000 (10:26 -0700)]
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>
10 years agoasc2log: inform about uninstalled locales at date conversion failures
Oliver Hartkopp [Thu, 28 Nov 2013 15:12:17 +0000 (16:12 +0100)]
asc2log: inform about uninstalled locales at date conversion failures

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agoslcand: silence warning about set but unused variable
Oliver Hartkopp [Mon, 16 Sep 2013 07:08:56 +0000 (09:08 +0200)]
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>
10 years agoslcand: fix whitespace issues and unify coding style
Oliver Hartkopp [Sun, 15 Sep 2013 19:54:37 +0000 (21:54 +0200)]
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>
10 years agoslcand: add slcan_attach and UART settings
Oliver Hartkopp [Sun, 15 Sep 2013 19:08:00 +0000 (21:08 +0200)]
slcand: add slcan_attach and UART settings

slcand takes settings known from slcan_attach to configure CAN
interface, like open/close channel, set bitrate etc (Oliver Hartkopp).

In addition -S option sets UART's baudrate (Yegor Yefremov).

This way slcand combines three autilities in one: old slcand,
slcan_attach and stty.

Example: slcand -o -s8 -S 3000000 ttyUSB0

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agocangw: add an option for the per rule limitation of frame hops
Oliver Hartkopp [Wed, 4 Sep 2013 18:30:34 +0000 (20:30 +0200)]
cangw: add an option for the per rule limitation of frame hops

Usually the received CAN frames can be processed/routed as much as 'max_hops'
times (which is given at module load time of the can-gw module).
Introduce a new configuration option ( -l <hops> ) to reduce the number of
possible hops for a specific gateway rule to a value smaller then max_hops.

Mainline upstream commit:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=391ac1282dd7ff1cb8245cccc5262e8e4173edc4

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agocan-utils: Don't overwrite PREFIX and DESTDIR when provided via the environment
Uwe Kleine-König [Sat, 17 Aug 2013 19:28:10 +0000 (21:28 +0200)]
can-utils: Don't overwrite PREFIX and DESTDIR when provided via the environment

For creating a Debian package providing PREFIX and DESTDIR via the
environment is the easiest option. So use ?= to assign these two
variables to honor the values in the environment.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agocansniffer: fix file name in header
Uwe Kleine-König [Thu, 15 Aug 2013 20:58:19 +0000 (22:58 +0200)]
cansniffer: fix file name in header

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agocan-utils: trivial: fix typos concerning "separation" and "useful"
Uwe Kleine-König [Thu, 15 Aug 2013 18:59:26 +0000 (20:59 +0200)]
can-utils: trivial: fix typos concerning "separation" and "useful"

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agocan-utils: AOSP build clean up
Yegor Yefremov [Wed, 10 Jul 2013 07:28:57 +0000 (09:28 +0200)]
can-utils: AOSP build clean up

Remove unneeded includes. Both AOSP and NDK builds tested.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
10 years agoslcanpty: probe stdin capabilities at startup
Oliver Hartkopp [Tue, 11 Jun 2013 20:21:38 +0000 (22:21 +0200)]
slcanpty: probe stdin capabilities at startup

/dev/null returns EOF therefore select() finishes immediately.
Now EOF is probed on start.

Other /dev/null as stdin workarounds:
- lscanpty ... < /dev/ptmx (dirty but works)
- cat </dev/null | slcanpty ... (doesn't work for me and even the patch
  is "disabled" then)

Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agoslcanpty: fix pty terminal flags for correct NL/CR handling
Oliver Hartkopp [Tue, 11 Jun 2013 20:11:19 +0000 (22:11 +0200)]
slcanpty: fix pty terminal flags for correct NL/CR handling

Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agoslcanpty: handle incomplete messages from pty correctly
Oliver Hartkopp [Sat, 8 Jun 2013 10:57:17 +0000 (12:57 +0200)]
slcanpty: handle incomplete messages from pty correctly

Make sure that we have minimum one complete SLCAN messages from pty in the
receive buffer before we start processing the received SLCAN message.

Fragments of a received incomplete message are stored to be appended by the
next read() syscall in pty2can().

This patch is a rework of an initial patch from Ulrich Escher. Tnx!

Reported-by: Ulrich Escher <git@myvdr.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
10 years agoslcanpty: detect that master PTY descriptor closed
Oliver Hartkopp [Fri, 7 Jun 2013 18:02:57 +0000 (20:02 +0200)]
slcanpty: detect that master PTY descriptor closed

Terminate slcanpty when the pty file descriptor is closed instead of performing
an endless loop in the select() statement.

Reported-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocan-utils: AOSP build improvements
Yegor Yefremov [Mon, 18 Feb 2013 08:59:49 +0000 (09:59 +0100)]
can-utils: AOSP build improvements

Add local headers and GCC flags for all can-utils targets.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agolib: fix typo: exended -> extended
Oliver Hartkopp [Fri, 15 Feb 2013 22:39:32 +0000 (23:39 +0100)]
lib: fix typo: exended -> extended

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agolib: add support for non-zero dlc values in CAN 2.0B RTR frames
Oliver Hartkopp [Fri, 15 Feb 2013 22:25:13 +0000 (23:25 +0100)]
lib: add support for non-zero dlc values in CAN 2.0B RTR frames

As Hakan Engblom pointed out a CAN 2.0B RTR frame can contain a non-zero DLC
value which was not addressed by parse_canframe() and sprint_canframe().

This patch adds support for non-zero DLC values in a way that legacy logfiles
are still usable as the DLC can optionally be added.

Reported-by: Hakan Engblom <H.Engblom@tele-radio.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocandump: Add timeout option if no message has been received
Alexander Stein [Tue, 12 Feb 2013 16:50:51 +0000 (17:50 +0100)]
candump: Add timeout option if no message has been received

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocangen: use long long in time computation for -g to support >2.1s
Konrad Anton [Thu, 7 Feb 2013 10:14:32 +0000 (11:14 +0100)]
cangen: use long long in time computation for -g to support >2.1s

The computation of nanosleep times for the "-g" option (delay between sends)
overflows when more than 2100ms are given.

Signed-off-by: Konrad Anton <konrad.anton@awinia.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agoslcand: fix build warnings
Yegor Yefremov [Mon, 4 Feb 2013 09:10:22 +0000 (10:10 +0100)]
slcand: fix build warnings

Remove unused variable name.

Fix FILE pointer check (fopen() returns a pointer not an integer).

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocan-utils: fix local header path for AOSP build
Yegor Yefremov [Fri, 1 Feb 2013 07:44:46 +0000 (08:44 +0100)]
can-utils: fix local header path for AOSP build

Use path relative to the can-utils source code and to root of
the AOSP repository.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocangw: fix inverse filter display when printing the configured rules
Oliver Hartkopp [Tue, 29 Jan 2013 19:50:46 +0000 (20:50 +0100)]
cangw: fix inverse filter display when printing the configured rules

A configured inverse filter e.g.

cangw -A -s can0 -d can1 -e -f 123~7FF

has been displayed with 'cangw -L' like this:

cangw -A -s can0 -d can1 -e -f 20000123:7FF # 0 handled 0 dropped 0 deleted

While 0x20000000 was the value of CAN_INV_FILTER.

This patch fixes the output to the expected display:

cangw -A -s can0 -d can1 -e -f 123~7FF # 0 handled 0 dropped 0 deleted

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocangw: support new can-gw features for Linux 3.9+
Oliver Hartkopp [Tue, 29 Jan 2013 19:17:52 +0000 (20:17 +0100)]
cangw: support new can-gw features for Linux 3.9+

Added new option '-i' for can-gw rules to allow to route CAN frames back to the
originating/incoming CAN interface (which is disabled by default).

CAN frames that are deleted due to the violation of the max_hops limit are now
printed when displaying the configured rules with 'cangw -L'.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agoslcanpty: Add support for the Unix 98 pseudo-terminal interface
Oliver Hartkopp [Thu, 20 Dec 2012 10:37:43 +0000 (11:37 +0100)]
slcanpty: Add support for the Unix 98 pseudo-terminal interface

Most Linux distributions do not configure their kernels to use the BSD
pseudo-terminal interface (/dev/pty* and /dev/tty*) anymore; they uses the
Unix 98 pseudo-terminal interface instead (/dev/ptmx and /dev/pts/*).

http://www.kernel.org/doc/man-pages/online/pages/man4/pts.4.html

This change follows the slcan_attach changes:
http://sourceforge.net/tracker/index.php?func=detail&aid=3467521&group_id=146269&atid=764681

Signed-off-by: Ulrich Escher<git@myvdr.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocan-calc-bit-timing: add support for ti_hecc
Marc Kleine-Budde [Thu, 1 Nov 2012 20:46:46 +0000 (21:46 +0100)]
can-calc-bit-timing: add support for ti_hecc

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocan-calc-bit-timing: add 66.66 MHz mscan refclock
Marc Kleine-Budde [Mon, 26 Nov 2012 20:16:57 +0000 (21:16 +0100)]
can-calc-bit-timing: add 66.66 MHz mscan refclock

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocan-calc-bit-timing: add 24 and 66 MHz flexcan ref clock
Marc Kleine-Budde [Thu, 1 Nov 2012 20:46:16 +0000 (21:46 +0100)]
can-calc-bit-timing: add 24 and 66 MHz flexcan ref clock

as found on some imx boards.

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agoconfigure: enable silent rules if available
Marc Kleine-Budde [Mon, 26 Nov 2012 20:28:07 +0000 (21:28 +0100)]
configure: enable silent rules if available

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agoconfigure: adjust bug report address
Marc Kleine-Budde [Mon, 26 Nov 2012 20:29:17 +0000 (21:29 +0100)]
configure: adjust bug report address

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agoslcanpty: fix wrong usage of nbytes variable
Oliver Hartkopp [Mon, 26 Nov 2012 20:44:22 +0000 (21:44 +0100)]
slcanpty: fix wrong usage of nbytes variable

nbytes is used after writing the CAN frame to check for an additional command
in the string buffer. Therefore using nbytes while writing the CAN frame is
wrong. Replace it with 'tmp' which can be used here without problems.

Signed-off-by: ulrich escher<git@myvdr.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocandump: unify displayed timestamp length to 10 digits
Oliver Hartkopp [Sat, 24 Nov 2012 20:31:01 +0000 (21:31 +0100)]
candump: unify displayed timestamp length to 10 digits

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agoremove obsolete SVN ID tags
Oliver Hartkopp [Wed, 14 Nov 2012 19:57:16 +0000 (20:57 +0100)]
remove obsolete SVN ID tags

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agoremoved unused variable warnings by removing the variables
Oliver Hartkopp [Wed, 14 Nov 2012 19:43:55 +0000 (20:43 +0100)]
removed unused variable warnings by removing the variables

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocangw: add semantic check for checksum options
Oliver Hartkopp [Wed, 14 Nov 2012 19:20:38 +0000 (20:20 +0100)]
cangw: add semantic check for checksum options

The options to for adding checksums (-c or -x) can only be used in conjunction
with modifications (-m) applied to the routed CAN frames.

Signed-off-by: Andre Naujoks <nautsch2@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocandump: new option to print extra message information
Oliver Hartkopp [Wed, 14 Nov 2012 19:06:50 +0000 (20:06 +0100)]
candump: new option to print extra message information

Added -x option to print extra message infos per frame:

  RX/TX : Indicates whether the frame was sent or received from the local host
  BRS   : bit rate setting enabled (CAN FD only)
  ESI   : error state indicator (CAN FD only)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agoAdd new format option when mixing EFF/SFF frame output
Oliver Hartkopp [Wed, 14 Nov 2012 18:59:18 +0000 (19:59 +0100)]
Add new format option when mixing EFF/SFF frame output

Added new view CANLIB_VIEW_INDENT_SFF flags to fix the sloppy output of
fprint_long_canframe() when mixing EFF & SFF CAN identifiers.

candump: Once an EFF frame is detected the indention is enabled.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocanfd: upgrade tools to support CAN FD for Linux 3.6
Oliver Hartkopp [Wed, 14 Nov 2012 18:47:21 +0000 (19:47 +0100)]
canfd: upgrade tools to support CAN FD for Linux 3.6

This is a major upgrade of the basic tools to handle CAN FD frames.
The library to parse and print CAN frames and logfiles has been extended.

In detail:

 asc2log.c      |    5 +
 candump.c      |   24 ++++---
 cangen.c       |  172 +++++++++++++++++++++++++++++++++------------------
 canlogserver.c |   28 +++++---
 canplayer.c    |   25 ++++---
 cansend.c      |   55 ++++++++++++----
 lib.c          |  189 ++++++++++++++++++++++++++++++++++++++-------------------
 lib.h          |  109 ++++++++++++++++++++++++--------
 log2asc.c      |    8 +-
 log2long.c     |   26 ++++++-
 10 files changed, 440 insertions(+), 201 deletions(-)

asc2log.c / log2asc.c
- updates for new lib functions
- still can only handle CAN2.0 frames (no new info about ASC file layout)

log2long.c / canlogserver.c / canplayer.c
- updates for new lib functions to handle CAN FD

lib.h / lib.c
- reworked lib functions to handle CAN FD
- parse_canframe() now returns CAN_MTU and CANFD_MTU on success, 0 at failure
- added can_dlc2len() and can_len2dlc() helpers
- moved hexstring2candata to hexstring2data to support simple byte buffers
- in the long CAN frame representation use %03X/%08X instead of %3X/%8X
- introduced unified buffer size definitions for ASCII CAN frames
- updated documentation

cangen.c
- support CAN FD frames (added -f option to create CAN FD frames)
- added -m option ('mix') to create random extended / RTR / CAN FD frames
- fixed the 'fixed data' option which was zero'ing the payload by the time
- updated help text

candump.c
- support CAN FD frames (print, bridge, log)
- distinguish frame types by length info: [0] = CAN2.0 [00] = CAN FD frame

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agoUpdate includes to Linux 3.6 with CAN FD support.
Oliver Hartkopp [Wed, 14 Nov 2012 17:52:01 +0000 (18:52 +0100)]
Update includes to Linux 3.6 with CAN FD support.

There has been a change with __kernel_sa_family_t in Linux 3.1 which was not
adopted in this update so far to be backward compatible with old environments.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocangen: Enable sending of RTR CAN frames
Oliver Hartkopp [Sun, 22 Jul 2012 11:06:06 +0000 (13:06 +0200)]
cangen: Enable sending of RTR CAN frames

Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
11 years agocangen: allow double value for gap
Oliver Hartkopp [Fri, 13 Jul 2012 05:36:52 +0000 (07:36 +0200)]
cangen: allow double value for gap

This way a user can specify a gap below 1ms. This is somehwat similar
to setting the gap to 0, but the ENOBUFS are greatly reduced, so a given
amount of CAN messages by -n is still usefull and useable.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
12 years agoSigned-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Yegor Yefremov [Thu, 19 Apr 2012 15:39:53 +0000 (17:39 +0200)]
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
12 years agocan-utils: add Makefile for Android build system
Yegor Yefremov [Tue, 20 Mar 2012 09:47:39 +0000 (10:47 +0100)]
can-utils: add Makefile for Android build system

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
12 years agocan-utils: cleanup headers
Yegor Yefremov [Tue, 20 Mar 2012 09:47:38 +0000 (10:47 +0100)]
can-utils: cleanup headers

- add missing sys/socket.h: on some systems (like Android)
have SOCK_RAW definition directly in sys/socket.h

- use sys/wait.h instead if wait.h

- include termios.h explicitly (Android)

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
12 years agoadapt column width format for high busload values
Oliver Hartkopp [Thu, 8 Mar 2012 18:32:45 +0000 (19:32 +0100)]
adapt column width format for high busload values

12 years agocangen: set unused payload to zero
Oliver Hartkopp [Sat, 28 Jan 2012 16:30:33 +0000 (17:30 +0100)]
cangen: set unused payload to zero

12 years agotreewide: replace berlios contact email by linux-can@vger.kernel.org
Marc Kleine-Budde [Mon, 5 Dec 2011 09:43:00 +0000 (10:43 +0100)]
treewide: replace berlios contact email by linux-can@vger.kernel.org

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
12 years agogitignore: added tarballs
Marc Kleine-Budde [Fri, 2 Dec 2011 12:44:27 +0000 (13:44 +0100)]
gitignore: added tarballs

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
12 years agoautotools: adopt to new location for kernel headers
Marc Kleine-Budde [Sun, 30 Oct 2011 17:54:16 +0000 (18:54 +0100)]
autotools: adopt to new location for kernel headers

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>