summaryrefslogtreecommitdiffstats
path: root/conf/files/usr/bin/candev.sh
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-02-06 17:12:28 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-02-06 17:13:49 +0900
commit1fed2c5a38fed8bc91bb6b8a08982303eb9c2e82 (patch)
tree502b5c63a0570d78863311fbd930f1c96b8a2990 /conf/files/usr/bin/candev.sh
parenta98fcb4b99e5a7b14b671e6014ea0b1cc1ea199d (diff)
Change steering to systemd service for ces2019halibut_7.90.0halibut/7.90.07.90.0
Change steering to systemd service for ces2019 Change-Id: I319fb56a302f4f980b43a1b90dee1f36820355fb Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'conf/files/usr/bin/candev.sh')
-rwxr-xr-xconf/files/usr/bin/candev.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/conf/files/usr/bin/candev.sh b/conf/files/usr/bin/candev.sh
new file mode 100755
index 0000000..fc47cb6
--- /dev/null
+++ b/conf/files/usr/bin/candev.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+function execProc(){
+ dev=$1
+
+ if [ "canCK" == ${dev:0:3}"CK" ]; then
+ modprobe can
+ ip link set $dev up type can bitrate 500000
+ elif [ "vcanCK" == ${dev:0:4}"CK" ]; then
+ modprobe vcan
+ ip link add $dev type vcan
+ ip link set $dev up
+ elif [ "slcanCK" == ${dev:0:5}"CK" ]; then
+ modprobe slcan
+ systemctl start usbcan${dev:5:1}
+ ip link set $dev up
+ ip link
+ ifconfig $dev txqueuelen 1000
+ fi
+}
+
+if [ -e /etc/dev-mapping.conf ]; then
+ hs=`cat /etc/dev-mapping.conf | grep hs | cut -d '"' -f 2`
+ ls=`cat /etc/dev-mapping.conf | grep ls | cut -d '"' -f 2`
+else
+ echo -e "[CANbus-mapping]\nhs=\"vcan0\"\nls=\"vcan1\"\n" > /etc/dev-mapping.conf
+ hs=vcan0
+ ls=vcan1
+fi
+
+echo "candev "$hs
+execProc $hs
+if [ $hs != $ls ]; then
+ echo "candev "$ls
+ execProc $ls
+fi