Auto-detect relay port via ID probe in relay script
This commit is contained in:
parent
828261ac0f
commit
3ec47427cf
3 changed files with 59 additions and 7 deletions
|
|
@ -67,11 +67,18 @@ reboot** — nooit hardcoden. Detectie:
|
|||
|
||||
```bash
|
||||
cd /Users/eddy/src/usbtoggle
|
||||
./relay 1 [poort] # relais aan → USB afgekoppeld (module uit)
|
||||
./relay 0 [poort] # relais uit → USB aangekoppeld (module aan)
|
||||
./relay id [poort] # identificatie (chip-ID)
|
||||
./relay 1 # relais aan → USB afgekoppeld (module uit)
|
||||
./relay 0 # relais uit → USB aangekoppeld (module aan)
|
||||
./relay id # identificatie (chip-ID)
|
||||
./relay 1 /dev/cu.usbserial-XXXX # poort expliciet opgeven (alleen als auto-detect faalt)
|
||||
```
|
||||
|
||||
- Zonder poortargument zoekt het script de module **automatisch**: het
|
||||
probeert alle CH340-poorten (`VID:PID=1A86:7523`) met het `id`-commando
|
||||
en gebruikt de eerste die `ID usbtoggle-relay` antwoordt. De module
|
||||
wordt dus gevonden waar die ook is aangesloten; de poortnaam hoeft
|
||||
nooit hardcoded te worden.
|
||||
|
||||
- Replies: `ON` / `OFF` / `ID ...`; exit 0 = gelukt, exit 1 = fout (usage,
|
||||
poort niet te openen, geen geldige reply).
|
||||
- Het script opent de poort met DTR/RTS gedeasserted (geen CH340 auto-reset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue