platformio / platformio/platformio-core
`pio device monitor` doesn't reconnect proactively when resetting ESP32
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.5k
- Forks
- 905
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pio device monitor entry point and reproduce the reset or unplug/replug behavior on Windows 11 with the Seeed XIAO ESP32 S3. Check how disconnection is detected without keyboard input; done means the monitor notices the disconnect and reconnects automatically so logs from setup() can be captured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100