I am developing some application that uses device, with FTDI
chip on board, connected to PC through USB. Application uses ft2xx.dll. It will be very nice If my application would be able to recognize device removal and insertion. I can do it with some timer, that constantly tries to write or read something from device, and according to success or fault it will tell to my application that the device is connected or disconnected. But it is an ugly solution for sure. I know there are events risen in Windows when I connect and disconnect device.
So my question is: How can I subscribe to those events in my Winforms C# application, and if I have this event, how would I know that this is the device I need? I mean that I need to be able to identify this devise also.
Important thing is: It is bad idea to try to identify device by it's serial number or some other ID, because those things changes from device to device, I need something like type-identifier. (When you plug in your iPhone, PC knows it is iPhone, no matter it is your's or the one your wife have, right?)
And another pain is: both x86 and x64 are meant to work.
I have searched for answer a bit, but unfortunately my low level knowledge of C++ limited my understanding quite a lot. So, may be someone have wrote C# wrapper for those things?
Any help will be appreciated, both links to relevant information and working code