Commit Graph

29 Commits (59f92965b90efc00b0cb63e3d4edfefd9b24326f)

Author SHA1 Message Date
Yegor Yefremov 59f92965b9 Relicense GPL-2.0-or-later files to GPL-2.0-only
This way all licenses in the project will be homogenised.

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oleksij Rempel <ore@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Brennan Ashton <bashton@brennanashton.com>
Acked-By: IOhannes m zmölnig <zmoelnig@iem.at>
Acked-by: Frank Theile <ftheile@grundfos.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Jeremiah Mahler <jmmahler@gmail.com>
Acked-by: Jonathan Challinger <mr.challinger@gmail.com>
Acked-by: Cheng-Lung Lee <chenglung@gmail.com>
Acked-by: Ramesh Shanmugasundaram <rashanmu@gmail.com>
Acked-by: Mans Rullgard <mans@mansr.com>
Acked-by: Søren Holm <sgh@sgh.dk>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-07-10 14:01:23 +02:00
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Yegor Yefremov 1ce4dc7b39 Add missing return value checks
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2018-09-18 13:43:29 +02:00
Oliver Hartkopp 47f2e7a180 slcand: move setting of loop variable back into code context
With commit 33a9249571 ("slcand: daemonise only once setup is complete")
the daemonize syscall is moved behind serial tty setup.

This patch moves the missing assignment of the loop variable slcand_running
to get it into the code context of the while() loop.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2018-04-29 19:02:55 +02:00
Mans Rullgard 33a9249571 slcand: daemonise only once setup is complete
Delay the daemon() call until the interface has been configured. This
simplifies scripts that wish to use the new interface immediately.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2018-04-20 13:46:15 +01:00
Frank Theile f51c897d68
Consistent arguments to sizeof().
In calls to functions taking a pointer 'p' and a length 'l':
if a struct variable v is passed in for p, then also pass sizeof(v) for
l.
2018-04-03 11:56:28 +02:00
Søren Holm d052ad1a6b Set low-latency flag on serial port.
Some serial drivers does not default to lowlatency mode by default.
2018-01-14 14:16:20 +01:00
jschall f1c3ed1461
increase TTYPATH_LENGTH
ttypath can't fit filenames such as /dev/serial/by-id/usb-Zubax_Robotics_Zubax_Babel_1D002A00185732523935382000000000-if00
2017-11-28 13:02:01 -08:00
IOhannes m zmölnig ea6219b0b4 slcand: log to stdout when running in foreground
when slcand runs in daemon mode, it makes sense to output via syslog.
but when running in foreground, it is nicer to have all the info on the stdout.
2016-10-05 07:42:55 +02:00
Oliver Hartkopp d82ccd76ac 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>
2016-05-21 10:31:23 +02:00
Yegor Yefremov f0abaaacb0 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>
2015-07-22 21:12:51 +02:00
Jeremiah Mahler ca79909197 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>
2014-12-23 18:03:09 +01:00
Jeremiah Mahler d93ef0e372 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>
2014-12-23 18:02:52 +01:00
Jeremiah Mahler d62a9f148d 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>
2014-12-23 18:02:18 +01:00
Jeremiah Mahler 86023b8640 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>
2014-12-23 18:02:03 +01:00
Yegor Yefremov e4aac687eb 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>
2014-01-31 12:00:19 +01:00
Yegor Yefremov 49801ea8a6 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>
2014-01-23 13:46:19 +01:00
Yegor Yefremov 393a91c7d8 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>
2014-01-16 16:31:50 +01:00
Yegor Yefremov 38fb68fb50 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>
2014-01-16 16:31:50 +01:00
Oliver Hartkopp 16c970d40e 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>
2013-09-16 09:08:56 +02:00
Oliver Hartkopp 35d2bc1381 slcand: fix whitespace issues and unify coding style
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>
2013-09-15 21:54:37 +02:00
Oliver Hartkopp 94006e996d slcand: add slcan_attach and UART settings
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>
2013-09-15 21:08:00 +02:00
Yegor Yefremov ca313a52a8 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>
2013-02-04 12:11:32 +01:00
Oliver Hartkopp 836d3cc012 remove obsolete SVN ID tags
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-11-14 20:57:16 +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
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
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 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 64603859fb Added slcand daemon contributed by Robert Haddon <robert.haddon@verari.com> 2009-05-05 09:40:10 +00:00