diff options
Diffstat (limited to 'conf')
-rw-r--r-- | conf/files/etc/gear_shift_para.json | 32 | ||||
-rw-r--r-- | conf/files/etc/steering_wheel.json | 5 | ||||
-rw-r--r-- | conf/files/etc/steering_wheel_map.json | 84 | ||||
-rw-r--r-- | conf/files/etc/udev/rules.d/90-wheel.rules | 1 | ||||
-rw-r--r-- | conf/files/lib/systemd/system/usbcan0.service | 8 | ||||
-rw-r--r-- | conf/files/lib/systemd/system/usbcan1.service | 8 | ||||
-rw-r--r-- | conf/files/lib/systemd/system/wheel.service | 7 | ||||
-rwxr-xr-x | conf/files/usr/bin/candev.sh | 36 |
8 files changed, 181 insertions, 0 deletions
diff --git a/conf/files/etc/gear_shift_para.json b/conf/files/etc/gear_shift_para.json new file mode 100644 index 0000000..3b58da7 --- /dev/null +++ b/conf/files/etc/gear_shift_para.json @@ -0,0 +1,32 @@ +{ + "GEAR_PARA" : [ + { + "POS" : "First", + "VAL" : "4.12", + }, + { + "POS" : "Second", + "VAL" : "2.84", + }, + { + "POS" : "Third", + "VAL" : "2.28", + }, + { + "POS" : "Fourth", + "VAL" : "1.45", + }, + { + "POS" : "Fifth", + "VAL" : "1.0", + }, + { + "POS" : "Sixth", + "VAL" : "0.69", + }, + { + "POS" : "Reverse", + "VAL" : "3.21", + }, + ] +}
\ No newline at end of file diff --git a/conf/files/etc/steering_wheel.json b/conf/files/etc/steering_wheel.json new file mode 100644 index 0000000..d470628 --- /dev/null +++ b/conf/files/etc/steering_wheel.json @@ -0,0 +1,5 @@ +{ + "dev_name": "/dev/input/js0", + "wheel_map": "/etc/steering_wheel_map.json", + "gear_para": "/etc/gear_shift_para.json" +} diff --git a/conf/files/etc/steering_wheel_map.json b/conf/files/etc/steering_wheel_map.json new file mode 100644 index 0000000..86fbd7c --- /dev/null +++ b/conf/files/etc/steering_wheel_map.json @@ -0,0 +1,84 @@ +{ + "PROPERTYS" : [ + { + "PROPERTY" : "VehicleSpeed", + "TYPE" : "uint16_t", + "CANID" : "3E9", + "BIT_POSITION" : "0", + "BIT_SIZE" : "15", + "DLC" : "8" + }, + { + "PROPERTY" : "EngineSpeed", + "TYPE" : "uint16_t", + "CANID" : "3D9", + "BIT_POSITION" : "16", + "BIT_SIZE" : "16", + "DLC" : "8" + }, + { + "PROPERTY" : "AcceleratorPedalPosition", + "TYPE" : "uint16_t", + "CANID" : "5D1", + "BIT_POSITION" : "16", + "BIT_SIZE" : "8", + "DLC" : "8" + }, + { + "PROPERTY" : "TransmissionGearInfo", + "TYPE" : "uint16_t", + "CANID" : "5D2", + "BIT_POSITION" : "20", + "BIT_SIZE" : "4", + "DLC" : "8" + }, + { + "PROPERTY" : "TransmissionMode", + "TYPE" : "uint16_t", + "CANID" : "5D2", + "BIT_POSITION" : "16", + "BIT_SIZE" : "4", + "DLC" : "8" + }, + { + "PROPERTY" : "SteeringWheelAngle", + "TYPE" : "uint16_t", + "CANID" : "5D1", + "BIT_POSITION" : "4", + "BIT_SIZE" : "12", + "DLC" : "8" + }, + { + "PROPERTY" : "TurnSignalStatus", + "TYPE" : "uint16_t", + "CANID" : "5D3", + "BIT_POSITION" : "26", + "BIT_SIZE" : "3", + "DLC" : "8" + }, + { + "PROPERTY" : "LightStatusBrake", + "TYPE" : "bool", + "CANID" : "5D3", + "BIT_POSITION" : "7", + "BIT_SIZE" : "1", + "DLC" : "8" + }, + { + "PROPERTY" : "ParkingStatusBrake", + "TYPE" : "bool", + "CANID" : "5D3", + "BIT_POSITION" : "8", + "BIT_SIZE" : "1", + "DLC" : "8" + }, + { + "PROPERTY" : "FuelLevel", + "TYPE" : "uint16_t", + "CANID" : "3D9", + "BIT_POSITION" : "8", + "BIT_SIZE" : "8", + "DLC" : "8" + } + ] +} diff --git a/conf/files/etc/udev/rules.d/90-wheel.rules b/conf/files/etc/udev/rules.d/90-wheel.rules new file mode 100644 index 0000000..09b9d46 --- /dev/null +++ b/conf/files/etc/udev/rules.d/90-wheel.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEMS=="input", KERNELS=="input[0-9]*", ATTRS{name}=="Logitech G29 Driving Force Racing Wheel", RUN+="/bin/systemctl start wheel.service" diff --git a/conf/files/lib/systemd/system/usbcan0.service b/conf/files/lib/systemd/system/usbcan0.service new file mode 100644 index 0000000..12dc9e1 --- /dev/null +++ b/conf/files/lib/systemd/system/usbcan0.service @@ -0,0 +1,8 @@ +[Unit] +Description=slcan0 starter +After=remote-fs.target +After=syslog.target + +[Service] +ExecStart=/usr/bin/slcand -F -o -s6 -t hw -S 3000000 /dev/ttyUSB0 +Restart=on-failure diff --git a/conf/files/lib/systemd/system/usbcan1.service b/conf/files/lib/systemd/system/usbcan1.service new file mode 100644 index 0000000..a2b4d1a --- /dev/null +++ b/conf/files/lib/systemd/system/usbcan1.service @@ -0,0 +1,8 @@ +[Unit] +Description=slcan1 starter +After=remote-fs.target +After=syslog.target + +[Service] +ExecStart=/usr/bin/slcand -F -o -s6 -t hw -S 3000000 /dev/ttyUSB1 +Restart=on-failure diff --git a/conf/files/lib/systemd/system/wheel.service b/conf/files/lib/systemd/system/wheel.service new file mode 100644 index 0000000..85c881f --- /dev/null +++ b/conf/files/lib/systemd/system/wheel.service @@ -0,0 +1,7 @@ +[Unit] +Description=wheel-service starter +After=syslog.target + +[Service] +ExecStart=/usr/bin/wheel-service +Restart=on-failure 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 |