Using udev to control ports enumeration


#1

Hi,

I’m using an iot card with an ftdi chip to do some serial sending/ receiving.

There is a problem with the ftdi chip where it resets and re-enumerates. when this happens, it re-enumerates to a different device name - my application code opens the device on start-up and the card is given a different name because that port name is in use.

For example, I reserve /dev/ttyUSB0 and open it. The ftdi device enumerates to ttyUSB0 on start-up, as it’s supposed to. It works fine for a while, then the ftdi chip resets and gets enumerated to ttyUSB1 ( which can be seen easily with a logread -f | grep “usb” ).

The conclusion to this is that there is an underlying problem with the ftdi chip. However, to protect against interruption of function, I want to create a custom device name which the ftdi chip will always enumerate to no matter how many times it gets reset. This can be (supposedly) be done by adding a rule in the /etc/udev/rules.d/ directory, which is present in the legato kernel.

However, the udev tools like udevadm and udev itself don’t seem to be present (in 16.1.07) even though the rules directory is there, so is there another way to do this ?

Note: the rule i’m using is like
SUBSYSTEM=“tty”,ATTRS{idVendor}==“0403”,ATTRS{idProduct}==6015, SYMLINK+=“myUSB”


#2

The system uses mdev (part of the busybox project) which is a minimal alternative to udev. I believe you can configure mdev to apply specific naming to devices, but I don’t know the details of how to do it.


#3

@dfrey

Thanks for the reply, I’ve looked at mdev now and it is possible to enumerate a device to a specific name (but it’s a bit complicated).