Skip to content

multiple serial ports mounted from usb_cdc breaks REPL auto connect scripts (6.2.0 beta 3) #4364

Closed
@maholli

Description

@maholli

Awesome new usb_cdc capability creates multiple serial ports when connecting to PC/Mac/Linux machine. The REPL port number is not consistently highest/lowest number which causes issues for scripts written to auto-connect to CP boards. @dhalbert suggested this issue be created:

Some of the scripts my students and I use:

Windows Batch:

@echo off
python -c "import serial.tools.list_ports as ls; p=ls.comports(); [print(i[0]) for i in p]" > Output
SET /p SERPORT=<Output
START putty.exe -serial %SERPORT% 115200
DEL Output

AutoHotKey

#c::
COMPort := Object()
COMPortName := Object()
Num:=0
Loop, HKLM, HARDWARE\DEVICEMAP\SERIALCOMM\
{
    RegRead, OutputVar
    If not InStr("%OutputVar%", "COM3")
      Run "putty.exe" "-serial" "%OutputVar%" "115200"
      Exit
    COMPort%Num%:=OutputVar
    COM_result:=COMPort%Num%
    Num+=1
}
Return

Python one-liner

python -c "import serial.tools.list_ports as ls; p=ls.comports(); [print(i[0]) for i in p]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions