]> rtime.felk.cvut.cz Git - can-utils.git/log
can-utils.git
7 years agocandump: Enable HW timestamping before using it master
Michal Sojka [Fri, 26 Aug 2016 13:08:20 +0000 (15:08 +0200)]
candump: Enable HW timestamping before using it

If HW timestamping is not supported by the driver, candump exits with
an error message.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
7 years agocandump: Add support for hardware timestamping
Michal Sojka [Fri, 26 Aug 2016 11:19:59 +0000 (13:19 +0200)]
candump: Add support for hardware timestamping

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
7 years agocangw: Print error message on misspelled interface
Michal Sojka [Wed, 5 Feb 2014 15:48:18 +0000 (16:48 +0100)]
cangw: Print error message on misspelled interface

If can interface is misspelled or the kernel is configured without netlink
cangw displayed only generic usage instruction. Now, an appropriate error
message is displayed.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
7 years agocangen: reset frame flags at the start of iteration (#16)
Ramesh Shanmugasundaram [Thu, 30 Jun 2016 19:33:16 +0000 (20:33 +0100)]
cangen: reset frame flags at the start of iteration (#16)

This patch fixes a bug in cangen.c

Bug: When used with -m option, if a CAN FD frame with BRS option set is
sent, that flag never gets cleared for the subsequent frames.

Fix: Reset frame.flags at the start of iteration.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
7 years agoMerge pull request #24 from ajneu/master1
Marc Kleine-Budde [Mon, 13 Jun 2016 09:00:34 +0000 (11:00 +0200)]
Merge pull request #24 from ajneu/master1

header-guard for lib.h

7 years agoheader-guard for lib.h
ajneu [Mon, 13 Jun 2016 08:52:41 +0000 (10:52 +0200)]
header-guard for lib.h

7 years agoMerge pull request #23 from ajneu/master1
Marc Kleine-Budde [Mon, 13 Jun 2016 08:35:26 +0000 (10:35 +0200)]
Merge pull request #23 from ajneu/master1

pointer to const in lib

7 years agopointer to const in lib
ajneu [Mon, 13 Jun 2016 08:26:53 +0000 (10:26 +0200)]
pointer to const in lib

7 years agocan-calc-bit-timing: fix getopt typo: p -> q
Marc Kleine-Budde [Tue, 24 May 2016 06:34:44 +0000 (08:34 +0200)]
can-calc-bit-timing: fix getopt typo: p -> q

Reported-by: Jon Neal <reportingsjr@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
7 years agoslcand: added listen-only option
Oliver Hartkopp [Sat, 21 May 2016 08:31:23 +0000 (10:31 +0200)]
slcand: added listen-only option

listen-only option (-l) has been added to slcan-attach in oct 2015.
It is now replicated in slcand

Signed-off-by: interlocuteur <gallard@mmic.net>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
8 years agocan-calc-bit-timing: add name parameter to ref clock
Marc Kleine-Budde [Fri, 15 Apr 2016 09:59:30 +0000 (11:59 +0200)]
can-calc-bit-timing: add name parameter to ref clock

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: make it possible to have several ref clocks per bit timing defin...
Marc Kleine-Budde [Fri, 15 Apr 2016 09:35:03 +0000 (11:35 +0200)]
can-calc-bit-timing: make it possible to have several ref clocks per bit timing definition

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timint: rename bitrate -> bitrate_nominal
Marc Kleine-Budde [Fri, 15 Apr 2016 09:13:43 +0000 (11:13 +0200)]
can-calc-bit-timint: rename bitrate -> bitrate_nominal

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timint: rename spt_target, sample_point -> spt_nominal
Marc Kleine-Budde [Fri, 15 Apr 2016 09:13:43 +0000 (11:13 +0200)]
can-calc-bit-timint: rename spt_target, sample_point -> spt_nominal

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: better sample point calculation
Marc Kleine-Budde [Wed, 13 Apr 2016 09:29:37 +0000 (11:29 +0200)]
can-calc-bit-timing: better sample point calculation

This patch tries to optimize the calculation of the sample point. To
understand what it does have a look at the original implementation.

If there is a combination of timing parameters where both the bitrate
and sample point error are 0 the current implementation will find it.

However if the reference clock doesn't allow an optimal bitrate (this
means the bitrate error is always != 0) there might be several timing
parameter combinations having the same bitrate error. The original
implementation will allways choose the one with the highest brp. The
actual sample point error isn't taken into account.

This patch changes the algorithm to minimize the sample point error,
too. Now a brp/tseg combination is accepted as better if one of these
condition are fulfilled:
1) the bit rate error must be smaller, or
2) the bit rate error must be equal and
   the sample point error must be equal or smaller

