2

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 ?

1 Answer 1

1

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.

3
  • 1
    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
    Commented Oct 6, 2016 at 11:31
  • 1
    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. Commented Oct 6, 2016 at 11:43
  • I heard about the "udev" rules, but never tried to understand it. So I took the liberty to add this name in the OP's title, hoping other interested udev newbies might visit this Q&A to learn new things.
    – tlfong01
    Commented Nov 7, 2019 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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