在 Python 中查找串口变化时,有没有办法避免轮询?
Is there a way to avoid polling when looking for serial port changes in Python?
目前我正在使用pySerial及其list_ports.comports()
函数轮询某个vid/pid设备当前可用串口的变化。我想知道是否有办法避免轮询并获得端口更改通知?
可能您必须处理一些 C/C++ 代码,与 Python 集成:https://docs.python.org/3/extending/extending.html。恐怕,这样低级的功能在Python这样的高级编程语言中几乎是不可能的。
另请看这里:
目前我正在使用pySerial及其list_ports.comports()
函数轮询某个vid/pid设备当前可用串口的变化。我想知道是否有办法避免轮询并获得端口更改通知?
可能您必须处理一些 C/C++ 代码,与 Python 集成:https://docs.python.org/3/extending/extending.html。恐怕,这样低级的功能在Python这样的高级编程语言中几乎是不可能的。 另请看这里: