Enhance 5G modem management with integrated web GUI and connection control
- Introduced a web GUI for managing 5G connections, replacing the standalone 5g-router service. - Updated scripts to ensure exclusive access to the AT port, preventing conflicts. - Improved troubleshooting documentation in 5G_MODEM_TROUBLESHOOTING.md, adding checks for processes using the AT port. - Enhanced connection management in the web app, including auto-connect and detailed status APIs. - Updated installation scripts to reflect changes in service management and dependencies.
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Alpine 5G Router – modem status via AT commands (AT_COMMANDS_REFERENCE.md)
|
||||
# Outputs JSON. Used by Web GUI /api/status.
|
||||
# Rev: 2 (see REVISION in repo root)
|
||||
# Rev: 3 (see REVISION in repo root)
|
||||
|
||||
CONFIG="/etc/5g-router.conf"
|
||||
AT_PORT="${AT_PORT:-/dev/ttyUSB1}"
|
||||
[ -f "$CONFIG" ] && . "$CONFIG"
|
||||
AT_LOCK="/var/lock/5g-at.lock"
|
||||
[ -f "$CONFIG" ] && . "$CONFIG" || true
|
||||
|
||||
# Acquire exclusive lock on AT port to avoid conflicts with connect-5g.sh
|
||||
exec 9>"$AT_LOCK"
|
||||
flock -w 10 9 || { echo '{"error":"AT port busy"}'; exit 1; }
|
||||
|
||||
get_at() {
|
||||
_cmd="$1"
|
||||
_wait="${2:-1}"
|
||||
timeout $((_wait + 2)) sh -c "
|
||||
[ -c \"$AT_PORT\" ] || exit 1
|
||||
cat $AT_PORT 2>/dev/null &
|
||||
_p=\$!
|
||||
sleep 0.3
|
||||
|
||||
Reference in New Issue
Block a user