profile/ivi/can-utils.git
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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
12 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>
12 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.

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>
12 years agoMakefile: adopt to new location for kernel headers
Marc Kleine-Budde [Sun, 30 Oct 2011 17:54:16 +0000 (18:54 +0100)]
Makefile: adopt to new location for kernel headers

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
12 years agoinclude: import kernel header files into tree
Marc Kleine-Budde [Fri, 2 Dec 2011 12:53:49 +0000 (13:53 +0100)]
include: import kernel header files into tree

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
12 years agocanbusload: flush output at the end of each cycle
Kurt Van Dijck [Wed, 21 Dec 2011 09:08:57 +0000 (10:08 +0100)]
canbusload: flush output at the end of each cycle

When canbusload is piped to another program, the output
is queued for several cycles. This patch will flush the output
explicitely.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
13 years agocan-utils/lib: fix build issues introduced with sprintf_can_error_frame()
Wolfgang Grandegger [Mon, 14 Feb 2011 16:10:39 +0000 (16:10 +0000)]
can-utils/lib: fix build issues introduced with sprintf_can_error_frame()

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
13 years agocandump: add option -e to dump error messages in human readable format
Wolfgang Grandegger [Mon, 14 Feb 2011 15:49:27 +0000 (15:49 +0000)]
candump: add option -e to dump error messages in human readable format

If "candump" is called with the option "-e", the error messages are
dumped in human readable format:

  # candump -e any,0:0,#FFFFFFFF
  ...
  can0  20000088  [8] 00 00 80 19 00 00 00 00   ERRORFRAME
        protocol-violation{{error-on-tx}{acknowledge-slot}}
        bus-error
        error-counter{tx{128}rx{97}}
  ...
  can0  2000008C  [8] 00 08 80 19 00 00 00 00   ERRORFRAME
        controller-problem{tx-error-warning}
        protocol-violation{{error-on-tx}{acknowledge-slot}}
        bus-error
        error-counter{tx{128}rx{97}}

"candump" actually calles a library function snprintf_can_error_frame()
to do the formatting. It could be used for other purposes as well.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
13 years agocandump: Avoid ragged output of timestamp values when printing differential
Oliver Hartkopp [Wed, 19 Jan 2011 17:43:07 +0000 (17:43 +0000)]
candump: Avoid ragged output of timestamp values when printing differential
timestamps (commandline option -td).
Idea & original patch by Uwe Bonnes.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agocangen: set seed value for pseudo random numbers
Oliver Hartkopp [Wed, 19 Jan 2011 17:35:37 +0000 (17:35 +0000)]
cangen: set seed value for pseudo random numbers

As pointed out by Andre Naujoks the pseudo random generator should be
initialized with a seed to prevend this ugly behaviour:

$ ./cangen vcan2 -v & ./cangen vcan1 -v
[1] 5995
  vcan2  567#69.98.3C.64.73.48
  vcan1  567#69.98.3C.64.73.48
  vcan2  451#4A.94.E8.2A.EC.58.55.62
  vcan1  451#4A.94.E8.2A.EC.58.55.62
  vcan2  729#BA.58.1B.3D.AB.D7.7E.50
  vcan1  729#BA.58.1B.3D.AB.D7.7E.50
(..)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agoslcan_attach: added '-f' commandline option to read status flags.
Oliver Hartkopp [Sun, 9 Jan 2011 11:49:20 +0000 (11:49 +0000)]
slcan_attach: added '-f' commandline option to read status flags.

In the case of pending bus errors on some slcan adapters the read of the
status flags resets the adapter and clears the error LED.

This patch adds the commandline option to send the status read command to the
adapter as suggested by Thorsten Godau.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agoslcan_attach: 'close' the slcan adapter before setting a bitrate
Oliver Hartkopp [Sun, 9 Jan 2011 11:35:03 +0000 (11:35 +0000)]
slcan_attach: 'close' the slcan adapter before setting a bitrate

As investigated by Thorsten Godau the bitrate can only be set after the
slcan adapter is in 'close' state.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Thorsten Godau <dl9sec@gmx.net>
13 years agoslcand: replace char pointers with static char buffers
Oliver Hartkopp [Thu, 6 Jan 2011 19:20:18 +0000 (19:20 +0000)]
slcand: replace char pointers with static char buffers

The buffers to build the pathnames had been malloc'ed and never been free'd.
This patch removes the malloc stuff entirely.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agocandump: Added '-u <usecs>' commandline option to delay bridged CAN frames by
Oliver Hartkopp [Mon, 29 Nov 2010 19:11:11 +0000 (19:11 +0000)]
candump: Added '-u <usecs>' commandline option to delay bridged CAN frames by
usecs microseconds.

13 years agocangen: Added '-n <count>' commandline option analogue to candump tool.
Oliver Hartkopp [Mon, 29 Nov 2010 18:58:12 +0000 (18:58 +0000)]
cangen: Added '-n <count>' commandline option analogue to candump tool.
Inspired by Uwe Bonnes.

13 years agoslcand : added new commandline option to support direct assignment of a CAN
Oliver Hartkopp [Fri, 19 Nov 2010 19:52:39 +0000 (19:52 +0000)]
slcand : added new commandline option to support direct assignment of a CAN
netdevice name to the given tty (by renaming the created netdevice).

Signed-off-by: Robert Haddon <robert.haddon@cirrascale.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agoslcan_attach: Added new commandline option to specify the created netdevice name.
Oliver Hartkopp [Wed, 17 Nov 2010 11:55:46 +0000 (11:55 +0000)]
slcan_attach: Added new commandline option to specify the created netdevice name.

13 years agoslcan_attach: Print the name of the assigned netdevice after attaching the tty.
Oliver Hartkopp [Wed, 17 Nov 2010 06:59:20 +0000 (06:59 +0000)]
slcan_attach: Print the name of the assigned netdevice after attaching the tty.

13 years agoAdded new socketoptions to force the isotp protocol to intentionally
Oliver Hartkopp [Sun, 14 Nov 2010 08:55:06 +0000 (08:55 +0000)]
Added new socketoptions to force the isotp protocol to intentionally
misbehave for regression tests.

CAN_ISOTP_TX_STMIN:
Set a value in nano secs that's used as minimum CF gap by the sender.
This value is used instead of the value provided by the receiver inside the FC.

CAN_ISOTP_RX_STMIN:
Ignores received CF frames which timestamps differ less than this value in nano
secs. This is used to test the receivers misbehaviour when the receiver
provides a lower stmin value that he's able to cope with. Received CF frames
are silently dropped when they come faster than specified by this value.

14 years agoFix datatype issue in sscanf() on 64bit systems.
Oliver Hartkopp [Sat, 25 Sep 2010 10:24:37 +0000 (10:24 +0000)]
Fix datatype issue in sscanf() on 64bit systems.

On 64bit systems a 'long' is a 64bit value but the target values of scanf()
are always 32bit in the affected code - which means just an 'unsigned int'.
Unsigned int is fine on 32 and 64 bit systems.

Thanks to Andre Naujoks for reporting this issue.

14 years agoAdded support for inverted CAN ID filters.
Oliver Hartkopp [Fri, 24 Sep 2010 18:23:42 +0000 (18:23 +0000)]
Added support for inverted CAN ID filters.

14 years agoFixed calculation of needed bits on the physical wire according Ken Tindells
Oliver Hartkopp [Fri, 24 Sep 2010 17:56:53 +0000 (17:56 +0000)]
Fixed calculation of needed bits on the physical wire according Ken Tindells
*worst* case calculation for stuff-bits.
(see "Guaranteeing Message Latencies on Controller Area Network" 1st ICC'94)
Due to the bitstuffing estimation the calculated busload may exceed 100%.

14 years agocan-calc-bit-timing: remove rtcantl1
Marc Kleine-Budde [Tue, 20 Jul 2010 14:10:38 +0000 (14:10 +0000)]
can-calc-bit-timing: remove rtcantl1

No one can verify the timing parameters to be correct.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocan-calc-bit-timing: add more can controller definitions and ref clocks
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:20 +0000 (13:43 +0000)]
can-calc-bit-timing: add more can controller definitions and ref clocks

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocan-calc-bit-timing: calculate bit timings for all known controllers by default
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:16 +0000 (13:43 +0000)]
can-calc-bit-timing: calculate bit timings for all known controllers by default

When testing or improving the bit timing algorithm, you're probably
interested in the values of all can controllers. Further you might not
know the all reference clocks of the controllers.

This patch add a "ref_clock" member to the "struct can_bittiming_const"
that holds the reference clock of the controller in Hz.

By default now the bit timing is calculated for all known can
controllers with the default ref_clock defined in "can_bittiming_const".

It's still possible to overwrite the ref clock with the command line
option "-c".

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocan-calc-bit-timing: improve printing of bit timing parameters
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:12 +0000 (13:43 +0000)]
can-calc-bit-timing: improve printing of bit timing parameters

This patch adds additional fields when printing the bit timing
parameters. Now the real bitrate the nominal and the real sample point
as well as the error of the sample point is displayed.

The output now looks like this:

Bit timing parameters for at91 with 100.000000 MHz ref clock
nominal                                 real Bitrt   nom  real SampP
Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP Bitrate Error SampP SampP Error     CAN_BR
1000000     50   7    7    5   1   5 1000000  0.0% 75.0% 75.0%  0.0% 0x00040664
 800000     50   8    8    8   1   5  800000  0.0% 80.0% 68.0% 15.0% 0x00040777
 500000    100   8    8    3   1  10  500000  0.0% 87.5% 85.0%  2.9% 0x00090772
 250000    250   6    7    2   1  25  250000  0.0% 87.5% 87.5%  0.0% 0x00180561
 125000    500   6    7    2   1  50  125000  0.0% 87.5% 87.5%  0.0% 0x00310561
 100000    500   8    8    3   1  50  100000  0.0% 87.5% 85.0%  2.9% 0x00310772
  50000   1250   6    7    2   1 125   50000  0.0% 87.5% 87.5%  0.0% 0x007c0561
  20000 ***bitrate not possible***
  10000 ***bitrate not possible***

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocan-calc-bit-timing: use algorithm from the kernel
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:08 +0000 (13:43 +0000)]
can-calc-bit-timing: use algorithm from the kernel

This patch copies the algorithm functions (can_update_spt and
can_calc_bittiming) from the kernel. Then some glue code is added that
these functions compile in userspace.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocan-calc-bit-timing: fix indention
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:04 +0000 (13:43 +0000)]
can-calc-bit-timing: fix indention

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agoadd can-calc-bit-timing to Makefiles + gitignore
Marc Kleine-Budde [Tue, 20 Jul 2010 13:43:01 +0000 (13:43 +0000)]
add can-calc-bit-timing to Makefiles + gitignore

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>