Update socat-at-bridge to 1.1.1
- Fixed an issue causing the bridge to not properly form at boot - A single file is executed with procd now instead for each smd device (AT Coammnd stream)
This commit is contained in:
37
ipk-source/socat-at-bridge/root/usr/sbin/socat-at-bridge-smd7.sh
Executable file
37
ipk-source/socat-at-bridge/root/usr/sbin/socat-at-bridge-smd7.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/ash
|
||||
|
||||
# Optional logging for debugging
|
||||
LOGFILE="/var/log/socat-bridge-smd7.log"
|
||||
|
||||
# Start socat to create virtual TTY devices
|
||||
echo "$(date): Starting socat..." >> "$LOGFILE"
|
||||
socat -d -d pty,link=/dev/ttySMD7IN,raw,echo=0,group=20,perm=660 \
|
||||
pty,link=/dev/ttySMD7,raw,echo=1,group=20,perm=660 &
|
||||
SOCAT_PID=$!
|
||||
|
||||
# Allow socat to initialize
|
||||
sleep 1
|
||||
|
||||
# Start forwarding data from /dev/smd7 to /dev/ttySMD7IN
|
||||
echo "$(date): Starting forward from /dev/smd7 to /dev/ttySMD7IN..." >> "$LOGFILE"
|
||||
cat /dev/smd7 > /dev/ttySMD7IN &
|
||||
CAT1_PID=$!
|
||||
|
||||
# Start forwarding data from /dev/ttySMD7IN to /dev/smd7
|
||||
echo "$(date): Starting forward from /dev/ttySMD7IN to /dev/smd7..." >> "$LOGFILE"
|
||||
cat /dev/ttySMD7IN > /dev/smd7 &
|
||||
CAT2_PID=$!
|
||||
|
||||
# Handle script termination and cleanup
|
||||
cleanup() {
|
||||
echo "$(date): Cleaning up processes..." >> "$LOGFILE"
|
||||
kill "$SOCAT_PID" "$CAT1_PID" "$CAT2_PID" 2>/dev/null
|
||||
wait
|
||||
echo "$(date): All processes stopped." >> "$LOGFILE"
|
||||
}
|
||||
|
||||
# Trap termination signals to run cleanup
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
# Wait for all background processes to finish
|
||||
wait
|
||||
37
ipk-source/socat-at-bridge/root/usr/sbin/socat-at-bridge.sh
Executable file
37
ipk-source/socat-at-bridge/root/usr/sbin/socat-at-bridge.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/ash
|
||||
|
||||
# Optional logging for debugging
|
||||
LOGFILE="/var/log/socat-bridge.log"
|
||||
|
||||
# Start socat to create virtual TTY devices
|
||||
echo "$(date): Starting socat..." >> "$LOGFILE"
|
||||
socat -d -d pty,link=/dev/ttySMD11IN,raw,echo=0,group=20,perm=660 \
|
||||
pty,link=/dev/ttySMD11,raw,echo=1,group=20,perm=660 &
|
||||
SOCAT_PID=$!
|
||||
|
||||
# Allow socat to initialize
|
||||
sleep 1
|
||||
|
||||
# Start forwarding data from /dev/smd11 to /dev/ttySMD11IN
|
||||
echo "$(date): Starting forward from /dev/smd11 to /dev/ttySMD11IN..." >> "$LOGFILE"
|
||||
cat /dev/smd11 > /dev/ttySMD11IN &
|
||||
CAT1_PID=$!
|
||||
|
||||
# Start forwarding data from /dev/ttySMD11IN to /dev/smd11
|
||||
echo "$(date): Starting forward from /dev/ttySMD11IN to /dev/smd11..." >> "$LOGFILE"
|
||||
cat /dev/ttySMD11IN > /dev/smd11 &
|
||||
CAT2_PID=$!
|
||||
|
||||
# Handle script termination and cleanup
|
||||
cleanup() {
|
||||
echo "$(date): Cleaning up processes..." >> "$LOGFILE"
|
||||
kill "$SOCAT_PID" "$CAT1_PID" "$CAT2_PID" 2>/dev/null
|
||||
wait
|
||||
echo "$(date): All processes stopped." >> "$LOGFILE"
|
||||
}
|
||||
|
||||
# Trap termination signals to run cleanup
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
# Wait for all background processes to finish
|
||||
wait
|
||||
Reference in New Issue
Block a user