You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.1 KiB
Bash
79 lines
2.1 KiB
Bash
#! /bin/sh
|
|
|
|
# Load default env variables from profiles(e.g. /etc/profile.d/*.sh)
|
|
. /etc/profile
|
|
|
|
start_app()
|
|
{
|
|
# Wait for weston ready, 5 seconds timeout
|
|
counter=0
|
|
while [ ! -e "${XDG_RUNTIME_DIR}/wayland-0" ] && [ $counter -lt 50 ]; do
|
|
sleep 0.1
|
|
counter=$((counter + 1))
|
|
done
|
|
|
|
if wait_for_network; then
|
|
|
|
killall weston 2>/dev/null || true
|
|
sleep 0.5
|
|
/userdata/auseft/WeighUI --domain 13 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/device-daemon > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/Core --domain 13 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/IoCtrl --device gpio --device_id 1 --domain 13 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/HttpServer --domain 13 --port 8081 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/Print --domain 13 --port ttyS2 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/MqttDds --domain 13 --addr ws://10.180.4.1:8083 --user auseft --password 1q2w3E** > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/Led --domain 13 --type 1 --addr 192.168.6.147 > /dev/null 2>&1 &
|
|
sleep 0.5
|
|
/userdata/auseft/ReadCard --domain 13 > /dev/null 2>&1 &
|
|
else
|
|
echo "network failed."
|
|
fi
|
|
}
|
|
|
|
wait_for_network()
|
|
{
|
|
local interface="eth0"
|
|
local retries=50
|
|
local count=0
|
|
|
|
echo "wait network $interface start..."
|
|
|
|
while [ $count -lt $retries ]; do
|
|
if ip link show $interface | grep -q "state UP"; then
|
|
echo "$interface started."
|
|
return 0
|
|
fi
|
|
sleep 1
|
|
count=$((count + 1))
|
|
done
|
|
|
|
echo "network $interface start failed, retry $retries times."
|
|
return 1
|
|
}
|
|
|
|
case $1 in
|
|
start)
|
|
#sh /oem/RkLunch.sh
|
|
ip link set can0 type can bitrate 500000 dbitrate 1000000 fd on
|
|
ip link set up can0
|
|
echo 34 > /sys/class/gpio/export
|
|
echo out > /sys/class/gpio/gpio34/direction
|
|
echo 1 > /sys/class/gpio/gpio34/value
|
|
# start_app
|
|
;;
|
|
stop)
|
|
#sh /oem/RkLunch-stop.sh
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop}"
|
|
;;
|
|
esac
|