Files to start venc (#1023)

pull/1027/head
MarioFPV 2023-10-05 20:44:31 +01:00 committed by GitHub
parent 0a44bc09ea
commit 832d907955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,60 @@
#!/bin/sh
DAEMON="venc"
PIDFILE="/var/run/$DAEMON.pid"
DAEMON_ARGS="-s"
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
load_venc() {
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
[ -f /etc/coredump.conf ] && . /etc/coredump.conf
if [ "$coredump_enabled" ]; then
[ "$(cli -g .watchdog.timeout)" -lt "30" ] && cli -s .watchdog.timeout 30
ulimit -c unlimited && echo "|/usr/sbin/sendcoredump.sh" >/proc/sys/kernel/core_pattern
fi
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $DAEMON_ARGS
ln -s /dev/venc /dev/ven
/usr/bin/./venc -p 5600 -f 30 -r 7168 -n 1400 -c 265cbr -d frame -v 200_imx307F -s 720p &
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
start() {
logger -s -p daemon.info -t $(ipcinfo -v) "Loading video system has started..."
export SENSOR=$(fw_printenv -n sensor)
load_venc
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
reload
}
reload() {
load_venc
}
case "$1" in
start|stop|restart|reload)
"$1";;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -0,0 +1,3 @@
echo $1 $2 >>/tmp/channels.log
exit 1

View File

@ -0,0 +1,50 @@
#!/bin/sh
#
# Start telemetry
#
. /etc/datalink.conf
. /etc/telemetry.conf
keydir="/etc"
fw=$(grep "BUILD_OPTION" "/etc/os-release" | cut -d= -f2)
start_telemetry() {
if [ ! -f /usr/bin/telemetry_rx -a ! -f /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx ; chmod +x /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx ; chmod +x /usr/bin/telemetry_tx
else
if [ ${one_way} = "false" ]; then
telemetry_rx -p ${stream_rx} -u ${port_rx} -K ${keydir}/drone.key -i ${link_id} ${wlan} &
fi
telemetry_tx -p ${stream_tx} -u ${port_tx} -K ${keydir}/drone.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} &
fi
}
case "$1" in
start)
echo "Loading MAVLink telemetry service..."
if [ ${router} -eq 1 ] || [ ${fw} = "lte" ]; then
/usr/bin/mavlink-routerd &
else
mavfwd -c 14 --master ${serial} --baudrate ${baud} --out 127.0.0.1:${port_tx} --in 127.0.0.1:${port_rx} &
fi
echo "Firmware is ${fw}"
if [ ${fw} = "fpv" ] || [ ${fw} = "venc" ]; then
start_telemetry
fi
echo "Done."
;;
stop)
echo "Stopping telemetry services..."
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)
kill -9 $(pidof mavfwd)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac