A newbie question about USB

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
A newbie question about USB.
I am developing a PC application (not driver) to communicate with a USB
2.0 slave peripheral device. I would like to know, if my application
has built a connection and is talking to the USB peripheral, and I
disconnect the cable suddenly, will the application be able to identify
the event automatically, or it will still stay with the "connection"?
Another problem, if I re-connect the usb cable, will the connection be
automatically restored? Should I close my application first and then
start it again to create a connection with the USB peripheral?
Thanks in advance.

Re: A newbie question about USB
Hello Johnson,

Quoted text here. Click to load it

I am not at all a USB expert. However, my digital camera does exactly
that. When I connect it the image transfer routine can automatically
fire up (although I disabled that auto-launch feature lately). When I
unplug the USB link a window pops up announcing that it lost the link.
When I plug it back in the link starts to work again, meaning nothing
has crashed and it is able to recognize a connection.

The PC also recognizes what is connected at the other end. For example,
if I plug in a memory stick instead of the camera the PC sees that and
simply adds it as another drive.

Regards, Joerg


Re: A newbie question about USB
Thank you Joerg.

Re: A newbie question about USB

Quoted text here. Click to load it

Your application will need to register with windows to receive PnP event
(DEVICECHANGE) notifications. When the cable is unplugged, you will
receive DEVICEREMOVE events, and when plugged back in, you'll receive a

However, on removal you'll have to close the connection, and re-open on
arrival. It *won't* be 'automatically' restored - there's no concept of
maintaining a 'connection' whilst a device is unplugged. Of course, this
is an OS implementation issue, and need not have any impact on the
application user (they could "see" a persistent connection - there's no
need to restart the application).


Re: A newbie question about USB
Thank you Mark.

Site Timeline