1

What if I use this UBS to 4 RS232 Cable ? Will be the device names e.g /dev/ttyUSB0 - /dev/ttyUSB3 always the same for each RS232 connector ?

For example:

If I plug in the USB connector, the convertes will be given names. Will UART plug 1 always have the lowest number e.g. /dev/ttyUSB0 ?

0

Normally yes. Every USB device designed with a bit of sanity will enumerate its endpoints in the same order every time, and Linux will assign them names in form of ttyUSBx, starting with 0.

Note that this will not be true if you e.g. plug another USB UART adapter first - it will get the name ttyUSB0, and numbers in names assigned to your cable will increase by one. It's also conceivable that some device names may become unavailable - for example, if you unplug the cable while a process is trying to read from ttyUSB0, the driver may not be able to remove it properly, so when you replug the cable, it will be assinged device names starting from ttyUSB1.

  • What If I use an udev rule instead ? Like KERNEL=="ttyUSB*", ATTRS{idVendor}=="<vendorid>", MODE="0666", SYMLINK+="mydev" ? Will that map /dev/ttyUSB0 to ``/dev/mydev0` ? Of course this approach would limit me to a specific converter cable. – Moritz Oct 6 '16 at 11:31
  • Yes, you can map device names using udev rules, but beware - mapping ttyUSB0 to mydev0 will only be reliable if the ttyUSB0 name is assigned consistently in the first place. You will want to identify serial numbers of your UARTs and use ATTRS{serial}=="XXXX" in the rules. – Dmitry Grigoryev Oct 6 '16 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.