[packages/can-utils] Initial

arekm arekm at pld-linux.org
Tue Jun 30 23:17:27 CEST 2026


commit dda5617abefabf3a377f073b08a42d83df303fbb
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Jun 30 23:16:39 2026 +0200

    Initial

 can-utils-cmake-policy.patch |  34 ++++++++
 can-utils.spec               | 186 +++++++++++++++++++++++++++++++++++++++++++
 slcand.init                  |  75 +++++++++++++++++
 slcand.service               |  15 ++++
 slcand.sysconfig             |  17 ++++
 5 files changed, 327 insertions(+)
---
diff --git a/can-utils.spec b/can-utils.spec
new file mode 100644
index 0000000..2636d3c
--- /dev/null
+++ b/can-utils.spec
@@ -0,0 +1,186 @@
+Summary:	SocketCAN userspace utilities and tools
+Summary(pl.UTF-8):	Narzędzia użytkownika dla SocketCAN
+Name:		can-utils
+Version:	2025.01
+Release:	1
+License:	GPL v2 or BSD
+Group:		Networking/Admin
+Source0:	https://github.com/linux-can/can-utils/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	52059a7100e30ab3be6412f993607cc7
+Source1:	slcand.init
+Source2:	slcand.sysconfig
+Source3:	slcand.service
+Patch0:		%{name}-cmake-policy.patch
+URL:		https://github.com/linux-can/can-utils
+BuildRequires:	cmake >= 3.5
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+CAN is a message-based network protocol designed for vehicles,
+originally created by Robert Bosch GmbH. SocketCAN is a set of CAN
+drivers and a networking stack for the Linux kernel, contributed by
+Volkswagen Research.
+
+This package contains userspace utilities for the Linux SocketCAN
+subsystem: tools to display, record, generate and replay CAN traffic
+(candump, canplayer, cansend, cangen, cansniffer, cansequence); CAN
+access via IP sockets (canlogserver, bcmserver); in-kernel CAN gateway
+configuration (cangw); CAN bus measurement and testing (canbusload,
+can-calc-bit-timing, canfdtest); ISO-TP (ISO 15765-2) tools
+(isotpsend, isotprecv, isotpsniffer, isotpdump, isotpserver,
+isotpperf, isotptun); CAN log file converters (asc2log, log2asc,
+log2long); serial line discipline configuration for the slcan driver
+(slcan_attach, slcand, slcanpty); SAE J1939 tools (j1939acd, j1939cat,
+j1939spy, j1939sr, testj1939, j1939-timedate-cli, j1939-timedate-srv);
+and a coredump dumper for Microchip MCP251xFD CAN-FD controllers
+(mcp251xfd-dump).
+
+%description -l pl.UTF-8
+CAN to oparty na komunikatach protokół sieciowy zaprojektowany do
+zastosowań motoryzacyjnych, opracowany pierwotnie przez Robert Bosch
+GmbH. SocketCAN to zestaw sterowników CAN oraz stos sieciowy dla jądra
+Linux, opracowany przez Volkswagen Research.
+
+Ten pakiet zawiera narzędzia użytkownika dla podsystemu SocketCAN w
+jądrze Linux: programy do wyświetlania, nagrywania, generowania i
+odtwarzania ruchu CAN (candump, canplayer, cansend, cangen,
+cansniffer, cansequence); dostęp do CAN przez gniazda IP
+(canlogserver, bcmserver); konfigurację działającej w jądrze bramki
+CAN (cangw); pomiary i testowanie magistrali CAN (canbusload,
+can-calc-bit-timing, canfdtest); narzędzia ISO-TP (ISO 15765-2)
+(isotpsend, isotprecv, isotpsniffer, isotpdump, isotpserver,
+isotpperf, isotptun); konwertery formatów logów CAN (asc2log, log2asc,
+log2long); konfigurację dyscypliny linii szeregowej dla sterownika
+slcan (slcan_attach, slcand, slcanpty); narzędzia SAE J1939 (j1939acd,
+j1939cat, j1939spy, j1939sr, testj1939, j1939-timedate-cli,
+j1939-timedate-srv) oraz program do odczytu zrzutów awaryjnych
+(coredump) kontrolerów CAN-FD Microchip MCP251xFD (mcp251xfd-dump).
+
+%package devel
+Summary:	Headers and isobusfs library for can-utils
+Summary(pl.UTF-8):	Nagłówki oraz biblioteka isobusfs dla can-utils
+Group:		Development/Libraries
+
+%description devel
+Header files and the libisobusfs library, plus the isobusfs-cli and
+isobusfs-srv ISOBUS File Server protocol tools that are linked against
+it.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe oraz biblioteka libisobusfs, a także narzędzia
+isobusfs-cli i isobusfs-srv obsługujące protokół ISOBUS File Server,
+zlinkowane z tą biblioteką.
+
+%package slcand
+Summary:	System service for the slcand SocketCAN serial line daemon
+Summary(pl.UTF-8):	Usługa systemowa demona linii szeregowej SocketCAN slcand
+Group:		Daemons
+Requires:	%{name} = %{version}-%{release}
+Requires(post,preun):	/sbin/chkconfig
+Requires(post,preun,postun):	systemd-units >= 38
+Requires:	rc-scripts
+Requires:	systemd-units >= 38
+
+%description slcand
+SysV init script and systemd unit to run slcand (from the main
+can-utils package) as a system service that attaches a serial line
+CAN adapter to the kernel's slcan line discipline and brings up a CAN
+network interface for it.
+
+%description slcand -l pl.UTF-8
+Skrypt SysV init oraz jednostka systemd do uruchamiania demona slcand
+(z głównego pakietu can-utils) jako usługi systemowej, dołączającej
+adapter CAN podłączony przez linię szeregową do dyscypliny linii
+slcan w jądrze i uruchamiającej dla niego interfejs sieciowy CAN.
+
+%prep
+%setup -q
+%patch -P0 -p1
+
+%build
+install -d build
+cd build
+%cmake .. \
+	-DCMAKE_INSTALL_LIBDIR=%{_lib}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{systemdunitdir} \
+	$RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+
+%{__make} -C build install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/slcand
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/slcand
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	slcand
+/sbin/chkconfig --add slcand
+%systemd_post slcand.service
+
+%preun	slcand
+if [ "$1" = "0" ]; then
+	%service slcand stop
+	/sbin/chkconfig --del slcand
+fi
+%systemd_preun slcand.service
+
+%postun	slcand
+%systemd_reload
+%systemd_trigger slcand.service
+
+%files
+%defattr(644,root,root,755)
+%doc README.md LICENSES
+%attr(755,root,root) %{_bindir}/asc2log
+%attr(755,root,root) %{_bindir}/bcmserver
+%attr(755,root,root) %{_bindir}/can-calc-bit-timing
+%attr(755,root,root) %{_bindir}/canbusload
+%attr(755,root,root) %{_bindir}/candump
+%attr(755,root,root) %{_bindir}/canfdtest
+%attr(755,root,root) %{_bindir}/cangen
+%attr(755,root,root) %{_bindir}/cangw
+%attr(755,root,root) %{_bindir}/canlogserver
+%attr(755,root,root) %{_bindir}/canplayer
+%attr(755,root,root) %{_bindir}/cansend
+%attr(755,root,root) %{_bindir}/cansequence
+%attr(755,root,root) %{_bindir}/cansniffer
+%attr(755,root,root) %{_bindir}/isotpdump
+%attr(755,root,root) %{_bindir}/isotpperf
+%attr(755,root,root) %{_bindir}/isotprecv
+%attr(755,root,root) %{_bindir}/isotpsend
+%attr(755,root,root) %{_bindir}/isotpserver
+%attr(755,root,root) %{_bindir}/isotpsniffer
+%attr(755,root,root) %{_bindir}/isotptun
+%attr(755,root,root) %{_bindir}/j1939acd
+%attr(755,root,root) %{_bindir}/j1939cat
+%attr(755,root,root) %{_bindir}/j1939spy
+%attr(755,root,root) %{_bindir}/j1939sr
+%attr(755,root,root) %{_bindir}/j1939-timedate-cli
+%attr(755,root,root) %{_bindir}/j1939-timedate-srv
+%attr(755,root,root) %{_bindir}/log2asc
+%attr(755,root,root) %{_bindir}/log2long
+%attr(755,root,root) %{_bindir}/mcp251xfd-dump
+%attr(755,root,root) %{_bindir}/slcan_attach
+%attr(755,root,root) %{_bindir}/slcand
+%attr(755,root,root) %{_bindir}/slcanpty
+%attr(755,root,root) %{_bindir}/testj1939
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/isobusfs-cli
+%attr(755,root,root) %{_bindir}/isobusfs-srv
+%{_libdir}/libisobusfs.so
+%{_includedir}/isobusfs_cmn.h
+%{_includedir}/isobusfs_cmn_cm.h
+
+%files slcand
+%defattr(644,root,root,755)
+%attr(754,root,root) /etc/rc.d/init.d/slcand
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/slcand
+%{systemdunitdir}/slcand.service
diff --git a/can-utils-cmake-policy.patch b/can-utils-cmake-policy.patch
new file mode 100644
index 0000000..24e91d5
--- /dev/null
+++ b/can-utils-cmake-policy.patch
@@ -0,0 +1,34 @@
+From 2da0c7e95eb15f8b8f84e7911c7bda96f3490409 Mon Sep 17 00:00:00 2001
+From: Takuya Wakazono <pastalian46 at gmail.com>
+Date: Mon, 19 Jan 2026 15:37:11 +0900
+Subject: [PATCH] cmake: set policy version to 3.10
+
+This project does not rely on any behavior from CMake <3.10, and
+compatibility with CMake <3.10 is expected to be removed in future
+releases.
+
+https://cmake.org/cmake/help/v4.0/manual/cmake-policies.7.html#policies-introduced-by-cmake-3-10
+
+```
+CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
+  Compatibility with CMake < 3.10 will be removed from a future version of
+  CMake.
+
+  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+  to tell CMake that the project requires at least <min> but has been updated
+  to work with policies introduced by <max> or earlier.
+```
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 67cc962a..f42bd559 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.5)
++cmake_minimum_required(VERSION 3.5...3.10)
+ 
+ project(can-utils LANGUAGES C)
+ 
diff --git a/slcand.init b/slcand.init
new file mode 100644
index 0000000..6964afd
--- /dev/null
+++ b/slcand.init
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# slcand	Userspace daemon for serial line (SLCAN) CAN interfaces
+#
+# chkconfig:	2345 26 74
+# description:	slcand attaches a serial line CAN adapter to the \
+#		kernel's slcan line discipline and brings up a CAN \
+#		network interface for it.
+#
+# config:	/etc/sysconfig/slcand
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get service config
+[ -f /etc/sysconfig/slcand ] && . /etc/sysconfig/slcand
+
+# no tty configured. exit silently
+if [ -z "$SLCAND_TTY" ]; then
+	case "$1" in
+		start|stop|restart|reload|force-reload)
+		exit 0
+		;;
+	esac
+fi
+
+start() {
+	if [ ! -f /var/lock/subsys/slcand ]; then
+		msg_starting "slcand ($SLCAND_TTY -> $SLCAND_IF)"
+		daemon /usr/bin/slcand ${SLCAND_OPT} ${SLCAND_TTY} ${SLCAND_IF}
+		RETVAL=$?
+		if [ $RETVAL -eq 0 ]; then
+			sleep 1
+			ip link set ${SLCAND_IF} up
+			touch /var/lock/subsys/slcand
+		fi
+	else
+		msg_already_running "slcand"
+	fi
+}
+
+stop() {
+	if [ -f /var/lock/subsys/slcand ]; then
+		msg_stopping "slcand"
+		ip link set ${SLCAND_IF} down 2>/dev/null
+		killproc slcand
+		rm -f /var/lock/subsys/slcand
+	else
+		msg_not_running "slcand"
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  status)
+	status slcand
+	RETVAL=$?
+	;;
+  restart|force-reload)
+	stop
+	start
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
diff --git a/slcand.service b/slcand.service
new file mode 100644
index 0000000..633fcce
--- /dev/null
+++ b/slcand.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=SocketCAN serial line (SLCAN) interface daemon
+Documentation=man:slcand(8)
+After=network-pre.target
+Before=network.target
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/sysconfig/slcand
+ExecStart=/usr/bin/slcand -F ${SLCAND_OPT} ${SLCAND_TTY} ${SLCAND_IF}
+ExecStartPost=/bin/sh -c 'sleep 1; /sbin/ip link set ${SLCAND_IF} up'
+ExecStopPost=-/sbin/ip link set ${SLCAND_IF} down
+
+[Install]
+WantedBy=multi-user.target
diff --git a/slcand.sysconfig b/slcand.sysconfig
new file mode 100644
index 0000000..36cd7d7
--- /dev/null
+++ b/slcand.sysconfig
@@ -0,0 +1,17 @@
+# Configuration for the slcand daemon (SocketCAN serial line driver).
+#
+# slcand attaches a serial line CAN adapter (LAWICEL/SLCAN protocol,
+# as used by many USB-CAN dongles) to the kernel's slcan line
+# discipline and creates a CAN network interface for it.
+
+# Serial device the adapter is attached to (e.g. ttyUSB0). Leave empty
+# to keep the daemon disabled.
+SLCAND_TTY=""
+
+# Name of the CAN network interface to create.
+SLCAND_IF="can0"
+
+# slcand options: -o open the CAN interface, -c close it on exit,
+# -f read & reset error flags, -s6 sets 500 kbit/s CAN bus speed
+# (see slcand -h for the full -s<N> speed table).
+SLCAND_OPT="-o -c -f -s6"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/can-utils.git/commitdiff/dda5617abefabf3a377f073b08a42d83df303fbb



More information about the pld-cvs-commit mailing list