]> rtime.felk.cvut.cz Git - sojka/can-utils.git/log
sojka/can-utils.git
10 years agocan-utils: AOSP build clean up master
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>
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.

13 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.

13 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.

13 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%.

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agoadd can-calc-bit-timing
Marc Kleine-Budde [Tue, 20 Jul 2010 13:42:57 +0000 (13:42 +0000)]
add can-calc-bit-timing

Add the tool as sent by Wolfgang via email
(<4BE152D2.6060306@grandegger.com>).

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
13 years agoRemove compiler warning :
Oliver Hartkopp [Fri, 14 May 2010 12:50:17 +0000 (12:50 +0000)]
Remove compiler warning :
warning: suggest explicit braces to avoid ambiguous ‘else’

13 years agoAdded isotpserver in autotool config file and gitignore
Oliver Hartkopp [Fri, 14 May 2010 12:43:42 +0000 (12:43 +0000)]
Added isotpserver in autotool config file and gitignore

13 years agoAdded tiny ip server to send ISO 15765-2 PDUs via internetsockets to the CAN bus...
Oliver Hartkopp [Fri, 14 May 2010 12:03:32 +0000 (12:03 +0000)]
Added tiny ip server to send ISO 15765-2 PDUs via internetsockets to the CAN bus and vice versa.

13 years agoAllow to have 4, 5 or 6 decimal places instead of only 4 & 6.
Oliver Hartkopp [Tue, 11 May 2010 10:01:49 +0000 (10:01 +0000)]
Allow to have 4, 5 or 6 decimal places instead of only 4 & 6.

14 years agoadd autotools infrastructure
Marc Kleine-Budde [Mon, 19 Apr 2010 12:12:18 +0000 (12:12 +0000)]
add autotools infrastructure

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agoadd .gitignore
Marc Kleine-Budde [Mon, 19 Apr 2010 12:12:04 +0000 (12:12 +0000)]
add .gitignore

This may be usefull once the can-utils are migrated to git.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agocangw: replace obsolete bzero by memset
Marc Kleine-Budde [Mon, 19 Apr 2010 12:11:49 +0000 (12:11 +0000)]
cangw: replace obsolete bzero by memset

uclibc for example doesn't implement bzero

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
14 years agoAdded CRC8 profiles to handle additional data for checksum generation.
Oliver Hartkopp [Fri, 16 Apr 2010 08:46:17 +0000 (08:46 +0000)]
Added CRC8 profiles to handle additional data for checksum generation.

14 years agoAdded checksum functionality and some documentation in gw.h
Oliver Hartkopp [Mon, 12 Apr 2010 14:41:14 +0000 (14:41 +0000)]
Added checksum functionality and some documentation in gw.h

14 years agoComplete rework of CAN netlink gateway.
Oliver Hartkopp [Sat, 10 Apr 2010 16:38:48 +0000 (16:38 +0000)]
Complete rework of CAN netlink gateway.

Major changes:

- rework internal structures to prepare routings and modifications of CAN traffic also to non-CAN interfaces
- fix reading of netlink messages in cangw.c (added RTCAN_RTA / RTCAN_PAYLOAD macros)
- rework reading of gw-job lists in cgw_dump_jobs()
- rename of functions and API definitions to have a common namespace cgw_
- added infrastructure to perform crc8 and xor checksums in CAN frame data[]

TODO:

- add and test functionality for crc8 and xor checksums in CAN frame data[]
- add help text for crc8 and xor checksums in CAN frame data[]

14 years agoSome binaries in can-utils depend on features in the socket-can svn
Oliver Hartkopp [Wed, 17 Mar 2010 19:21:38 +0000 (19:21 +0000)]
Some binaries in can-utils depend on features in the socket-can svn
repository. Building with exported headers from an unpatched kernel will
fail due to missing symbols or headers.

This patch adds two make variables to optionally disable building such
binaries, like this:

make PROGRAMS_ISOTP= PROGRAMS_CANGW= PROGRAMS_SLCAN= all

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
14 years agoTo simplify packaging of can-utils, add DESTDIR and PREFIX support to
Oliver Hartkopp [Wed, 17 Mar 2010 19:12:26 +0000 (19:12 +0000)]
To simplify packaging of can-utils, add DESTDIR and PREFIX support to
the can-utils Makefile.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
14 years agoInitialize packet counters when printing each routing entry.
Oliver Hartkopp [Thu, 4 Mar 2010 10:59:24 +0000 (10:59 +0000)]
Initialize packet counters when printing each routing entry.

14 years agoRework of help text.
Oliver Hartkopp [Sat, 27 Feb 2010 16:07:58 +0000 (16:07 +0000)]
Rework of help text.

14 years agoWhen sending a sequence, we need to resend the same frame when poll() returns.
Oliver Hartkopp [Fri, 26 Feb 2010 08:38:47 +0000 (08:38 +0000)]
When sending a sequence, we need to resend the same frame when poll() returns.
Fixed that to be a valid data source e.g. for ptx cansequence.

14 years agoAdded commandline option '-p <timeout>' to enable polling on the writing socket.
Oliver Hartkopp [Thu, 25 Feb 2010 20:53:19 +0000 (20:53 +0000)]
Added commandline option '-p <timeout>' to enable polling on the writing socket.
Inspired by Marc Kleine-Budde :-)

14 years agoAdded funtionality to flush all GW jobs in one netlink message.
Oliver Hartkopp [Tue, 23 Feb 2010 19:13:17 +0000 (19:13 +0000)]
Added funtionality to flush all GW jobs in one netlink message.

