Commit Graph

87 Commits (15af38a25c679d3ed0f72bbc1109c6b34a959c39)

Author SHA1 Message Date
Leo Ruan 15af38a25c Add compile option to disable error logging
If you have an application stderr shall not be used by libsocketcan
you can disable all error logging by defining DISABLE_ERROR_LOG.

Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-08-08 12:28:57 +02:00
Leo Ruan 9679a3f50a Add interface to retrieve link statistics
This commit adds an interface to get the statistics (64-bits) from
CAN interface. See more information from /usr/include/linux/if_link.h
where defines the struct rtnl_link_stats64.

Compare to the rtnl_link_stats, rtnl_link_stats64 was introduced
since linux kernel 2.6. After that the rtnl_link_stats is synchronous
with struct rtnl_link_stats64 by truncating each member from 64 bits
to 32 bits. Actually, the struct rtnl_link_stats is kept for
compatibility.

Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-08-08 12:28:57 +02:00
Leo Ruan 6f13cefafe Get link information only from specified interface
libsocketcan always retrieves link information from all interfaces
instead of only specified one. This commit fixes the issue by appending
an interface information to dump request netlink message.
See man 7 rtnetlink for detail description in section 'RTM_GETLINK'.

Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-08-08 12:28:57 +02:00
Leo Ruan f5392c3654 Fix parse_rtattr() does not completely initialize
Because max is the index of the last element in array tb, max+1
elements need to be initialized.

Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-08-08 12:28:57 +02:00
Nikita Edward Baruzdin 4ea9ec7cf3 Update can_set_ctrlmode() documentation
Signed-off-by: Nikita Edward Baruzdin <nebaruzdin@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-07-22 16:25:09 +02:00
Nikita Edward Baruzdin 5938ac70cb Update CAN netlink header
Signed-off-by: Nikita Edward Baruzdin <nebaruzdin@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-07-22 16:22:06 +02:00
Marc Kleine-Budde 0c91940da1 GNUmakefile: include LICENSE file in tarball
Reported-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-03-24 10:33:34 +01:00
Marc Kleine-Budde 4608afb987 configure: back to trunk
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-03-24 10:33:34 +01:00
Marc Kleine-Budde 51f1610160 v0.0.10
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-03-19 10:14:24 +01:00
Marc Kleine-Budde c2f7f8e9b2 autogen-oldtools.sh: remove
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-03-19 10:14:24 +01:00
Robert Schwebel c503a5bc60 configure.ac: add hints from autoupdate
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-03-19 10:13:55 +01:00
Alexander Shiyan 0c4609f54f libsocketcan: Remove excess gotos.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-07 10:47:59 +01:00
Alexander Shiyan 24500fcaca libsocketcan: Fix return value for get{set}_link() function
This patch makes return value negative when open_nl_sock() function
fail and removes excess labels.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-02-06 11:45:55 +01:00
Alexander Shiyan 9a28d69183 Optimize can_do_restart() function
This patch optimizes can_do_restart() function by reusing some part
of code from existing set_link() function.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-31 11:12:20 +01:00
Alexander Shiyan d9469850ac Use "%u" printf-format specifier for unsigned variable
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-31 11:12:14 +01:00
Yegor Yefremov 9db8e13d5e README: typos and beautification
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2014-01-16 17:51:26 +01:00
Jan Engelhardt 8ec77c4e7e build: fix bracket imbalance
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2013-01-06 18:31:46 +01:00
Jan Engelhardt 9a889d52d0 build: avoid expansion of commented macros
'#' does not ignore the line at the m4 level, "dnl" does.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2013-01-06 18:31:45 +01:00
Wolfram Sang d5deaf6296 libsocketcan: add LICENSE file
Took LGPL v2.1+ from the FSF website which is stated in libsocketcan.c.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-11-28 13:11:14 +01:00
Alexander Stein 94094cc4ee Use strcmp instead of sizeof on char* string
This bug was detected by the clang warning:
libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call
is the same expression as the source; did you mean to provide an
explicit length? [-Wsizeof-pointer-memaccess]
sizeof(name)) != 0)
~~~~~~~^~~~~~

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-11-28 13:11:04 +01:00
Marc Kleine-Budde 58f117aa51 configure.ac: back to trunk
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-11-06 22:04:43 +01:00
Marc Kleine-Budde e1a224bf1c v0.0.9
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-11-06 22:03:10 +01:00
Marc Kleine-Budde 10a2051adb configure.ac: enable AM_SILENT_RULES
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-11-06 21:58:25 +01:00
Andrew Beard 5ba2310d85 Modified do_get_nl_link to potentially process multiple netlink dump replies.
Prior to this commit, do_get_nl_link assumed there would only be a single
reply for a dump request. On my system with multiple can interfaces, this
would cause only half of them to be listed in the dump reply. This change
checks for NLMSG_DONE dump terminator and stops receiving messages once
received.

