AllenNeuralDynamics / AllenNeuralDynamics/python-newscale
USBInterface: raise a well-defined exception if the "port" given does not correspond to a NewScale controller
- 主要语言
- Python
- 星标
- 1
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
评估
这个 Issue 还没有评估数据。