If a smaller bit rate error is found the sample point error is reset.
This ensures that we first optimize for small bit rate error and then
for small sample point errors.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: introduce CAN_CALC_SYNC_SEG
Marc Kleine-Budde [Tue, 12 Apr 2016 14:27:54 +0000 (16:27 +0200)]
can-calc-bit-timing: introduce CAN_CALC_SYNC_SEG

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: fix checkpatch warnings
Marc Kleine-Budde [Wed, 13 Apr 2016 09:19:41 +0000 (11:19 +0200)]
can-calc-bit-timing: fix checkpatch warnings

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: import current can_calc_bittiming() from kernel
Marc Kleine-Budde [Tue, 12 Apr 2016 14:10:49 +0000 (16:10 +0200)]
can-calc-bit-timing: import current can_calc_bittiming() from kernel

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: import helper macros from kernel
Marc Kleine-Budde [Wed, 13 Apr 2016 09:16:55 +0000 (11:16 +0200)]
can-calc-bit-timing: import helper macros from kernel

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: use "struct can_bittiming_const" from uapi headers
Marc Kleine-Budde [Tue, 12 Apr 2016 13:56:14 +0000 (15:56 +0200)]
can-calc-bit-timing: use "struct can_bittiming_const" from uapi headers

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: make use of bool
Marc Kleine-Budde [Wed, 13 Apr 2016 09:22:49 +0000 (11:22 +0200)]
can-calc-bit-timing: make use of bool

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: fix checkpatch warnings
Marc Kleine-Budde [Wed, 13 Apr 2016 09:19:41 +0000 (11:19 +0200)]
can-calc-bit-timing: fix checkpatch warnings

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: add support flexcan with 30MHz refclock
Marc Kleine-Budde [Thu, 3 Sep 2015 09:11:30 +0000 (11:11 +0200)]
can-calc-bit-timing: add support flexcan with 30MHz refclock

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan-calc-bit-timing: add support for rcar_can
Ramesh Shanmugasundaram [Mon, 29 Feb 2016 10:18:45 +0000 (10:18 +0000)]
can-calc-bit-timing: add support for rcar_can

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocan: avoid using timeval for uapi
Oliver Hartkopp [Thu, 5 Nov 2015 20:36:42 +0000 (21:36 +0100)]
can: avoid using timeval for uapi

Upstream commit ba61a8d9d780980e8284355a0be750897e7af212

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=ba61a8d9d780980e8284355a0be750897e7af212

The can subsystem communicates with user space using a bcm_msg_head
header, which contains two timestamps. This is problematic for
multiple reasons:

a) The structure layout is currently incompatible between 64-bit
   user space and 32-bit user space, and cannot work in compat
   mode (other than x32).

b) The timeval structure layout will change in 32-bit user
   space when we fix the y2038 overflow problem by redefining
   time_t to 64-bit, making new 32-bit user space incompatible
   with the current kernel interface.
   Cars last a long time and often use old kernels, so the actual
   users of this code are the most likely ones to migrate to y2038
   safe user space.

This tries to work around part of the problem by changing the
publicly visible user interface in the header, but not the binary
interface. Fortunately, the values passed around in the structure
are relative times and do not actually suffer from the y2038
overflow, so 32-bit is enough here.

We replace the use of 'struct timeval' with a newly defined
'struct bcm_timeval' that uses the exact same binary layout
as before and that still suffers from problem a) but not problem
b).

The downside of this approach is that any user space program
that currently assigns a timeval structure to these members
rather than writing the tv_sec/tv_usec portions individually
will suffer a compile-time error when built with an updated
kernel header. Fixing this error makes it work fine with old
and new headers though.

We could address problem a) by using '__u32' or 'int' members
rather than 'long', but that would have a more significant
downside in also breaking support for all existing 64-bit user
binaries that might be using this interface, which is likely
not acceptable.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-can@vger.kernel.org
Cc: linux-api@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
8 years agoslcan: added listen-only flag
Maximilian Pachl [Sun, 11 Oct 2015 06:48:24 +0000 (08:48 +0200)]
slcan: added listen-only flag

Signed-off-by: Maximilian Pachl <m@ximilian.info>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocangen: added -b switch enabling bitrate switch in canfd frames.
Sven Schmitt [Sun, 11 Oct 2015 19:08:45 +0000 (21:08 +0200)]
cangen: added -b switch enabling bitrate switch in canfd frames.

Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocangen: fixed coding style
Sven Schmitt [Tue, 13 Oct 2015 07:33:08 +0000 (09:33 +0200)]
cangen: fixed coding style

Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agoCreate README.md
Andrew Berezovskyi [Wed, 2 Sep 2015 07:56:40 +0000 (09:56 +0200)]
Create README.md

Signed-off-by: Andrew Berezovskyi <andrew@berezovskiy.me>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agoautotools: fix syntax error
Yegor Yefremov [Fri, 7 Aug 2015 16:03:37 +0000 (18:03 +0200)]
autotools: fix syntax error

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
8 years agoInclude linux/sockios.h to fix musl build
Yegor Yefremov [Thu, 16 Jul 2015 19:30:02 +0000 (21:30 +0200)]
Include linux/sockios.h to fix musl build

