A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.
Usb devices need fixed name in /dev/
I'm currently having the following problem:
We have a c++ application that expects fixed device names for usb devices. For example /dev/ttyU1, /dev/ttyU2, ... .
A certainty we have is that we know for sure that each usb device is always connected to the same usb port.
- We try to accomplish to have the fixed device names by writing a udev rule for each device. We write the rule based on the KERNELS attribute which is in fact the pci bus topology
Example: KERNEL=="ttyUSB*", KERNELS=="3-4:1.0", SYMLINK+="ttyU1"
The problem here is that the pci bus id sometimes changes after a reboot. So the rule doens't work in that case
- Another attempt was using Vendor Id, serial, etc.
The problem here is that we cannot uniquely identify all devices. The usb to serial converters that we have been using for years have the same serial number.
So basically I have 2 questions:
- What is the best appraoch to communicate to a device that is always connected to the same Usb port?
- Is there a way I can force the pci bus enumeration to be constant over reboot?