- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Calling Open() gives you a handle to the device. You'll have handle to that irrespective of disconnect/connect of other devices to the bus. So I'm not sure what you mean when you say change the internal state. Please elaborate.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The API uses HANDLE in DeviceIOControl to get talk to the device. That handle is mapped to the device and is not going to change (from the OS side) irrespective of how many devices you connect/disconnect.
If device 0 is disconnected and then you call Open(0) it would get you the handle of what used to be device 1 but this won't happen given that you've the disconnect notification to handle this scenario properly.
You can use streamer/control center or any of our example host application to test your scenario. Please test it and let me know if you still have concerns.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure that we are talking about the same thing.
Here is some pseudo-code to explain my scenario.
The problem is that each time the devices are enumerated, the HANDLE values DO change. Since each Open() performs a Close() before, the HANDLE is not a reliable and persitent pointer to "represent" the device and perform background communications with it.
For instance, I have 2 devices connected. The first time "refreshDevices" is called, the handles are 0x2D0 and 0x2F4, and the next time it becomes 0x2FC abd 0x2F8. So, 0x2D0 and 0x2F4 became invalid. What I am supposed to do ?
CCyUSBDevice* fx3DeviceManager = new CCyUSBDevice(some handle); void Wndproc(...)//Called on PNP event (device arrival/removal) { refreshDevices(); } void refreshDevices(void) { for(int deviceIndex = 0 ; deviceIndex < fx3DeviceManager->DeviceCount() ; ++deviceIndex) { fx3DeviceManager->Open(deviceIndex); HANDLE deviceHandle = fx3DeviceManager->DeviceHandle(); if (deviceHandle not already used in my background threads) createSomeBackgroundThreadToCommunicateWith(deviceHandle); } for(each thread using a handle that does not exists any more) closeThatThread(); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is strange. I apologize for the confusion. My bad. I understand the point you're making.
Our host application is also handling it the same way. Please create a tech support case with the details as this needs a proper investigation and discussion.
Note: Having a way to distinguish between the devices like difference in PID or serial number etc is a way to workaround this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I create a tech case for such a "pure software" problem ? The online tech case submission seems related to schematic boards only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our tech support is not just for schematic review. You can create a case using "Create a MyCase" in http://www.cypress.com/?id=4 .You will find "CY software tools" in Inquiry type you can use that to file tech support case for software issues. You can see the various other categories as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Test case open.
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a similar question - is there a safe way to enumerate devices when some of them are in use? Calling CCyUSBDevice::Open() interrupts data transfer in active instances of CCyUSBDevice object.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I have the same Q.
How to work with multiple devices simultaneously? How to use HANDLE?
c++