Including <sys/ioctl.h> and <net/if.h> is not sufficient
to musl to find SIOCSIFNAME, so <linux/sockios.h> must be
included too.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
8 years agolog2asc: include sys/time.h
Yegor Yefremov [Tue, 14 Jul 2015 19:24:37 +0000 (21:24 +0200)]
log2asc: include sys/time.h

Without this patch compilation against musl C library
breaks, because struct timeval cannot be found.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
8 years agocan-calc-bit-timing: add some more timings for mscan and flexcan
Marc Kleine-Budde [Wed, 20 Nov 2013 14:40:54 +0000 (15:40 +0100)]
can-calc-bit-timing: add some more timings for mscan and flexcan

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agotreewide: use if_nametoindex to avoid overflows
Sven Schmitt [Wed, 24 Jun 2015 13:33:20 +0000 (15:33 +0200)]
treewide: use if_nametoindex to avoid overflows

replaced strcpy(if_name, argv[x]) + ioctl by if_idx = if_nametoindex(argv[x])
to avoid overflows caused by long user input.

Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
8 years agocangw: introduce uid command line option
Oliver Hartkopp [Thu, 11 Jun 2015 18:48:43 +0000 (20:48 +0200)]
cangw: introduce uid command line option

Similar to referencing iptables rules by their line number this UID allows to
reference created routing jobs, e.g. to alter configured data modifications.

The UID is an optional non-zero value which can be provided at routing job
creation time. When the UID is set the UID replaces the data modification
configuration as job identification attribute e.g. at job removal time.

The UID option is provided by mainline Linux 4.2+

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
8 years agoadd 'v' command response
bombilee [Thu, 7 May 2015 14:11:58 +0000 (10:11 -0400)]
add 'v' command response

add v command response. Some software like USBtinViewer using v for software version.
Tested on USBtinViewer 1.0

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocanplayer: convert skipgap to unsigned long
Yegor Yefremov [Thu, 9 Apr 2015 20:55:19 +0000 (22:55 +0200)]
canplayer: convert skipgap to unsigned long

The result of (last_log_tv.tv_sec - log_tv.tv_sec) is
unsigned long, so use labs() in order not to trim the
value to int. Make skipgap to unsigned long for the same
reason.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agocandump: check for joined filter support at runtime
Oliver Hartkopp [Wed, 1 Apr 2015 10:58:27 +0000 (12:58 +0200)]
candump: check for joined filter support at runtime

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agocandump: support new raw socket option to join the given CAN filters
Oliver Hartkopp [Tue, 17 Mar 2015 19:30:54 +0000 (20:30 +0100)]
candump: support new raw socket option to join the given CAN filters

The CAN_RAW socket can set multiple CAN identifier specific filters that lead
to multiple filters in the af_can.c filter processing. These filters are
indenpendent from each other which leads to logical OR'ed filters when applied.

This socket option joines the given CAN filters in the way that only CAN frames
are passed to user space that matched *all* given CAN filters. The semantic for
the applied filters is therefore changed to a logical AND.

This is useful especially when the filterset is a combination of filters where
the CAN_INV_FILTER flag is set in order to notch single CAN IDs or CAN ID
ranges from the incoming traffic.

Example:
candump can0,100~7FF,200~7FF,400~7FF (logical OR'ed filters)
candump can0,100~7FF,200~7FF,400~7FF,J (logical AND'ed filters)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoautotools: define N_SLCAN, if not already declared
Yegor Yefremov [Sun, 8 Mar 2015 13:57:01 +0000 (14:57 +0100)]
autotools: define N_SLCAN, if not already declared

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agogitignore: add isotpperf
Robert Schwebel [Fri, 6 Mar 2015 08:17:18 +0000 (09:17 +0100)]
gitignore: add isotpperf

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agojanitorial: log2asc: properly close infile and outfile
Robert Schwebel [Fri, 6 Mar 2015 08:17:17 +0000 (09:17 +0100)]
janitorial: log2asc: properly close infile and outfile

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agojanitorial: asc2log: properly close infile
Robert Schwebel [Fri, 6 Mar 2015 08:17:16 +0000 (09:17 +0100)]
janitorial: asc2log: properly close infile

outfile is closed as well, so do this symmetrically for infile.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agoconfigure: switch to new libtool-2.0 macro
Marc Kleine-Budde [Thu, 26 Feb 2015 08:44:19 +0000 (09:44 +0100)]
configure: switch to new libtool-2.0 macro

It's been out for a while now.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agoisotp: fix printf warning on 32 bit systems
Marc Kleine-Budde [Tue, 3 Mar 2015 07:29:36 +0000 (08:29 +0100)]
isotp: fix printf warning on 32 bit systems

Use "z" modifier to print sizeof() values.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
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>
9 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>
9 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>