platformio/platformio-core

`pio device monitor` doesn't reconnect proactively when resetting ESP32

Open

#5.231 aberto em 16 de ago. de 2025

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Python (791 forks)batch import
device managementhelp wanted

Métricas do repositório

Stars
 (7.329 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Original post to the community: https://community.platformio.org/t/how-can-pio-device-monitor-detect-disconnection/48477?u=riywo


I’m looking for a way to reconnect serial monitor automatically when the device is unplugged then plugged, or pushed the RST. Especially because I want to capture logs from setup(). I’m using Seeed XIAO ESP32 S3 from Windows 11.

Although pio device monitor has auto reconnection by default (#3939), it doesn’t recognize the disconnection itself until I hit any key. Once I hit a key, it tries to send the key and raises an exception, thus reconnects:

(I hit a key)
Disconnected (ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22)))
Reconnecting to COM14    Connected!

I wonder whether we have a workaround or we can add a new feature to do some keepalive check proactively so that it can reconnect immediately?

I'll try to create a PR when I have a time, but please let me know if someone has already solved this problem.

Guia do colaborador