Merge branch 'master' of https://git.pengutronix.de/git/tools/libsocketcan
commit
b10cc9a7ec
|
|
@ -15,11 +15,13 @@ GNUmakefile.in
|
||||||
/config.log
|
/config.log
|
||||||
/config.status
|
/config.status
|
||||||
/config/autoconf/
|
/config/autoconf/
|
||||||
|
/config/libsocketcan.pc
|
||||||
/config/m4/libtool.m4
|
/config/m4/libtool.m4
|
||||||
/config/m4/ltoptions.m4
|
/config/m4/ltoptions.m4
|
||||||
/config/m4/ltsugar.m4
|
/config/m4/ltsugar.m4
|
||||||
/config/m4/ltversion.m4
|
/config/m4/ltversion.m4
|
||||||
/config/m4/lt~obsolete.m4
|
/config/m4/lt~obsolete.m4
|
||||||
|
/include/libsocketcan_config.h.in
|
||||||
|
|
||||||
/asc2log
|
/asc2log
|
||||||
/bcmserver
|
/bcmserver
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.3)
|
||||||
|
|
||||||
project(can-utils LANGUAGES C)
|
project(can-utils LANGUAGES C)
|
||||||
|
set(LIB_CURRENT 4)
|
||||||
|
set(LIB_REVISION 1)
|
||||||
|
set(LIB_AGE 2)
|
||||||
|
math(EXPR LIB_SOVERSION "${LIB_CURRENT} - ${LIB_AGE}")
|
||||||
|
set(LIB_VERSION ${LIB_SOVERSION}.${LIB_AGE}.${LIB_REVISION})
|
||||||
|
|
||||||
include (GNUInstallDirs)
|
include (GNUInstallDirs)
|
||||||
|
|
||||||
|
|
@ -14,6 +19,7 @@ endif()
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
|
||||||
|
|
@ -73,6 +79,35 @@ add_library(j1939 STATIC
|
||||||
libj1939.c
|
libj1939.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_library(socketcan SHARED
|
||||||
|
libsocketcan.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix \${prefix})
|
||||||
|
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
configure_file(config/libsocketcan.pc.in config/libsocketcan.pc @ONLY)
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/config/libsocketcan.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(socketcan
|
||||||
|
PROPERTIES PUBLIC_HEADER include/libsocketcan.h
|
||||||
|
SOVERSION ${LIB_SOVERSION}
|
||||||
|
VERSION ${LIB_VERSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS socketcan
|
||||||
|
LIBRARY
|
||||||
|
DESTINATION lib
|
||||||
|
COMPONENT Development
|
||||||
|
PUBLIC_HEADER
|
||||||
|
DESTINATION include
|
||||||
|
COMPONENT Development
|
||||||
|
)
|
||||||
|
|
||||||
foreach(name ${PROGRAMS})
|
foreach(name ${PROGRAMS})
|
||||||
add_executable(${name} ${name}.c)
|
add_executable(${name} ${name}.c)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/** @mainpage libsocketcan
|
||||||
|
|
||||||
|
This is libsocketcan, a userspace library to do some common tasks while dealing
|
||||||
|
with the socketcan Framework.
|
||||||
|
|
||||||
|
@defgroup extern External API
|
||||||
|
@defgroup intern Interally used callbacks and structures
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -24,11 +24,22 @@ noinst_HEADERS = \
|
||||||
include/linux/can/raw.h \
|
include/linux/can/raw.h \
|
||||||
include/linux/can/vxcan.h
|
include/linux/can/vxcan.h
|
||||||
|
|
||||||
|
nobase_include_HEADERS = \
|
||||||
|
include/libsocketcan.h
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = \
|
||||||
|
libsocketcan.la
|
||||||
|
|
||||||
noinst_LTLIBRARIES = \
|
noinst_LTLIBRARIES = \
|
||||||
libcan.la \
|
libcan.la \
|
||||||
libj1939.la
|
libj1939.la
|
||||||
|
|
||||||
|
libsocketcan_la_SOURCES = \
|
||||||
|
libsocketcan.c
|
||||||
|
|
||||||
|
libsocketcan_la_LDFLAGS = \
|
||||||
|
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||||
|
|
||||||
libcan_la_SOURCES = \
|
libcan_la_SOURCES = \
|
||||||
lib.c \
|
lib.c \
|
||||||
canframelen.c
|
canframelen.c
|
||||||
|
|
@ -72,12 +83,20 @@ jsr_LDADD = libj1939.la
|
||||||
testj1939_LDADD = libj1939.la
|
testj1939_LDADD = libj1939.la
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
.gitignore \
|
||||||
.travis.yml \
|
.travis.yml \
|
||||||
Android.mk \
|
Android.mk \
|
||||||
|
CMakeLists.txt \
|
||||||
|
Documentation/main.dox \
|
||||||
|
Doxyfile \
|
||||||
|
Makefile \
|
||||||
README.md \
|
README.md \
|
||||||
autogen.sh \
|
autogen.sh \
|
||||||
can-j1939-kickstart.md
|
can-j1939-kickstart.md \
|
||||||
can-j1939.md
|
can-j1939.md \
|
||||||
|
cmake/make_uninstall.cmake \
|
||||||
|
page.theme \
|
||||||
|
style.css
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = \
|
MAINTAINERCLEANFILES = \
|
||||||
configure \
|
configure \
|
||||||
|
|
@ -102,3 +121,9 @@ MAINTAINERCLEANFILES = \
|
||||||
maintainer-clean-local:
|
maintainer-clean-local:
|
||||||
-chmod -R a+rw $(distdir)
|
-chmod -R a+rw $(distdir)
|
||||||
-rm -fr $(distdir)
|
-rm -fr $(distdir)
|
||||||
|
|
||||||
|
docs: htmldocs
|
||||||
|
|
||||||
|
htmldocs:
|
||||||
|
@echo 'Running doxygen with local Doxyfile'
|
||||||
|
-doxygen Doxyfile
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: libsocketcan
|
||||||
|
Description: provides access to socketcan configuration interface
|
||||||
|
Requires:
|
||||||
|
Version: @VERSION@
|
||||||
|
Libs: -L${libdir} -lsocketcan
|
||||||
|
Cflags: -I${includedir}
|
||||||
77
configure.ac
77
configure.ac
|
|
@ -3,20 +3,38 @@
|
||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
|
|
||||||
AC_INIT([can-utils],[trunk],[linux-can@vger.kernel.org])
|
AC_INIT([can-utils],[trunk],[linux-can@vger.kernel.org])
|
||||||
|
AC_CONFIG_HEADERS([include/libsocketcan_config.h])
|
||||||
AC_CONFIG_SRCDIR([lib.c])
|
AC_CONFIG_SRCDIR([lib.c])
|
||||||
AC_CONFIG_MACRO_DIR([config/m4])
|
AC_CONFIG_MACRO_DIR([config/m4])
|
||||||
AC_CONFIG_AUX_DIR([config/autoconf])
|
AC_CONFIG_AUX_DIR([config/autoconf])
|
||||||
AC_CANONICAL_BUILD
|
AC_CANONICAL_BUILD
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
#AM_MAINTAINER_MODE
|
|
||||||
|
|
||||||
CFLAGS="${CFLAGS} -Wall"
|
CFLAGS="${CFLAGS} -Wall"
|
||||||
|
|
||||||
|
#
|
||||||
|
# libtool library versioning stuff
|
||||||
|
#
|
||||||
|
# Library code modified: REVISION++
|
||||||
|
# Interfaces changed/added/removed: CURRENT++ REVISION=0
|
||||||
|
# Interfaces added: AGE++
|
||||||
|
# Interfaces removed: AGE=0
|
||||||
|
#
|
||||||
|
# Adjust CMakeLists.txt, too.
|
||||||
|
#
|
||||||
|
LT_CURRENT=4
|
||||||
|
LT_REVISION=1
|
||||||
|
LT_AGE=2
|
||||||
|
AC_SUBST(LT_CURRENT)
|
||||||
|
AC_SUBST(LT_REVISION)
|
||||||
|
AC_SUBST(LT_AGE)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
#
|
#
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AC_PROG_INSTALL
|
||||||
LT_INIT(win32-dll)
|
LT_INIT(win32-dll)
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
|
AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
|
||||||
|
|
@ -25,52 +43,87 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
#
|
#
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
#
|
#
|
||||||
|
AC_HEADER_DIRENT
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_SYS_WAIT
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_CHECK_HEADER_STDBOOL
|
||||||
AC_CHECK_HEADERS([ \
|
AC_CHECK_HEADERS([ \
|
||||||
fcntl.h \
|
fcntl.h \
|
||||||
|
inttypes.h \
|
||||||
limits.h \
|
limits.h \
|
||||||
locale.h \
|
locale.h \
|
||||||
|
locale.h \
|
||||||
|
netdb.h \
|
||||||
|
netinet/in.h \
|
||||||
|
stddef.h \
|
||||||
stdint.h \
|
stdint.h \
|
||||||
stdlib.h \
|
stdlib.h \
|
||||||
string.h \
|
string.h \
|
||||||
syslog.h \
|
syslog.h \
|
||||||
termios.h \
|
termios.h \
|
||||||
unistd.h \
|
unistd.h \
|
||||||
|
utime.h \
|
||||||
\
|
\
|
||||||
|
arpa/inet.h \
|
||||||
netinet/in.h \
|
netinet/in.h \
|
||||||
\
|
\
|
||||||
sys/ioctl.h \
|
sys/ioctl.h \
|
||||||
|
sys/param.h \
|
||||||
sys/socket.h \
|
sys/socket.h \
|
||||||
sys/time.h \
|
sys/time.h \
|
||||||
|
sys/un.h \
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
#
|
#
|
||||||
|
AC_C_CONST
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
AC_TYPE_INT8_T
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_TYPE_PID_T
|
AC_TYPE_PID_T
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_TYPE_SSIZE_T
|
||||||
|
AC_TYPE_UINT8_T
|
||||||
|
AC_TYPE_UINT16_T
|
||||||
|
AC_TYPE_UINT32_T
|
||||||
AC_TYPE_UINT64_T
|
AC_TYPE_UINT64_T
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
#
|
#
|
||||||
|
AC_FUNC_ERROR_AT_LINE
|
||||||
AC_FUNC_FORK
|
AC_FUNC_FORK
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_MEMCMP
|
||||||
AC_FUNC_MKTIME
|
AC_FUNC_MKTIME
|
||||||
|
AC_FUNC_STAT
|
||||||
|
AC_FUNC_STRTOD
|
||||||
|
AC_FUNC_UTIME_NULL
|
||||||
AC_CHECK_FUNCS([ \
|
AC_CHECK_FUNCS([ \
|
||||||
alarm \
|
alarm \
|
||||||
|
gethostbyaddr \
|
||||||
|
gethostbyname \
|
||||||
|
gethostname \
|
||||||
gettimeofday \
|
gettimeofday \
|
||||||
localtime_r \
|
localtime_r \
|
||||||
memset \
|
memset \
|
||||||
|
memset \
|
||||||
|
mkdir \
|
||||||
select \
|
select \
|
||||||
setlocale \
|
setlocale \
|
||||||
socket \
|
socket \
|
||||||
strchr \
|
strchr \
|
||||||
strerror \
|
strerror \
|
||||||
strstr \
|
strstr \
|
||||||
|
strtol \
|
||||||
strtoul \
|
strtoul \
|
||||||
|
strtoull \
|
||||||
|
utime \
|
||||||
])
|
])
|
||||||
|
|
||||||
# glibc versions before 2.17 needs to link with -lrt for clock_nanosleep
|
# glibc versions before 2.17 needs to link with -lrt for clock_nanosleep
|
||||||
|
|
@ -88,7 +141,7 @@ AC_CHECK_DECL(AF_CAN,,
|
||||||
AC_CHECK_DECL(N_SLCAN,,
|
AC_CHECK_DECL(N_SLCAN,,
|
||||||
[AC_DEFINE([N_SLCAN], [17], [N_SLCAN])]
|
[AC_DEFINE([N_SLCAN], [17], [N_SLCAN])]
|
||||||
)
|
)
|
||||||
AC_DEFINE(_GNU_SOURCE)
|
AC_DEFINE(_GNU_SOURCE, [], [Define _GNU_SOURCE])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -111,7 +164,25 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Error logging
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([whether to enable error logging])
|
||||||
|
AC_ARG_ENABLE(error-log,
|
||||||
|
AS_HELP_STRING([--enable-error-log], [enable error log @<:@default=yes@:>@]),
|
||||||
|
[case "$enableval" in
|
||||||
|
y | yes) CONFIG_ERROR_LOG=yes ;;
|
||||||
|
*) CONFIG_ERROR_LOG=no ;;
|
||||||
|
esac],
|
||||||
|
[CONFIG_ERROR_LOG=yes])
|
||||||
|
AC_MSG_RESULT([${CONFIG_ERROR_LOG}])
|
||||||
|
if test "${CONFIG_ERROR_LOG}" = "no"; then
|
||||||
|
AC_DEFINE(DISABLE_ERROR_LOG, 1, [disable error logging])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
GNUmakefile
|
GNUmakefile
|
||||||
|
config/libsocketcan.pc
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* libsocketcan.h
|
||||||
|
*
|
||||||
|
* (C) 2009 Luotao Fu <l.fu@pengutronix.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but without
|
||||||
|
* any warranty; without even the implied warranty of merchantability or fitness
|
||||||
|
* for a particular purpose. see the gnu lesser general public license for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* you should have received a copy of the gnu lesser general public license
|
||||||
|
* along with this library; if not, write to the free software foundation, inc.,
|
||||||
|
* 59 temple place, suite 330, boston, ma 02111-1307 usa
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _socketcan_netlink_h
|
||||||
|
#define _socketcan_netlink_h
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief API overview
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/can/netlink.h>
|
||||||
|
|
||||||
|
struct rtnl_link_stats64; /* from <linux/if_link.h> */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int can_do_restart(const char *name);
|
||||||
|
int can_do_stop(const char *name);
|
||||||
|
int can_do_start(const char *name);
|
||||||
|
|
||||||
|
int can_set_restart_ms(const char *name, __u32 restart_ms);
|
||||||
|
int can_set_bittiming(const char *name, struct can_bittiming *bt);
|
||||||
|
int can_set_ctrlmode(const char *name, struct can_ctrlmode *cm);
|
||||||
|
int can_set_bitrate(const char *name, __u32 bitrate);
|
||||||
|
int can_set_bitrate_samplepoint(const char *name, __u32 bitrate, __u32 sample_point);
|
||||||
|
|
||||||
|
int can_get_restart_ms(const char *name, __u32 *restart_ms);
|
||||||
|
int can_get_bittiming(const char *name, struct can_bittiming *bt);
|
||||||
|
int can_get_ctrlmode(const char *name, struct can_ctrlmode *cm);
|
||||||
|
int can_get_state(const char *name, int *state);
|
||||||
|
int can_get_clock(const char *name, struct can_clock *clock);
|
||||||
|
int can_get_bittiming_const(const char *name, struct can_bittiming_const *btc);
|
||||||
|
int can_get_berr_counter(const char *name, struct can_berr_counter *bc);
|
||||||
|
int can_get_device_stats(const char *name, struct can_device_stats *cds);
|
||||||
|
int can_get_link_stats(const char *name, struct rtnl_link_stats64 *rls);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue