LINux: Comm port address changes



  • As part of my use of *nix, I use it to access / control / program a few different radios. They use the FTDI chipset for serial communications. Generally I have no trouble, but every once in a while it seriously gripes my mood.

    dmesg | grep tty
    

    This will tell you the devices and the port to use. It's in my list of useful commands as I don't always need it, and I just haven't committed it to memory yet. But I have it -

    So this week I have two devices connected, and I went in and found the one I needed to use with the radio I wanted to program.

    TTY0 was connected to a radio that was off
    TTY1 was connected to the radio I was working with.

    Had some programming issues, and updated the software to the latest release using a different REPO, when I went back to program the radio - fails - repeatedly.

    Reboots, updates, upgrades, re-installs later, I run dmesg | grep tty again and find that the port assignment has changed.

    This is one of the frustrating things about *nix I seem to have, in that things don't stay where they where and where I expect them to be the next time I go to use them.

    Is this normal for it to change, even though neither of the USB devices were not removed?

    @scottalanmiller



  • @gjacobse said in *nix: Comm port address changes:

    As part of my use of *nix...

    *nix isn't a thing. It's just a bad way to write Unix. Unix is a family of operating systems and does not share commonality at the layer you are discussing. You need to talk about a specific OS in order to address the question. Tools like "dmesg" are not available in most Unix systems, for example.



  • @gjacobse said in *nix: Comm port address changes:

    Reboots, updates, upgrades, re-installs later, I run dmesg | grep tty again and find that the port assignment has changed.

    This is one of the frustrating things about *nix I seem to have, in that things don't stay where they where and where I expect them to be the next time I go to use them.

    What port assignment is this? I'm confused. Linux doesn't have comm ports, that's a Windows thing. Are you saying that the physical serial device connected to a TTY changed?

    Did you use setserial to set it? Or just let the system assign it upon detection?



  • @scottalanmiller said in LINux: Comm port address changes:

    @gjacobse said in *nix: Comm port address changes:

    Reboots, updates, upgrades, re-installs later, I run dmesg | grep tty again and find that the port assignment has changed.

    This is one of the frustrating things about *nix I seem to have, in that things don't stay where they where and where I expect them to be the next time I go to use them.

    What port assignment is this? I'm confused. Linux doesn't have comm ports, that's a Windows thing. Are you saying that the physical serial device connected to a TTY changed?

    Did you use setserial to set it? Or just let the system assign it upon detection?

    It was auto assigned, but I would have expected that if they are not physically removed, that they would be the same assignment post boot.

    If you don't move a device, it should still be the same logical location ..



  • @gjacobse said in LINux: Comm port address changes:

    @scottalanmiller said in LINux: Comm port address changes:

    @gjacobse said in *nix: Comm port address changes:

    Reboots, updates, upgrades, re-installs later, I run dmesg | grep tty again and find that the port assignment has changed.

    This is one of the frustrating things about *nix I seem to have, in that things don't stay where they where and where I expect them to be the next time I go to use them.

    What port assignment is this? I'm confused. Linux doesn't have comm ports, that's a Windows thing. Are you saying that the physical serial device connected to a TTY changed?

    Did you use setserial to set it? Or just let the system assign it upon detection?

    It was auto assigned, but I would have expected that if they are not physically removed, that they would be the same assignment post boot.

    If you don't move a device, it should still be the same logical location ..

    There is no reason to assume that. Hardware detection is done at boot time and if there is nothing making the system map a logical device to a physical one, and if there is no way to have it return hardware detection in a reliable order, there is nothing to create the base assumption that devices would not move around. NICs work the same way. Unless they are set to be mapped in some way (often with the MAC address) they will float based on their order of detection.



  • @gjacobse disk devices do this as well. sometimes a usb drive used for boot will be assigned sda, sometimes sdi on a system with an 8 bay md0 set, as an example.



  • @momurda said in LINux: Comm port address changes:

    @gjacobse disk devices do this as well. sometimes a usb drive used for boot will be assigned sda, sometimes sdi on a system with an 8 bay md0 set, as an example.

    That's why we are encouraged to use UUID for storage devices when configuring them.



  • @scottalanmiller said in LINux: Comm port address changes:

    @momurda said in LINux: Comm port address changes:

    @gjacobse disk devices do this as well. sometimes a usb drive used for boot will be assigned sda, sometimes sdi on a system with an 8 bay md0 set, as an example.

    That's why we are encouraged to use UUID for storage devices when configuring them.

    It’s definitely more reliable when using UUID for mount points in /etc/fstab.

    XenServer is another one that utilizes UUID too.



  • @gjacobse said in LINux: Comm port address changes:

    As part of my use of *nix, I use it to access / control / program a few different radios. They use the FTDI chipset for serial communications. Generally I have no trouble, but every once in a while it seriously gripes my mood.

    dmesg | grep tty
    

    This will tell you the devices and the port to use. It's in my list of useful commands as I don't always need it, and I just haven't committed it to memory yet. But I have it -

    So this week I have two devices connected, and I went in and found the one I needed to use with the radio I wanted to program.

    TTY0 was connected to a radio that was off
    TTY1 was connected to the radio I was working with.

    Had some programming issues, and updated the software to the latest release using a different REPO, when I went back to program the radio - fails - repeatedly.

    Reboots, updates, upgrades, re-installs later, I run dmesg | grep tty again and find that the port assignment has changed.

    This is one of the frustrating things about *nix I seem to have, in that things don't stay where they where and where I expect them to be the next time I go to use them.

    Is this normal for it to change, even though neither of the USB devices were not removed?

    @scottalanmiller

    Especially plugable devices (e.g. USB) tend to change names - if you plug them into other ports for example. But your example doesn't look like a USB serial adapter, they would most probably have a name like ttyusbN.

    But like SAM said above, this is not only happening with plugable devices. Most modern distros will create udev rules whenever they detect new hardware (except for a few cases like USB devices). That's why you will (should) see a reproducable mapping every time the system starts.

    Anyway. You could get more stable results using a udev custom rule for your tty problem.

    First hit on Google: https://www.silabs.com/community/interface/knowledge-base.entry.html/2016/06/06/fixed_tty_deviceass-XzTf


Log in to reply