Skip to content

Commit

Permalink
Add telemtry init.d service, add socat, mcom utils, configure eth0
Browse files Browse the repository at this point in the history
  • Loading branch information
thxtomslf committed Dec 27, 2024
1 parent a890b59 commit 5d87a96
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 3 deletions.
52 changes: 52 additions & 0 deletions general/overlay/etc/init.d/S96telemetry
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh

DAEMON="Telemetry_Transfer"
PIDFILE="/var/run/$DAEMON.pid"
COMMAND="socat UDP-RECV:2002 STDOUT | mcom -s 420000 /dev/ttyAMA0 | socat - udp-sendto:192.168.144.222:2001"

start() {
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x /bin/sh -- -c "$COMMAND"
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
}

stop() {
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
}

restart() {
stop
sleep 3
start
}


case "$1" in
start)
start
;;

stop)
stop
;;

restart|reload)
restart
;;

*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
123 changes: 123 additions & 0 deletions general/overlay/etc/init.d/S97majestic-config-writer
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/sh

DAEMON="MajesticConfigWriter"
PIDFILE="/var/run/$DAEMON.pid"
CONFIG_FILE="/etc/majestic.yaml"
NEW_CONFIG="system:
webPort: 80
httpsPort: 443
logLevel: debug
isp:
antiFlicker: disabled
slowShutter: disabled
drc: 350
sensorConfig: /etc/sensors/imx335_i2c_4M.ini
image:
mirror: false
flip: false
rotate: 0
contrast: 50
hue: 50
saturation: 50
luminance: 50
video0:
enabled: true
codec: h264
fps: 30
bitrate: 5120
rcMode: cbr
gopSize: 1.5
size: 1920x1080
video1:
enabled: false
codec: h264
size: 704x576
fps: 15
jpeg:
enabled: false
qfactor: 50
fps: 5
osd:
enabled: false
font: \"/usr/share/fonts/truetype/UbuntuMono-Regular.ttf\"
template: \"%d.%m.%Y %H:%M:%S\"
posX: 16
posY: 16
audio:
enabled: false
volume: 30
srate: 8000
codec: opus
outputEnabled: false
outputVolume: 30
rtsp:
enabled: true
port: 554
nightMode:
colorToGray: true
irCutSingleInvert: false
lightMonitor: false
lightSensorInvert: false
motionDetect:
enabled: false
visualize: false
debug: false
records:
enabled: false
path: \"/mnt/mmcblk0p1/%F\"
split: 20
maxUsage: 95
outgoing:
enabled: true
server: udp://192.168.144.222:8000
watchdog:
enabled: true
timeout: 300
hls:
enabled: false
netip:
enabled: false"

start() {
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x /bin/sh -- -c "echo '$NEW_CONFIG' > $CONFIG_FILE"
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
}

stop() {
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
}

restart() {
stop
sleep 1
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac

7 changes: 5 additions & 2 deletions general/overlay/etc/network/interfaces.d/eth0
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
iface eth0 inet dhcp
hwaddress ether $(fw_printenv -n ethaddr || echo 00:00:23:34:45:66)
auto eth0
iface eth0 inet static
address 192.168.144.200
netmask 255.255.255.0
gateway 192.168.1.1
1 change: 1 addition & 0 deletions general/package/majestic/majestic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MAJESTIC_LICENSE_FILES = LICENSE
MAJESTIC_FAMILY = $(OPENIPC_SOC_FAMILY)
MAJESTIC_VARIANT = $(OPENIPC_MAJESTIC)


MAJESTIC_DEPENDENCIES += \
libevent-openipc \
libogg-openipc \
Expand Down
File renamed without changes.
Binary file added general/package/mcom/files/socat
Binary file not shown.
4 changes: 3 additions & 1 deletion general/package/mcom/mcom.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
#
################################################################################

BASE_PATH = /home/pavel

define MCOM_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 /home/pavel/openipc-firmware/general/package/mcom/microcomV2 $(TARGET_DIR)/usr/bin/mcom
$(INSTALL) -D -m 0755 $(BASE_PATH)/openipc-firmware/general/package/mcom/files/socat $(TARGET_DIR)/usr/bin/socat
$(INSTALL) -D -m 0755 $(BASE_PATH)/openipc-firmware/general/package/mcom/files/microcomV2 $(TARGET_DIR)/usr/bin/mcom
endef

$(eval $(generic-package))
Binary file removed general/package/mcom/microcomV2
Binary file not shown.

0 comments on commit 5d87a96

Please sign in to comment.