Rule Description for udev - noritan/Streamer GitHub Wiki

In default settings, any USB devices are automatically installed with root owner and group. When a user wants to use the USB device, it is prevented by the operating system because the user has no privilege to access to the USB device. udev can make it available to access the USB device with a user privilege by assigning the access permission to the USB device.

Rule Configuration File

To notify the udev that a USB device can be accessed by a user, a configuration rule file is provided. Following example rule file is located at /etc/udev/rules.d/cypress-fx3.rules

# add FX3 devices
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f0", GROUP="cyj", MODE="0660", SYMLINK+="cypress/loopback_%n"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f1", GROUP="cyj", MODE="0660", SYMLINK+="cypress/streamer_%n"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f3", GROUP="cyj", MODE="0660", SYMLINK+="cypress/fx3_%n"

Please note that following command should be invoked to refresh the configuration rule.

cyj@ubuntu:/etc/udev/rules.d$ sudo udevadm control --reload-rules

Based on this rule file, FX3 devices with KNOWN VID/PID code are recognized as USB devices which can be accessed by users listed in the groupe cyj In addition, these devices are mounted on the directory /dev/cypress with a specified name as follows.

cyj@ubuntu:/etc/udev/rules.d$ ls -alL /dev/cypress
total 0
drwxr-xr-x  2 root root       60 Jun 17 18:19 .
drwxr-xr-x 17 root root     4360 Jun 17 18:19 ..
crw-rw----  1 root cyj  189, 385 Jun 17 20:34 streamer_2
cyj@ubuntu:/etc/udev/rules.d$ 

Difference between Linux Distributions

There are many Linux distributions. This rule description example is based on the Ubuntu 12.10 LTS and its syntax is quite different from other distributions. Please refer documents of specific version of udev software on your distribution.

⚠️ **GitHub.com Fallback** ⚠️