Serial Driver for ttyTHS#: udev Issues, Does Driver Need Edit?

I’m trying to figure out how to use udev to add a sym link to /dev/ttyTHS0. The thread where this is being used:
https://forums.developer.nvidia.com/t/uart-symlink-fails-with-udev-rules/306698/

I have a very long post in this which explains why I’m starting a new thread:
https://forums.developer.nvidia.com/t/uart-symlink-fails-with-udev-rules/306698/8

The short version is this udev rules file, which I’ve named “99-tty-ths0.rules”, is placed in an AGX Orin’s “/etc/udev/rules.d/”, as stated in the two code lines below. The original poster is working with an Orin NX. The sym link file is to be named “mys” to be able to allow the drone to find the UART (the THS one).

# 99-tty-ths0.rules; symbolic link from Jetson file /dev/ttyTHS0 to /dev/mys
SUBSYSTEM=="tty", KERNEL=="/dev/ttyTHS0", ACTION=="add|change", SYMLINK+="mys"

The command to test this:
udevadm test /dev/ttyTHS0

The error which I cannot get around:

Reading rules file: /etc/udev/rules.d/tty-ths0.rules
Failed to open device '/sys/dev/ttyTHS0': No such device

I’m asking if someone from NVDIA can find out if this error is due to a need to add some /sys code to the driver. I don’t know. Place that udev rules file in the location named, and run the test command, and it should be repeatable

Note: The trigger is running, so it isn’t a question of identifying the device. Something more is needed though before it will allow the sym link.

1 Like

Hi linuxdev,

I will check this.

HI @linuxdev

For current “no such device” error.

I think the issue seems to be “udevadm” by default take DEVPATH parameters from /sys path?

https://www.freedesktop.org/software/systemd/man/latest/udevadm.html

-p, --path=DEVPATH
The /sys/ path of the device to query, e.g. [/sys/]/class/block/sda. This option is an alternative to the positional argument with a /sys/ prefix. udevadm info --path=/class/block/sda is equivalent to udevadm info /sys/class/block/sda.

Tried this command on my local device with all the above points mentioned.

sudo udevadm test /devices/platform/bus@0/3100000.serial/tty/ttyTHS1

snippet:

Reading rules file: /etc/udev/rules.d/99-tegra-devices.rules
Reading rules file: /etc/udev/rules.d/99-tegra-mmc-ra.rules
Reading rules file: /etc/udev/rules.d/99-tty-ths0.rules
value '[dmi/id]sys_vendor' is 'NVIDIA'
value '[dmi/id]sys_vendor' is 'NVIDIA'
ttyTHS1: /usr/lib/udev/rules.d/50-udev-default.rules:25 GROUP 20
ttyTHS1: /etc/udev/rules.d/99-tty-ths0.rules:2 LINK 'mys'
ttyTHS1: Preserve permissions of /dev/ttyTHS1, uid=0, gid=20, mode=0660
ttyTHS1: Handling device node '/dev/ttyTHS1', devnum=c240:1
ttyTHS1: sd-device: Created db file '/run/udev/data/c240:1' for '/devices/platform/bus@0/3100000.serial/tty/ttyTHS1'
DEVPATH=/devices/platform/bus@0/3100000.serial/tty/ttyTHS1
DEVNAME=/dev/ttyTHS1

And it will create the symlink.

nvidia@tegra-ubuntu:/dev$ ll mys 
lrwxrwxrwx 1 root root 7 Sep 23 06:45 mys -> ttyTHS1
1 Like

Excellent. I will refer the other thread to this. I was missing the --path=....

1 Like

Somehow one of my comment was gone.

The udev rule also needs one modification.

SUBSYSTEM==“tty”, KERNEL==“ttyTHS0”, ACTION==“add|change”, SYMLINK+=“mys”

The “KERNEL” one should be ttyTHS0 instead of “dev/ttyTHS0”. My previous local test was based on this.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.