Re: reincarnation of /dev/ttyUSB0 as /dev/ttyUSB1

"Adam Kropelin" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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.

Sure it does. The days of programs being able to blindly assume static 
device names are gone. Hotplug is upon us and it necessitates a 
different way of thinking, even in userspace.

Apps need to be smart enough to re-enumerate compatible devices and pick 
one. Even if the kernel were to maintain the illusion of a static device 
name in the simple case, the app still needs smarts to handle the 
general case. And I say this as the maintainer of  an app that is going 
thru exactly this evolution. It's painful, but necessary.

--Adam


-------------------------------------------------------------------------
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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.