1

I am under the impression that when a USB, serial, or GPIB device is plugged into a computer, the computer and the device go through some sort of handshake and the device is assigned an address. It seems like I should be able to set up an event to trigger on this, and do some initialization action whenever a device is plugged in. I am using pyvisa to communicate with devices, but I have not been able to find any documentation about their events. How do I set up such an event?

I know I could use list_resources() to check what devices are available every second or something, but this seems hacky. Does listing the resources actually query the resources, or just list the ones it already knows?

roboguy222
  • 157
  • 13
  • 1
    It can't query resources. Many resources don't support stateless, multiple conversations, particularly serial. For USB the OS does notify every listening process. For GPIB the controller does know and can be queried. What your VISA does depends on which one it is. A VISA resource manager does not _have_ to do anything but return a list of zero or more resources. They are likely to list all local plug and play resources and any registered ones if they have such a feature. The idea is to return known resources, regardless of presence. – Tom Blodget Nov 02 '16 at 01:20

0 Answers0