14 years agoBeautify the listing of registered gwjobs (cangw -L).
Oliver Hartkopp [Mon, 22 Feb 2010 18:57:45 +0000 (18:57 +0000)]
Beautify the listing of registered gwjobs (cangw -L).

14 years agoAdded feature to list created gateway jobs.
Oliver Hartkopp [Mon, 22 Feb 2010 09:57:12 +0000 (09:57 +0000)]
Added feature to list created gateway jobs.
Also added some fixes and removed debug printf's.

14 years agoAdded netlink error message support to be able to provide return values.
Oliver Hartkopp [Sun, 21 Feb 2010 12:34:34 +0000 (12:34 +0000)]
Added netlink error message support to be able to provide return values.
Renamed some structure elements. Updated usage text.

14 years agoMoved kernel parsing of netlink attributes into can_can_parse_attr().
Oliver Hartkopp [Sat, 20 Feb 2010 20:41:24 +0000 (20:41 +0000)]
Moved kernel parsing of netlink attributes into can_can_parse_attr().
Added functionalitiy to remove formerly created CAN GW jobs.

14 years agoAdded cangw netlink gateway configuration tool.
Oliver Hartkopp [Fri, 19 Feb 2010 13:33:59 +0000 (13:33 +0000)]
Added cangw netlink gateway configuration tool.

TODO (in both cangw and can-gw.ko) : Support removal and listing of rules.
So far the gateway jobs are only removed on can-gw.ko module unload or when
the used CAN netdevices disappear.

14 years agoTry to ignore the usual value restrictions of sockopt SO_RCVBUF when running
Oliver Hartkopp [Fri, 15 Jan 2010 19:15:08 +0000 (19:15 +0000)]
Try to ignore the usual value restrictions of sockopt SO_RCVBUF when running
as root (with CAP_NET_ADMIN) by using SO_RCVBUFFORCE if possible.

14 years agoAdded '-d' option to support the receive packet drop counting introduced in
Oliver Hartkopp [Fri, 15 Jan 2010 18:35:37 +0000 (18:35 +0000)]
Added '-d' option to support the receive packet drop counting introduced in
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=3b885787ea4112eaa80945999ea0901bf742707f

This is done by using recvmsg() instead of recvfrom() to allow the timestamp
and the dropcounter to be received within one syscall.

When the application (here 'candump') ist not fast enough to process the
incomming CAN frames the frames are dropped in the socket receive queue.
When this happens and '-d' is set, we get this info now:
DROPCOUNT: dropped 1 CAN frame on 'xxx' socket (total drops 1)

14 years agofflush the new configurable stdout output to allow proper pipe/netcat setups.
Oliver Hartkopp [Wed, 25 Nov 2009 18:51:31 +0000 (18:51 +0000)]
fflush the new configurable stdout output to allow proper pipe/netcat setups.

14 years agoAllow to specify the name of the IP tunnel netdevice via commandline option '-n ...
Oliver Hartkopp [Wed, 25 Nov 2009 17:15:09 +0000 (17:15 +0000)]
Allow to specify the name of the IP tunnel netdevice via commandline option '-n <name>'

14 years agoRemove feature to quit the isotptun by keypress (from stdin) as it was not possible...
Oliver Hartkopp [Wed, 25 Nov 2009 16:43:17 +0000 (16:43 +0000)]
Remove feature to quit the isotptun by keypress (from stdin) as it was not possible to run it from a start-script.
Added a signal handler to gracefully leave the isotptun.

14 years agocan-utils: canfdtest, a full duplex test to find out-of-order messages
Wolfgang Grandegger [Wed, 25 Nov 2009 11:18:22 +0000 (11:18 +0000)]
can-utils: canfdtest, a full duplex test to find out-of-order messages

This patch is a pepped up version of Valdislav's canecho_gen and
canecho_dut test programs, which have prooved to be useful for
detecting out-of-order message transmisson and reception. Here
is a list of the changes and improvements:

- Both programs have been merged into on test program named
  canfdtest. Message generation can be selected via the command
  line option '-g'.
- The test loop count can be specified.
- A low and high verbosity level has been added.
- send/recv is used instead of write/read.
- The return code of send/recv is checked properly.
- Use Linux coding style.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
14 years agoAdded hook to print selected logfile lines on stdout for further processing.
Oliver Hartkopp [Fri, 6 Nov 2009 08:07:45 +0000 (08:07 +0000)]
Added hook to print selected logfile lines on stdout for further processing.

14 years agoIntroduce KERNELDIR variable to allow override when invoking make on commandline.
Oliver Hartkopp [Thu, 10 Sep 2009 08:01:00 +0000 (08:01 +0000)]
Introduce KERNELDIR variable to allow override when invoking make on commandline.

14 years agoMove BCM server into can-utils as it is not test application anymore.
Oliver Hartkopp [Thu, 10 Sep 2009 07:39:33 +0000 (07:39 +0000)]
Move BCM server into can-utils as it is not test application anymore.

14 years agoRemove obsolete 'vcan' tool.
Oliver Hartkopp [Thu, 10 Sep 2009 07:34:06 +0000 (07:34 +0000)]
Remove obsolete 'vcan' tool.

14 years agoAdded slcand daemon contributed by Robert Haddon <robert.haddon@verari.com>
Oliver Hartkopp [Tue, 5 May 2009 09:40:10 +0000 (09:40 +0000)]
Added slcand daemon contributed by Robert Haddon <robert.haddon@verari.com>

15 years agoAdded commandline option '-r' to set the per-socket receive buffer size.
Oliver Hartkopp [Thu, 16 Apr 2009 08:05:42 +0000 (08:05 +0000)]
Added commandline option '-r' to set the per-socket receive buffer size.