feat: Auto-detect serial port from /dev/serial/by-id/

When MC_SERIAL_PORT=auto, bridge scans /dev/serial/by-id/ and:
- Uses the device if exactly one found
- Fails with helpful message if multiple devices (list provided)
- Fails if no devices found

docker-compose.yml now uses device_cgroup_rules instead of explicit
device mapping, allowing auto-detection inside the container.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-01-15 15:18:07 +01:00
parent b8a77285ab
commit b2496b17b0
4 changed files with 79 additions and 11 deletions
+7 -4
View File
@@ -6,14 +6,17 @@ services:
dockerfile: Dockerfile
container_name: meshcore-bridge
restart: unless-stopped
devices:
- "${MC_SERIAL_PORT}:${MC_SERIAL_PORT}"
# Grant access to all ttyUSB devices (major 188) for auto-detection
# This allows MC_SERIAL_PORT=auto to work without specifying device upfront
device_cgroup_rules:
- 'c 188:* rmw'
volumes:
- "${MC_CONFIG_DIR}:/root/.config/meshcore:rw"
- "/dev:/dev"
environment:
- MC_SERIAL_PORT=${MC_SERIAL_PORT}
- MC_SERIAL_PORT=${MC_SERIAL_PORT:-auto}
- MC_CONFIG_DIR=/root/.config/meshcore
- MC_DEVICE_NAME=${MC_DEVICE_NAME}
- MC_DEVICE_NAME=${MC_DEVICE_NAME:-auto}
- TZ=${TZ:-UTC}
networks:
- meshcore-net