-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathemuccan.service
26 lines (24 loc) · 954 Bytes
/
emuccan.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[Unit]
Description=EMUC-B202 CAN Bus SocketCAN daemon and interfaces
# We need to wait until /dev/ttyCAN0 comes online, see udev rule for details
BindsTo=dev-ttyCAN0.device
After=dev-ttyCAN0.device
[Service]
# emucd daemonizes itself (i.e. forks)
Type=forking
# Load Environment variables for speed
EnvironmentFile=/etc/default/emuccan
# The InnoDisk EMUC start.sh and end.sh scripts do modprobe and rmmod as part
# of the starting and stopping process. And unfortunately it works. If you do
# not rmmod and modprobe on a restart (and sleep), it fails to restart.
ExecStartPre=-/usr/sbin/modprobe emuc2socketcan
ExecStart=/usr/bin/emucd_64 -s${EMUCCAN_SPEED} /dev/ttyCAN0 can0 can1
ExecStartPost=/sbin/ip link set can0 up qlen 1000
ExecStartPost=/sbin/ip link set can1 up qlen 1000
ExecStop=/usr/bin/pkill -2 emucd_64
ExecStop=/usr/bin/sleep 0.2
ExecStop=-/usr/sbin/rmmod emuc2socketcan
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target