public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Hans Fredrik Nordhaug" <hansfn@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-misc/can-utils/, net-misc/can-utils/files/
Date: Fri, 26 Feb 2021 21:18:00 +0000 (UTC)	[thread overview]
Message-ID: <1614374244.2e7aa9eed8f8a1bb10838fc6e11cc41e5884d270.hansfn@gentoo> (raw)

commit:     2e7aa9eed8f8a1bb10838fc6e11cc41e5884d270
Author:     Hans Fredrik Nordhaug <hansfn <AT> gmail <DOT> com>
AuthorDate: Fri Feb 26 21:17:24 2021 +0000
Commit:     Hans Fredrik Nordhaug <hansfn <AT> gmail <DOT> com>
CommitDate: Fri Feb 26 21:17:24 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2e7aa9ee

net-misc/can-utils: New package 2020.12.0

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Hans Fredrik Nordhaug <hansfn <AT> gmail.com>

 net-misc/can-utils/Manifest                    |  2 ++
 net-misc/can-utils/can-utils-2020.02.04.ebuild | 49 ++++++++++++++++++++++++++
 net-misc/can-utils/can-utils-2020.12.0.ebuild  | 49 ++++++++++++++++++++++++++
 net-misc/can-utils/can-utils-9999-r3.ebuild    | 49 ++++++++++++++++++++++++++
 net-misc/can-utils/files/slcan.service         | 19 ++++++++++
 net-misc/can-utils/files/slcan.service.conf    | 18 ++++++++++
 net-misc/can-utils/files/slcand.confd          | 18 ++++++++++
 net-misc/can-utils/files/slcand.initd          | 39 ++++++++++++++++++++
 net-misc/can-utils/metadata.xml                |  8 +++++
 9 files changed, 251 insertions(+)

diff --git a/net-misc/can-utils/Manifest b/net-misc/can-utils/Manifest
new file mode 100644
index 00000000..d6ff0f22
--- /dev/null
+++ b/net-misc/can-utils/Manifest
@@ -0,0 +1,2 @@
+DIST can-utils-2020.02.04.tar.gz 121866 BLAKE2B 64a9e0dbc2e65ef01b6709fc608daecce53592f98c002a46b15a282fff33f52d1d7b34d22ed85f1e2a2eb8a7be6e5ce69a85ba4e2ba19f251994f5022697f474 SHA512 5f12a84b82564da5a47e6dc906bf26f0e56db77ce367b5b72a2820cf18447d78a355d0173c678e33dc0e4cc07ef3a12b3a84d6b016c7ee0b1ac5a7f10daee1c8
+DIST can-utils-2020.12.0.tar.gz 132010 BLAKE2B 626c0b88973c0579728869013f48ec7de4bcd94dd98ed4ae8349a0b71ec2eb9892d267501ff7af58b34ac528f2d6e733aad795582bcc96b03d20ae0710986ea8 SHA512 b9d92b7734611deaf445708aabf4f46f7cf3ad88f46618fbae6821d308b2950da014420b194792e4d2458f396bd85f200a8d10112c10191a98624073b8502c19

diff --git a/net-misc/can-utils/can-utils-2020.02.04.ebuild b/net-misc/can-utils/can-utils-2020.02.04.ebuild
new file mode 100644
index 00000000..eff9dabb
--- /dev/null
+++ b/net-misc/can-utils/can-utils-2020.02.04.ebuild
@@ -0,0 +1,49 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools systemd
+
+DESCRIPTION="CAN userspace utilities and tools"
+HOMEPAGE="https://github.com/linux-can/"
+SRC_URI="https://github.com/linux-can/can-utils/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="systemd"
+
+DEPEND=""
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+# Default src_install + newconfd and newinitd
+src_install() {
+
+	emake DESTDIR="${D}" install
+
+	if ! declare -p DOCS >/dev/null 2>&1 ; then
+		local d
+		for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS \
+				FAQ CREDITS CHANGELOG ; do
+			[[ -s "${d}" ]] && dodoc "${d}"
+		done
+	elif declare -p DOCS | grep -q "^declare -a " ; then
+		dodoc "${DOCS[@]}"
+	else
+		dodoc ${DOCS}
+	fi
+
+	if use systemd ; then
+		systemd_dounit "${FILESDIR}/slcan.service"
+		systemd_install_serviced "${FILESDIR}/slcan.service.conf"
+	else
+		newconfd "${FILESDIR}/slcand.confd" slcand
+		newinitd "${FILESDIR}/slcand.initd" slcand
+	fi
+}

diff --git a/net-misc/can-utils/can-utils-2020.12.0.ebuild b/net-misc/can-utils/can-utils-2020.12.0.ebuild
new file mode 100644
index 00000000..eff9dabb
--- /dev/null
+++ b/net-misc/can-utils/can-utils-2020.12.0.ebuild
@@ -0,0 +1,49 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools systemd
+
+DESCRIPTION="CAN userspace utilities and tools"
+HOMEPAGE="https://github.com/linux-can/"
+SRC_URI="https://github.com/linux-can/can-utils/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="systemd"
+
+DEPEND=""
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+# Default src_install + newconfd and newinitd
+src_install() {
+
+	emake DESTDIR="${D}" install
+
+	if ! declare -p DOCS >/dev/null 2>&1 ; then
+		local d
+		for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS \
+				FAQ CREDITS CHANGELOG ; do
+			[[ -s "${d}" ]] && dodoc "${d}"
+		done
+	elif declare -p DOCS | grep -q "^declare -a " ; then
+		dodoc "${DOCS[@]}"
+	else
+		dodoc ${DOCS}
+	fi
+
+	if use systemd ; then
+		systemd_dounit "${FILESDIR}/slcan.service"
+		systemd_install_serviced "${FILESDIR}/slcan.service.conf"
+	else
+		newconfd "${FILESDIR}/slcand.confd" slcand
+		newinitd "${FILESDIR}/slcand.initd" slcand
+	fi
+}

diff --git a/net-misc/can-utils/can-utils-9999-r3.ebuild b/net-misc/can-utils/can-utils-9999-r3.ebuild
new file mode 100644
index 00000000..1af5ac07
--- /dev/null
+++ b/net-misc/can-utils/can-utils-9999-r3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+EGIT_REPO_URI="https://github.com/linux-can/${PN}.git"
+EGIT_BRANCH="master"
+
+inherit autotools git-r3 systemd
+
+DESCRIPTION="CAN userspace utilities and tools"
+HOMEPAGE="https://github.com/linux-can/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="systemd"
+
+DEPEND=""
+
+src_prepare() {
+	eautoreconf
+}
+
+# Default src_install + newconfd and newinitd
+src_install() {
+
+	emake DESTDIR="${D}" install
+
+	if ! declare -p DOCS >/dev/null 2>&1 ; then
+		local d
+		for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS \
+				FAQ CREDITS CHANGELOG ; do
+			[[ -s "${d}" ]] && dodoc "${d}"
+		done
+	elif declare -p DOCS | grep -q "^declare -a " ; then
+		dodoc "${DOCS[@]}"
+	else
+		dodoc ${DOCS}
+	fi
+
+	if use systemd ; then
+		systemd_dounit "${FILESDIR}/slcan.service"
+		systemd_install_serviced "${FILESDIR}/slcan.service.conf"
+	else
+		newconfd "${FILESDIR}/slcand.confd" slcand
+		newinitd "${FILESDIR}/slcand.initd" slcand
+	fi
+}

diff --git a/net-misc/can-utils/files/slcan.service b/net-misc/can-utils/files/slcan.service
new file mode 100644
index 00000000..01e4b3d7
--- /dev/null
+++ b/net-misc/can-utils/files/slcan.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Userspace daemon for serial line CAN interface driver SLCAN
+
+[Service]
+Environment=can_speed=S5
+Environment=tty_baud=460800
+Environment=tty_device=ttyUSB0
+Environment=can_device=can0
+
+
+ExecStartPre=/sbin/modprobe slcan
+ExecStartPre=/bin/stty -F /dev/${tty_device} ${tty_baud} line 0 cs8 -onlcr -echo raw min 100 time 2
+ExecStartPre=/bin/sh -c 'echo -e -n "C\rF\r${can_speed}\rO\r" > /dev/${tty_device}'
+
+ExecStart=/usr/bin/slcand -F ${tty_device} ${can_device}
+ExecStartPost=/bin/sleep 1
+ExecStartPost=/bin/ip link set can0 txqueuelen 1000 up
+
+ExecStopPost=/sbin/modprobe -r slcan

