0
votes

On a windows OS, how can I get python to detect if anything is plugged in to a specific USB location on the computer. For example "Port_#0002.Hub_#0003"

I've tried pyUSB which worked fine for detecting a specific device, but I couldn't seem to figure out how to just check a specific port/hub location for any kind of device.

1

1 Answers

0
votes

What about polling? Create a Python app that enumerates a list of attached USB devices every couple of seconds or so.

Keep a list/dictionary of your initially detected devices, and compare to that to determine what was attached/detached since your last polling iteration.

This isn't the best approach, and enumerating all the devices takes a short while, so not too sure this would be the most CPU efficient method.