Click here to Skip to main content
15,885,622 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi everyone.
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 :)

Regards, Artem
Posted

1 solution

Hi,

please read my solution some time ago, a near similar question:
Working with USB Devices[^]

Especially following great CP-Article:

A USB Library to Detect USB Devices[^]

In addition there must be some hardware-id which is stored/recognized/integrated drivers of win (sometimes through windows update), if iphone was plugged in.

Unfortunately I'm not 100% sure, but I think PNP-ID/Device ID should be always the same id, you're right, serial number is unique.

Regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900