-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.sh
More file actions
executable file
·44 lines (34 loc) · 1016 Bytes
/
Copy pathmonitor.sh
File metadata and controls
executable file
·44 lines (34 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -euo pipefail
MONITOR_BAUD="${1:-115200}"
MONITOR_PORT="${2:-}"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$PROJECT_DIR"
PYTHON_BIN="$PROJECT_DIR/.venv/bin/python"
if [[ ! -x "$PYTHON_BIN" ]]; then
echo "Fehler: Python aus .venv nicht gefunden: $PYTHON_BIN"
exit 1
fi
sudo modprobe usbserial || true
sudo modprobe cp210x || true
if [[ -z "$MONITOR_PORT" ]]; then
for candidate in /dev/ttyUSB* /dev/ttyACM*; do
if [[ -e "$candidate" ]]; then
MONITOR_PORT="$candidate"
break
fi
done
fi
if [[ -z "$MONITOR_PORT" ]]; then
echo "Kein serieller Port gefunden."
echo "Prüfe USB-Passthrough (usbipd attach --wsl ...) und versuche erneut."
exit 2
fi
if [[ ! -e "$MONITOR_PORT" ]]; then
echo "Port existiert nicht: $MONITOR_PORT"
exit 3
fi
sudo chmod 666 "$MONITOR_PORT" || true
echo "Nutze Monitor-Port: $MONITOR_PORT"
echo "Baudrate: $MONITOR_BAUD"
"$PYTHON_BIN" -m platformio device monitor -p "$MONITOR_PORT" -b "$MONITOR_BAUD"