Commit Graph

741 Commits (9c2de072a076236410f6c5a112bd7b9075a9e77d)

Author SHA1 Message Date
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
Oliver Hartkopp 5b518a0a5f Merge pull request #50 from darbedar/main-optimization
omit extra sets and clears - tnx!
2017-08-30 22:05:34 +02:00
Heydar Elahi c45ee0cdbe omit extra sets and clears
old code does extra sets and clears in case of quiet==1 so I've changed if statement orders and used else if
2017-08-09 18:53:35 +04:30
Oliver Hartkopp 846eddd854 Merge pull request #49 from darbedar/master
Another macro usage
2017-08-09 10:47:40 +02:00
Heydar Elahi 1ae8714d0d Another macro usage
Used same macro instead of array
2017-08-09 11:56:05 +04:30
Oliver Hartkopp c6ed797918 Merge pull request #48 from darbedar/master
use a macro for standardization & fix protocol violation location
2017-08-09 08:40:07 +02:00
Heydar Elahi 23249c5cd8 Protocol violation location mistake in error message
I changed "id.28-to-id.28" to	"id.28-to-id.21"
2017-08-09 10:44:19 +04:30
Heydar Elahi 243bab70d5 use a macro
the hex_asc_upper_lo macro which is defined before do the same thing.
2017-08-09 02:36:47 +04:30
Oliver Hartkopp 4c8fb05cb4 can-utils: remove strict-aliasing compiler warning
GitHub user 'crossband' raised an issue regarding the strict-aliasing compiler
warning in his specific setup: https://github.com/linux-can/can-utils/issues/42

In fact memcpy() and memset() are a better solution than the former pointer
magics, so remove the issues and the compiler warning flag too.

