Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Modbus identifying serial ports
-
I'm working on a data acquisition system wchich should work on linux laptop and i am using Modbus4J and have implemented my own serial port wrapper which will by default ask for port-name(String) which is usually (/dev/ttyUSB1, /dev/ttyUSB2, etc)
But to my surprise the dev path to USB aren't constant and keeps changing in the order of connection.
when I connect two serial port converts to two USD ports the first connected ones take /dev/ttyUSB0 and the later /dev/ttyUSB1. This is an issue.
How is should have been done actually?
-
Hi vijay,
There may be more than one solution, but we have solved this on our MangoES product for instance by using udev rules to create a symlink with a consistent name. In our case, we used the attributes identifying which USB port the device was connected to. You may find this stack exchange thread helpful: https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
You'll need to use udevadm to find the attributes to identify the port by, and then a /etc/udev/rules.d/ rule to
SYMLINK+="ttyNewSymlinkName"