platformio/platformio-core

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

Aperta

#5231 aperta il 16 ago 2025

 (1 commento) (0 reazioni) (0 assegnatari)Python (791 fork)batch import
device managementhelp wanted

Metriche repository

Star
 (7329 stelle)
Metriche merge PR
 (Merge medio 109g 16h) (5 PR mergiate in 30 g)

Descrizione

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.

Guida contributor