Aquaovo-hz
Aquaovo-hz

Reputation: 1

Pyserial to check COM port

Available COM Ports ON PC: ATEN USB to Serial Bridge(COM10) -- Connected and giving response ATEN USB to Serial Bridge(COM11) -- Connected but not responding INTEL(R) xxx (COM3) Standard Serial xx (COM8) Standard Serial xx (COM9)

My interest is only the two ATEN COM, and only 1 of which can be connected and responding. I want to loop through all available port and find out which is responding..How should I do that?

try .isOpen() == True, but apparently all is True

Upvotes: 0

Views: 66

Answers (1)

Al Roborol
Al Roborol

Reputation: 11

Does “responding” mean actively sending something over UART? If so, you could use select() over each available port and see if the reading is ready. If responding means you can get some reply after sending something, you could loop and write(), then use select() or readline() to check.

Upvotes: 0

Related Questions