Reported-by: crossband (https://github.com/crossband)
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-07-01 19:01:01 +02:00
Oliver Hartkopp 5109ca4f3c cangen/cansend: fix typo 'ist' -> 'is'
Reported-by: Stanislavs Rogozins <stanislavs.rogozins@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-06-29 19:55:52 +02:00
Oliver Hartkopp 791890542a README: Add short decription for provided tools
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-04-28 20:42:35 +02:00
Oliver Hartkopp 2a2efbbc7f Updated README.md inspired by Alan (https://github.com/alan707)
Alan sent a pull request to update the README.md with some markdown tweaks
and a SocketCAN logo. Good idea!
After creating a SocketCAN logo PNG in the can-logos repository we can
reference the PNG inside the linux-can organization.
A license file needs to be added too - but this has to be discussed on the
mailing list first.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-04-27 21:22:03 +02:00
Marc Kleine-Budde cb33a55720 Merge pull request #37 from kohtala/master
isotptun: add option to daemonize (-D)
2017-02-16 14:26:13 +01:00
Marko Kohtala 35f3dc375b isotptun: add -D option to daemonize after tun device created
System startup needs to wait for tun device to be created before
continuing on use of the tun device. Add -D option to fork a daemon of
isotptun and exit(EXIT_SUCCESS) when the tun device can be used.

Log errors to syslog when daemonized or to stderr when in foreground.

Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
2017-02-14 11:16:07 +02:00
Marko Kohtala 51192feff8 isotptun: print command line parsing error messages to stderr
Command line parsing error messages are printed to stdout. Other errors
and usage goes to stderr.

Change to print errors to stderr.

Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
2017-02-14 11:14:29 +02:00
Marko Kohtala 7eb005d9f3 isotptun: use EXIT_FAILURE instead of 0 (EXIT_SUCCESS) for errors
Exit code does not tell if the service was provided or if it was not
provided due to command line or setup errors.

Change errors to return EXIT_FAILURE instead of 0. Also change other uses
of 0 to EXIT_SUCCESS and 1 to EXIT_FAILURE for clarity and POSIX
conformance.

Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
2017-02-14 11:12:51 +02:00
Jiho Chu 99f1664e0c bcmserver: allow CAN netdevice names greater than 6 characters
The sscanf() function to parse bcmserver command strings limited the length of
the CAN netdevice name to six characters. With this patch the length is derived
from the IFNAMSIZ which defines the space in ifr.ifr_name.

Signed-off-by: Jiho Chu <jiho.chu@samsung.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-01-14 20:15:40 +01:00
Marc Kleine-Budde c3305fdd51 Merge pull request #36 from rahul-bedarkar/fix-build-with-glibc
Add check to detect clock_nanosleep() in librt
2016-12-20 15:06:23 +01:00
Rahul Bedarkar 5f4785c2ac Add check to detect clock_nanosleep() in librt
With glibc versions before 2.17, we get following build error:

  canfdtest.o: In function `millisleep':
  canfdtest.c:(.text+0x212): undefined reference to `clock_nanosleep'
  collect2: error: ld returned 1 exit status
  make[1]: *** [canfdtest] Error 1
  make[1]: *** Waiting for unfinished jobs....

glibc versions before 2.17 needs to link with -lrt for
clock_nanosleep(). This patch adds support to detect if linking with
librt is required.

This build issue is detected by Buildroot autobuilder:
http://autobuild.buildroot.net/results/0e5/0e5242376ff6aa82e89ed1172350e05009d48156/build-end.log

Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
2016-12-20 19:29:15 +05:30
Marc Kleine-Budde 64edc021d2 Merge pull request #33 from rshanmu/master
canfdtest: remove usage of gettimeofday
2016-11-21 15:22:57 +01:00
Ramesh Shanmugasundaram cf1b2a177f canfdtest: remove usage of gettimeofday
This patch fixes this bug
https://github.com/linux-can/can-utils/issues/13

Modified the existing millisleep function to use clock_nanosleep with
MONOTONIC clock and relative timeout.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
2016-11-21 13:55:27 +00:00
Stephane Grosjean 4d0e6d5169 canfdtest: fix typo while waiting for tv_stop time
After a few complaint about 100% CPU usage of canfdtest over our PCI
-like boards, I have had a look to the source file, and think I have
found the issue in can_echo_dut().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-11-21 11:37:01 +01:00
Oliver Hartkopp 73ae306a11 bcm: add support for CAN FD frames
Update bcm.h following Linux mainline commit 6f3b911d5f29b98752

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2016-10-10 14:19:42 +02:00
Kurt Van Dijck 1ba4789904 Merge pull request #1 from linux-can/cross-compile-fixes
Cross compile fixes
2016-10-06 09:09:23 +02:00
Kurt Van Dijck 1637db7caa hide kickstart html guide 2016-10-06 09:00:37 +02: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
Marc Kleine-Budde 3881e6f673 Makefile: add install stage
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:27:13 +02:00
Marc Kleine-Budde 0a1372cc22 userspace headers: import userspace headers to simplify compilation
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:26:48 +02:00
Marc Kleine-Budde 07daafc825 testj1939: fix warning on 32 bit systems
testj1939.c: In function 'main':
testj1939.c:201:3: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
   fprintf(stderr, "- bind(, %s, %li);\n", canaddr2str(&sockname), sizeof(sockname));
   ^
testj1939.c:210:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
    fprintf(stderr, "- connect(, %s, %li);\n", canaddr2str(&peername), sizeof(peername));
    ^
testj1939.c:228:5: warning: format '%li' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
     fprintf(stderr, "- sendto(, <dat>, %i, 0, %s, %li);\n", todo_send, canaddr2str(&peername), sizeof(peername));
     ^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
    fprintf(stderr, "- recvfrom(, <dat>, %li, 0, &<peername>, %li);\n", sizeof(peername), sizeof(peername));
    ^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]

Use 'z' as correct modifier to print sizeof().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:24:49 +02:00
Oliver Hartkopp cddb2612b1 candump: print correct interface names on stderr
The cmdlinename[i] output contains the filter definitions e.g.
'can0,300:700' but you want to see only 'can0' when printing on stderr.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2016-08-31 19:14:07 +02:00
Marc Kleine-Budde 8f74b1cc21 Merge pull request #28 from ajneu/no_exit_on_down
don't exit when device goes down
2016-08-31 10:19:56 +02:00
ajneu 7a9e10173a don't exit when device goes down 2016-08-30 20:04:39 +02:00
Ramesh Shanmugasundaram 42ee04ff64 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>
2016-06-30 21:33:16 +02:00
Marc Kleine-Budde 8c5cd245f6 Merge pull request #24 from ajneu/master1
header-guard for lib.h
2016-06-13 11:00:34 +02:00
ajneu 3a33ee995c header-guard for lib.h 2016-06-13 10:52:41 +02:00
Marc Kleine-Budde 862e8ed178 Merge pull request #23 from ajneu/master1
pointer to const in lib
2016-06-13 10:35:26 +02:00
ajneu ef2ea8fa59 pointer to const in lib 2016-06-13 10:26:53 +02:00
Marc Kleine-Budde b70a76670d 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>
2016-05-24 08:34:44 +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
Marc Kleine-Budde 2920d41731 can-calc-bit-timing: add name parameter to ref clock
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-15 12:05:56 +02:00
Marc Kleine-Budde 588a19c95d 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>
2016-04-15 12:04:43 +02:00
Marc Kleine-Budde 6265825182 can-calc-bit-timint: rename bitrate -> bitrate_nominal
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-15 12:03:28 +02:00
Marc Kleine-Budde 798afd077a can-calc-bit-timint: rename spt_target, sample_point -> spt_nominal
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-15 12:02:18 +02:00
Marc Kleine-Budde 44a2900bd8 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>
2016-04-13 13:13:01 +02:00
Marc Kleine-Budde e36391c7d9 can-calc-bit-timing: introduce CAN_CALC_SYNC_SEG
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:13:01 +02:00
Marc Kleine-Budde 94e40d3c2d can-calc-bit-timing: fix checkpatch warnings
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:13:01 +02:00
Marc Kleine-Budde 197700d26e can-calc-bit-timing: import current can_calc_bittiming() from kernel
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:13:01 +02:00
Marc Kleine-Budde 95f62518d1 can-calc-bit-timing: import helper macros from kernel
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:13:01 +02:00
Marc Kleine-Budde 9ae9e7da02 can-calc-bit-timing: use "struct can_bittiming_const" from uapi headers
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:13:00 +02:00
Marc Kleine-Budde bc41784773 can-calc-bit-timing: make use of bool
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-04-13 13:12:16 +02:00