CyAPI Question - Tracking Devices | Cypress Semiconductor
CyAPI Question - Tracking Devices
Now that the firmware is working, I'm focusing on the application side. The application I'm adapting to USB was written in C (originally written for Windows 2.0 and only recently ported to 32 bit Windows and VC 2005).
The system currently runs with one ISA card in a PC and a daisy chain cable running between multiple external chassis (up to 5). With USB, there will be a USB card in each chassis and I need to keep track of which card is which. At initialization I run a scan to detect the hardware in each chassis and then that is stored in an array in memory that is cross referenced to which USB device has which hardware.
I'm looking at the documentation for CyAPI and the cydesc sample. I see that getting the descriptor and a CCyUSBConfig object are fairly easy, but it looks like they don't tell me anything unique about a given instance of a device. The only thing I can see that is unique is the index used by Open(). Will this index stay the same even if the user plugs in or removes another device that uses CyUSB.sys? I'm not concerned with the user plugging or unplugging our cards while in operation. If they did that for any reason, it would be cause to restart the application afterwards.
Since CyAPI sees all devices that use CyUSB.sys it is conceivable that the user might plug or unplug another device that uses the same driver while the system is in operation and I need to deal with that possibility. If that changes the indexes, then that will crash our system.
Is there something else unique to each instance that I can use to keep track of the devices?