On Sun, 3 Jun 2007, Uncle George wrote: > Robert Hancock wrote: > > > It's because you haven't done anything to handle the error which is > still persisting. Likely the only thing sane you can do in this case is > close the fd and try to reopen it later. > > > This seems to be true, but not for what you might think. > > It appears that if u plug the USB/serial device back into the usb-hub, > the code creates a /dev/ttyUSB1 ( if you have not yet closed the > disconnected /dev/ttyUSB0. ) When you do close /dev/ttyUSB0, then the > device is erased from the /dev directory. > > Now /dev/ttyUSB1 is the device. And /dev/ttyUSB0 disappeared. This does > not seem proper. As now the program has no idea or capability to re-open > the GPS device. > > I have been informed that this was an approved kernel feature. Is this > suppose to happen? Or was it an unintended consequence?
It is supposed to happen. The old ttyUSB0 device can't disappear so long as the program is using it. Hence the new device entry needs to use a different name. > NOTE: this was a continuing discussion on what select() should be > returning if a USB device is physically pulled from its socket. Then, of > course, what happens when you plug the device back in. I received no > reply to what (should) happen when the device is plugged back in, but > the FD has not yet been closed. The system has no way of knowing whether you plugged the same device back in or plugged in a different but similar device. So all new plug-in events are treated as new devices. 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 ------------------------------------------------------------------------- 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