diff --git a/net-misc/can-utils/files/slcan.service.conf b/net-misc/can-utils/files/slcan.service.conf
new file mode 100644
index 00000000..c29e8b83
--- /dev/null
+++ b/net-misc/can-utils/files/slcan.service.conf
@@ -0,0 +1,18 @@
+# This file contains the configuration for the slcan daemon
+
+
+
+# The `stty' command includes support for speeds of 57600, 115200,
+# 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
+# 2000000, 2500000, 3000000, 3500000, or 4000000
+
+# 921600 baud for S6
+# 460800 baud for S5
+
+# Case sensitive speed setting
+
+[Service]
+Environment=can_speed=S5
+Environment=tty_baud=460800
+Environment=tty_device=ttyUSB0
+Environment=can_device=can0

diff --git a/net-misc/can-utils/files/slcand.confd b/net-misc/can-utils/files/slcand.confd
new file mode 100644
index 00000000..725fcd10
--- /dev/null
+++ b/net-misc/can-utils/files/slcand.confd
@@ -0,0 +1,18 @@
+# /etc/conf.d/slcand
+# This file contains the configuration for the slcan daemon
+
+
+
+# The `stty' command includes support for speeds of 57600, 115200,
+# 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
+# 2000000, 2500000, 3000000, 3500000, or 4000000
+
+# 921600 baud for S6
+# 460800 baud for S5
+
+# Case sensitive speed setting
+
+can_speed="S5"
+tty_baud="460800"
+tty_device="ttyUSB0"
+can_device="can0"

diff --git a/net-misc/can-utils/files/slcand.initd b/net-misc/can-utils/files/slcand.initd
new file mode 100644
index 00000000..ffe08a9b
--- /dev/null
+++ b/net-misc/can-utils/files/slcand.initd
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 2013 Brunvoll AS
+
+
+start() {
+
+	if [ -z "${can_speed}" -o -z "${tty_baud}" -o -z "${tty_device}" -o -z "${can_device}" ]; then
+		eerror "CAN speed, CAN device, tty_baud or tty_device not set"
+		return 1
+	fi
+
+	if ! grep -q slcan /proc/modules; then
+		einfo "Loading module slcan"
+		modprobe slcan || return 1
+	fi
+
+	ebegin "Creating can0 at speed ${can_speed} on device ${tty_device}"		
+	einfo "Setting baudrate of ${tty_device} to ${tty_baud}"
+	stty -F /dev/${tty_device} ${tty_baud} line 0 cs8 -onlcr -echo raw min 100 time 2
+	sleep 1
+	einfo "Set bitrate of slcan on ${tty_device} to ${can_speed}: "
+	echo -e -n "C\rF\r${can_speed}\rO\r" > /dev/${tty_device}
+	sleep 1
+	einfo "Starting slcand"
+	start-stop-daemon --start --background --make-pidfile \
+					  --pidfile /var/run/slcand.pid \
+					  --exec /usr/bin/slcand -- ${tty_device} ${can_device}
+	sleep 1
+	ifconfig ${can_device} up
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping slcand"
+	start-stop-daemon --stop --quiet --pidfile /var/run/slcand.pid
+	sleep 1
+	rmmod slcan
+	eend $?
+}

diff --git a/net-misc/can-utils/metadata.xml b/net-misc/can-utils/metadata.xml
new file mode 100644
index 00000000..1c142c04
--- /dev/null
+++ b/net-misc/can-utils/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+    <maintainer type="person">
+        <email>hansfn@gmail.com</email>
+        <name>Hans Fredrik Nordhaug</name>
+    </maintainer>
+</pkgmetadata>


             reply	other threads:[~2021-02-26 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 21:18 Hans Fredrik Nordhaug [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-09  7:12 [gentoo-commits] repo/proj/guru:dev commit in: net-misc/can-utils/, net-misc/can-utils/files/ Hans Fredrik Nordhaug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1614374244.2e7aa9eed8f8a1bb10838fc6e11cc41e5884d270.hansfn@gentoo \
    --to=hansfn@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox