Reply by Johnson October 4, 20052005-10-04
Thank you Joerg.

Reply by Johnson October 4, 20052005-10-04
Thank you Mark.

Reply by Mark McDougall October 3, 20052005-10-03
Johnson wrote:

> 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.
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 DEVICEARRIVAL event. 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). Regards, Mark
Reply by Joerg October 3, 20052005-10-03
Hello Johnson,

> 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? ...
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 http://www.analogconsultants.com
Reply by Johnson October 3, 20052005-10-03
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. 
Johnson