When you have multiple EA4TX devices as the ARS, RemoteBox, etc. connected to a single host (a Linux computer like the Raspberry Pi), Linux will assign their names as they are connected, so sometimes the devices are not identified in the same order as you originally connected them.  If USB devices are identified in different orders, your 20M ASR-USB might identify as the 40M ASR-USB. 

Example of 4 ARS-USB units connected into a Raspberry Pi (RsPi)

pi@raspberrypi:~$ dir -1 -A -l /dev/ttyA*

crw-rw—T 1 root dialout 166,  0 Sep  9 14:02 /dev/ttyACM0
crw-rw—T 1 root dialout 166,  1 Sep  9 14:03 /dev/ttyACM1
crw-rw—T 1 root dialout 166,  2 Sep  9 14:07 /dev/ttyACM2
crw-rw—T 1 root dialout 166,  3 Sep  9 14:07 /dev/ttyACM3

When we need to map ports to serial devices, it is essential to have predetermined names to establish routes with the ser2net service, so we’ll use Udev for basic device identification.   

What is Udev?

Udev is a device manager for the Linux 2.6 kernel that creates/removes device nodes in the /dev directory dynamically. It’s the successor of devfs and hotplug. It runs in userspace and the user can change device names using Udev rules.

In our case, Udev will use the Product ID (Pid) + Vendor ID (Vid) + serial number to identify a device and we will assign a name for each unique device.

Since Feb 2015 all firmware versions of the ARS units, Stacks, etc. (i.e. in the ARS from V2.3A) will include a serial number used by Udev service to recognize each device. 

If you have earlier versions of the ARS software (or other EA4TX devices) that do not identify with a unique serial number, contact EA4TX for new firmware.

To find the Product ID, Vendor ID and serial number type the following command.

pi@raspberrypi:~$ usb-devices

In this example:

  • Vendor is 04d8
  • Product ID is 000a
  • SerialNumber is 12198

Remember to upgrade the firmware in case your unit doesn’t include a serial number with the ARS_Loader tool. The firmware will include a serial number since ARS v.2.3

Configuration

Knowing the serial number of a device, we can create a rule in Udev to assign it to a symlink or persistent name.

With the list of serial numbers in hand let’s create a UDEV rule set that will identify a symbolic link for each of these devices. UDEV rules are usually scattered into many files in /etc/udev/rules.d. Create a new file called 99-ars-usb.rules and type (copy) the following lines.

Example:

pi@raspberrypi:~$ sudo nano /lib/udev/rules.d/99-ars-usb.rules

Add a line per each device you want to identify.  In this example we’ll use 6 ARS-USB and 4 stacks:

SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”22198″ , SYMLINK+=”ars01″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”22199″ , SYMLINK+=”ars02″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”22203″ , SYMLINK+=”ars03″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”21477″ , SYMLINK+=”stack1″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”21478″ , SYMLINK+=”stack2″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”22474″ , SYMLINK+=”4-square1″
SUBSYSTEM==”tty”, ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”000a”, ATTRS{serial}==”21327″ , SYMLINK+=”rb28″

 

Once you save the file, reboot the machine. Another option is reload the Udev with the command: 

pi@raspberrypi:~$ sudo udevadm control –reload-rules

From now on whenever the ARS (serial 22198) is detected, Linux assigns the /dev/ars01 device name (and similarly with the rest)

You can check the symlinks are pointing to the correct device by issuing the command  “ls” or “dir” in the  /dev folder, example:

pi@raspberrypi:~$ ls /dev

And with these names, let ser2net service and create the routes or routing TCP serial port, as follows:

Note: The above /etc/ser2net.conf configuration was valid for v3.5 and previous versions.

The new configuration used by ser2net since V4 is a YAML file, example: /etc/ser2net.yaml

The ser2net service monitors incoming connections on port 6001 and sends them to /dev/ars01 (serial 22198).  Communication from /dev/ars01 is sent back through port 6001 and out to the network.

Remember to restart the service ser2net with the command:

pi@raspberrypi:~$ sudo service ser2net restart

This simple way you can create a personalised name for each device connected to the USB port and easily distinguish it from other devices. In addition, this identification is easier than using the /dev/ttyACMxx names that are created by default that have no meaning.