Skip to content

Serial Monitor should handle disconnects more gracefully #3939

@cinderblock

Description

@cinderblock

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions