I'm using a Raspberry Pi running Raspian to control some home automation hardware. One piece of hardware speaks over RS232, so it connects to my RPi using a USB-to-RS232 adapter. Another connects over USB, but emulates a serial port.
When I'm only using one piece of hardware, everything is fine: I just tell my software to use
/dev/ttyUSB0 and it's all good.
The problem is when I connect both at the same time. One device shows up as
ttyUSB0 and one as
ttyUSB1, which is fine, but on every reboot it's essentially random which hardware device will get assigned to which device file, despite not even unplugging them from the RPi.
Every so often after a reboot, I find that the control software is confused because it's talking to the wrong device. Is there a way I can "hard-code" a device to a device file?