Alan Stern wrote:

> 
> Another way of thinking about it: Suppose an existing device entry was 
> not removed (or least made inaccessible) when you unplugged the device 
> -- the idea being that the existing entry could be reused if you 
> plugged the device back in.  Then if you never did plug it back in, the 
> old entry would hang around indefinitely, using up resources for no 
> good reason.
> 
> Alan Stern

How about thinking this way:
Got a GPS hockey puck plugged into a hub. the ttyUSB0 is created, and 
the user program sees that there is a ttyUSB0.
Application opens ttyUSB0. Application processes data from ttyUSB0. 
Everybody happy, till someone yanks the USB cord so that the connection 
is broken.

Kernel sees I/O error. Application program sees I/O error.
Application program has no idea what happened. 5 seconds later tries to 
reestablish communications with device ( still gets I/O error ). 
/dev/ttyUSB0 still alive because the application still has it opened.

Now User realises that the cable was unplugged. plugs it back in. Now 
there is a ttyUSB1, and an effectively a
dead ttyUSB0.

Even though the user has plugged in the USB device, the application 
still reports error. Application does not know or understand that the 
USB device is now connected to ttyUSB1.

After some arbitrary while, application thinks the device is dead ( or 
user has told application so, presuming that user has any idea as to 
what happened ). Application closes FD channel. Now /dev/ttyUSB0 disappears.
User says to application - go open ttyUSB0. Its plugged back in. its the 
only USB device. ttyUSB0 is not to be found ( under this scenario ).

I suppose one can ask about the resources allocated for a file that has 
been opened, and someone else deletes file. The application still sees 
the file, but the rest of the world does not. a new file, with same name 
can be created which wont affect the deleted, but still present file. 
Once the deleted file is closed, those resources will be returned to 
their respective pools.

Garmin_GPS, the device handler for the hockey puck GPS device, knows 
that the newly plugged in USB device is inder its wings. Does garmin_gps 
know that the device has disconnected? It certainly knows when the USB 
device gets connected.

I suppose we can play mix & match for some time with when and how USB 
devices get connected and assigned /dev/ names. But if you cannot get 
garmin_gps to reconnect to ttyUSB0 when the device is unplugged ( but 
not closed) then maybe the special dev should be erased, and the 
internal names erased.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to