Commit Graph

1257 Commits (master)

Author SHA1 Message Date
Oliver Hartkopp 9b99fafe1a cangen: Enable sending of RTR CAN frames
Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-07-22 13:06:06 +02:00
Oliver Hartkopp 98930f1403 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>
2012-07-13 07:36:52 +02:00
Yegor Yefremov 5d2964c5ff Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-04-19 17:39:53 +02:00
Yegor Yefremov ba9b18932a 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>
2012-03-20 11:16:43 +01:00
Yegor Yefremov 4d3a002ec1 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>
2012-03-20 11:16:43 +01:00
Oliver Hartkopp 5077515927 adapt column width format for high busload values 2012-03-08 19:32:45 +01:00
Oliver Hartkopp 8197afe2c1 cangen: set unused payload to zero 2012-01-28 17:30:33 +01:00
Marc Kleine-Budde 722a09116d treewide: replace berlios contact email by linux-can@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-01-11 12:14:15 +01:00
Marc Kleine-Budde bf70a64be9 gitignore: added tarballs
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
2012-01-11 12:14:15 +01:00
Marc Kleine-Budde 01fe103cf7 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>
2012-01-11 12:14:15 +01:00
Marc Kleine-Budde 1f41714125 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>
2012-01-11 12:14:15 +01:00
Marc Kleine-Budde 77de10356f include: import kernel header files into tree
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Jan-Niklas Meier <dschanoeh@googlemail.com>
2012-01-11 12:14:15 +01:00
Kurt Van Dijck a4c200efe6 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>
2012-01-10 17:41:07 +01:00
Wolfgang Grandegger 71bcd74a7d can-utils/lib: fix build issues introduced with sprintf_can_error_frame()
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
2011-02-14 16:10:39 +00:00
Wolfgang Grandegger 796475677a 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>
2011-02-14 15:49:27 +00:00
Oliver Hartkopp c9e79e55c3 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>
2011-01-19 17:43:07 +00:00
Oliver Hartkopp d262a552bb 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>
2011-01-19 17:35:37 +00:00
Oliver Hartkopp 7ef581fec0 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>
2011-01-09 11:49:20 +00:00
Oliver Hartkopp eb1a99f8c7 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>
2011-01-09 11:35:03 +00:00
Oliver Hartkopp c9cdc9d069 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>
2011-01-06 19:20:18 +00:00
Oliver Hartkopp 3a9baeda05 candump: Added '-u <usecs>' commandline option to delay bridged CAN frames by
usecs microseconds.
2010-11-29 19:11:11 +00:00
Oliver Hartkopp 5d1dbedd19 cangen: Added '-n <count>' commandline option analogue to candump tool.
Inspired by Uwe Bonnes.
2010-11-29 18:58:12 +00:00
Oliver Hartkopp 33ff70f940 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>
2010-11-19 19:52:39 +00:00
Oliver Hartkopp d1efcd1d75 slcan_attach: Added new commandline option to specify the created netdevice name. 2010-11-17 11:55:46 +00:00
Oliver Hartkopp f213d0fea8 slcan_attach: Print the name of the assigned netdevice after attaching the tty. 2010-11-17 06:59:20 +00:00
Oliver Hartkopp 6aeb7d1faa 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.
2010-11-14 08:55:06 +00:00
Oliver Hartkopp d3468d907f 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.
2010-09-25 10:24:37 +00:00
Oliver Hartkopp 1463ee4ce4 Added support for inverted CAN ID filters. 2010-09-24 18:23:42 +00:00
Oliver Hartkopp d7fe33eb4b 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%.
2010-09-24 17:56:53 +00:00
Marc Kleine-Budde f5576a9833 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>
2010-07-20 14:10:38 +00:00
Marc Kleine-Budde 5c74d8d806 can-calc-bit-timing: add more can controller definitions and ref clocks
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-07-20 13:43:20 +00:00
Marc Kleine-Budde b9f9cd0c62 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>
2010-07-20 13:43:16 +00:00
Marc Kleine-Budde 26488b16e6 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>
2010-07-20 13:43:12 +00:00
Marc Kleine-Budde ccd199739e 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>
2010-07-20 13:43:08 +00:00
Marc Kleine-Budde daed6be029 can-calc-bit-timing: fix indention
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-07-20 13:43:04 +00:00
Marc Kleine-Budde b2d3f4f735 add can-calc-bit-timing to Makefiles + gitignore
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-07-20 13:43:01 +00:00
Marc Kleine-Budde fa9c05021c 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>
2010-07-20 13:42:57 +00:00
Oliver Hartkopp 5655d53acb Remove compiler warning :
warning: suggest explicit braces to avoid ambiguous ‘else’
2010-05-14 12:50:17 +00:00
Oliver Hartkopp 62c030b21f Added isotpserver in autotool config file and gitignore 2010-05-14 12:43:42 +00:00
Oliver Hartkopp b68a79ebde Added tiny ip server to send ISO 15765-2 PDUs via internetsockets to the CAN bus and vice versa. 2010-05-14 12:03:32 +00:00
Oliver Hartkopp c8247c8a57 Allow to have 4, 5 or 6 decimal places instead of only 4 & 6. 2010-05-11 10:01:49 +00:00
Marc Kleine-Budde 84e6b373f5 add autotools infrastructure
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-04-19 12:12:18 +00:00
Marc Kleine-Budde cfeb884137 add .gitignore
This may be usefull once the can-utils are migrated to git.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-04-19 12:12:04 +00:00
Marc Kleine-Budde f7be786e9a cangw: replace obsolete bzero by memset
uclibc for example doesn't implement bzero

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-04-19 12:11:49 +00:00
Oliver Hartkopp c6b3ceff83 Added CRC8 profiles to handle additional data for checksum generation. 2010-04-16 08:46:17 +00:00
Oliver Hartkopp 9e8f9200fb Added checksum functionality and some documentation in gw.h 2010-04-12 14:41:14 +00:00
Oliver Hartkopp a784e1e46f 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[]
2010-04-10 16:38:48 +00:00
Oliver Hartkopp ee562a9724 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>
2010-03-17 19:21:38 +00:00
Oliver Hartkopp f731bbe2a2 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>
2010-03-17 19:12:26 +00:00
Oliver Hartkopp 3765e1d25b Initialize packet counters when printing each routing entry. 2010-03-04 10:59:24 +00:00