/dev/ttyUSB0 spontaneously changes to /dev/ttyUSB1

Sam Varshavchik mrsam at courier-mta.com
Tue Jun 5 23:22:50 UTC 2012


Jonathan Ryshpan writes:

> I have tried the obvious, to open what ought to be the permanent
> location of the device, namely:
>         /dev/serial/by-id/usb- 
> Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
> But the software stops working when the change takes place, evidently
> because
>         /dev/serial/by-id/usb- 
> Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
> is a dynamically updated symbolic link to /dev/ttyUSB0 or /dev/ttyUSB1,
> as the case may be.  The server can only be made to work again by
> restarting it.

That strongly suggests that, even if the device reconnects under the same  
name, your software app will still choke. If your app still chokes if it's  
told to open /dev/serial/by-id, then it's going to have a problem when your  
USB device disconnects and reconnects, even if it keeps the same /dev/ttyUSB? 
name. You've just proven this yourself: by pointing your software to open  
/dev/serial/by-id. After all, the device name now, as far as your software  
is concerned, remains the same. The fact that the underlying symlink changes  
is irrelevant; unless your software manually checks if it is opening a  
symlink, then reads it and proceeds to use the real path. This seems very  
unlikely.

So, your real problem is that your software is unable to handle the device  
disconnecting and reconnecting. The different device name is a red herring.  
Either the software needs to get fixed, so at least it can recover by  
reopening the device (and you pointing it to the unchanged /dev/serial/by-id  
path), or the underlying root cause of your USB device disconnect must be  
identified, and fixed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20120605/2ec672ed/attachment.sig>


More information about the users mailing list