question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serial Monitor should handle disconnects more gracefully

See original GitHub issue

Edit from maintainers - Temporary solution: https://docs.platformio.org/en/latest/faq/advanced-serial-monitor.html


Serial Monitor should handle disconnects more gracefully

This is a bug report/feature request to improve the serial port functionality in Platform IO.

Configuration

Operating system: Windows 10 x64

PlatformIO Version (platformio --version): PlatformIO Core, version 5.1.1

Description of problem

Using serial monitor on a USB based serial port crashes with Exception

Steps to Reproduce

  1. Start a serial monitor to a device with a USB based serial port: pio device monitor
  2. Reset the device

Actual Results

Exception in thread rx:
Traceback (most recent call last):
  File "C:\Users\camer\.platformio\python3\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\camer\.platformio\python3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\camer\.platformio\penv\lib\site-packages\serial\tools\miniterm.py", line 445, in reader
    data = self.serial.read(self.serial.in_waiting or 1)
  File "c:\users\camer\.platformio\penv\lib\site-packages\serial\serialwin32.py", line 257, in in_waiting
    raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))

Expected Results

An error message designed for a novice user to understand.

Ideally also (optional) automatic reconnect when the device comes back.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
ivankravetscommented, Jun 11, 2022

Hi All!

Great news! Huge refactoring to the device monitor logic and it seems this issue has been solved. Also, automatic reconnection has been implemented.

Please re-test with pio upgrade --dev.

Does it work as expected now?

1reaction
m1cr0labcommented, Jun 16, 2022

@ivankravets Thank you very much for this correction!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update serial monitor after disconnecting from computer?
SerialMonitor has to either signal a "goodbye" before disconnecting, or ( IMO better ) request collected data when ready to receive.
Read more >
Cisco 2511 Terminal Server - graceful disconnect on exit
I am using a Cisco 2511 as a terminal server. I connect the octopus cable to serveral Cisco router consoles. Connections work fine....
Read more >
Solved: Gracefully handling EtherCAT slave connection and ...
Say you have a daisy chain of etherCAT slaves and the last one gets disconnected.
Read more >
6. Configuration notes - Network UPS Tools
First, most of the programs use an uppercase word to declare a configuration directive. This may be something like MONITOR, NOTIFYCMD, ...
Read more >
EZ-Link Connection Issues After a Few Hours - adafruit industries
I can put my computer to sleep, disconnect, reconnect, leave the area, come back and they ... OSX) had a serial monitor open,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found