Signed-off-by: Andrew Beard <abeard@ovro.caltech.edu>
[mkl: fix indention, move variable init out of loop]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-08-07 09:40:50 +02:00
Marc Kleine-Budde 5b990a4771 configure: fix tests/GNUmakefile.in not found regression
This patch fixes the following problem:

configure.ac:108: required file `tests/GNUmakefile.in' not found

which has been introduced in commit:
42a3b65198 tests: remove test example

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2011-12-16 14:06:08 +01:00
Kurt Van Dijck 3a2cec63a4 allow linking from c++
libsocketcan with c++ fails linking.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2011-10-18 13:26:48 +02:00
Kurt Van Dijck 6db5d772b4 add can_get_device_stats()
When using libsocketcan on git://git.pengutronix.de/git/tools/libsocketcan.git,
I kind of missed a method to fetch the can device statistics.
This patch adds that functionality.
I think this is the proper library to put such function.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2011-10-18 13:26:48 +02:00
Marc Kleine-Budde 42a3b65198 tests: remove test example
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2011-10-18 13:26:48 +02:00
Marc Kleine-Budde d99010f50b libsocketcan: remove trailing whitespace
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-10-25 13:36:49 +02:00
Marc Kleine-Budde 9f1be156e4 configure: disable debug by default, turn off maintainer mode
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2010-10-25 13:28:31 +02:00
Luotao Fu 36328666b6 switch back to trunk 2010-02-14 20:19:04 +01:00
Luotao Fu 33f96f936c v0.0.8
Signed-off-by: Luotao Fu <luotao@alea.(none)>
2010-02-14 20:18:49 +01:00
Luotao Fu cbe29b66de add berr counter call prototype to library header
Signed-off-by: Luotao Fu <luotao@alea.(none)>
2010-02-14 18:57:03 +01:00
Luotao Fu 1b50d5545d change libtool library versioning
Signed-off-by: Luotao Fu <luotao@alea.(none)>
2010-02-14 18:18:09 +01:00
Luotao Fu 298e6efc3e add get error counter call
Signed-off-by: Luotao Fu <luotao@alea.(none)>
2010-02-14 18:12:01 +01:00
Luotao Fu 118358336e fix header install
Signed-off-by: Luotao Fu <luotao@alea.(none)>
2010-02-14 17:25:33 +01:00
Luotao Fu fbb55a487f v0.0.7
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-15 12:46:42 +01:00
Luotao Fu 7422435b03 fix distinstall of can_netlink.h
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-15 12:30:09 +01:00
Luotao Fu c9f7a3d715 switch back to trunk
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-15 10:31:39 +01:00
Luotao Fu 94e9370022 v0.0.6
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-15 10:25:57 +01:00
Luotao Fu 3f2a397589 add dist doc files
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-15 10:16:01 +01:00
Luotao Fu d75a02c13d remove dependency on kernel header include
make a local copy of the can/netlink.h. This way we don't have to include a
kernel include directory to build any more.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-11 16:07:12 +01:00
Luotao Fu 917c6fb069 fix typo
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-11 14:30:12 +01:00
Luotao Fu 6f0eac7ab9 add doxygen documentation
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-08 15:54:53 +01:00
Luotao Fu 7ee625b6f3 switch version back to trunk
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-04 15:07:30 +01:00
Luotao Fu f38c3b6d92 v0.0.5
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-04 15:05:37 +01:00
Luotao Fu d6747aad3c update libtool revision
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-04 15:03:53 +01:00
Luotao Fu 8373c1f17b switch version back to trunk
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-01 10:42:23 +01:00
Wolfgang Grandegger 463ac873c7 Add can_get_bittiming_const()
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Luotao Fu <l.fu@pengutronix.de>
2009-12-01 10:20:41 +01:00
Luotao Fu 73a4999c24 v0.0.4
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
2009-11-27 16:45:05 +01:00