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>
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>
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>
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>
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>
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>
Fixed coding style inspired by Linux checkpatch.pl
Additionally removed a comment in the write() result check in the 'if (speed)'
statement to make sure the write() is not optimized away as the executed code
was empty.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
slcand takes settings known from slcan_attach to configure CAN
interface, like open/close channel, set bitrate etc (Oliver Hartkopp).
In addition -S option sets UART's baudrate (Yegor Yefremov).
This way slcand combines three autilities in one: old slcand,
slcan_attach and stty.
Example: slcand -o -s8 -S 3000000 ttyUSB0
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Usually the received CAN frames can be processed/routed as much as 'max_hops'
times (which is given at module load time of the can-gw module).
Introduce a new configuration option ( -l <hops> ) to reduce the number of
possible hops for a specific gateway rule to a value smaller then max_hops.
Mainline upstream commit:
http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=391ac1282dd7ff1cb8245cccc5262e8e4173edc4
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
For creating a Debian package providing PREFIX and DESTDIR via the
environment is the easiest option. So use ?= to assign these two
variables to honor the values in the environment.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
/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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>