AllenNeuralDynamics / AllenNeuralDynamics/python-newscale

USBInterface: raise a well-defined exception if the "port" given does not correspond to a NewScale controller

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

consider the use case of trying to scan for connected USB newscale controllers. one way to get a list of port/device names (e.g. COM1, or /dev/ttyUSB0), would be to do something like:

```
from serial.tools.list_ports import comports as list_comports
candidates = [cp.device for cp in list_comports()]
```

in `candidates`, you will likely get a combination of true NewScale devices, and other random serial devices. if you try to call USBInterface("/dev/ttyS0") on Linux, you will get `ValueError: '' is not a valid TransceiverCmd`. if you try this on Windows for a non-Newscale device (e.g. COM1), you get `serial.serialutil.SerialException`.

it would be nice to have a single, clear exception defined by this package, for cases where it tries to instantiate a USBInterface on a non-NewScale device name.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.