mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
feat: add mock Teensy support with entrypoint and LTC generator
Co-authored-by: aider (openai/gpt-5) <aider@aider.chat>
This commit is contained in:
parent
ddbdf8cb72
commit
f855cac040
4 changed files with 76 additions and 0 deletions
27
scripts/entrypoint.sh
Normal file
27
scripts/entrypoint.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# If enabled, start a mock Teensy that exposes a PTY at /dev/ttyACM0 and streams LTC-like lines.
|
||||
if [ "${MOCK_TEENSY:-0}" = "1" ]; then
|
||||
echo "[entrypoint] Starting mock Teensy (PTY at /dev/ttyACM0)..." >&2
|
||||
# Bridge the LTC generator to a PTY that looks like a Teensy serial port.
|
||||
# Left side runs the generator, right side is a PTY linked to /dev/ttyACM0
|
||||
socat -d -d -lf /dev/stderr EXEC:'/usr/local/bin/ltc-gen.sh',pty,ctty,echo=0,raw PTY,link=/dev/ttyACM0,raw,echo=0 &
|
||||
SOCAT_PID=$!
|
||||
|
||||
# Wait briefly for the PTY to appear
|
||||
i=0
|
||||
while [ $i -lt 50 ]; do
|
||||
if [ -e /dev/ttyACM0 ]; then
|
||||
break
|
||||
fi
|
||||
i=$((i+1))
|
||||
sleep 0.1
|
||||
done
|
||||
if [ ! -e /dev/ttyACM0 ]; then
|
||||
echo "[entrypoint] WARNING: Failed to create /dev/ttyACM0 (mock Teensy)" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the requested command (default: get-haci)
|
||||
exec "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue