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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
*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%.
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>
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>
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>
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[]
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>