As you probably know, if you want to see a hierarchy of hardware connected to your computer, you can use linux’s sysfs
virtual filesystem. Sometimes it’s hard to see where things go or come from. An easy way to see this is to use the udevmonitor
utility. First, unplug both devices. Then, at a root shell, type:
(this should show you kernel events, udev events, and a nice collection of environment variables for each event). Now, plug in one device. Wait a bit. Now, remove it. Wait a bit. Plug in the other device. Etc.
variables show you what physical connection your device has. Those are actual subdirectories of /sys
In addition to just learning this information, you can use it. If you create a udev rule, you might assign each ttyUSBx
based on something distinguishable about your device (perhaps a serial number). Using usb device locations will probably work for simple setups, but is not recommended for production setups (because of USB’s daisy-chain nature). That’s one way to assign tty based on physical devices.