how to /etc/udev/rules.d
This is the way to add a new rule. For example, I'm going to add a new rule for a USB UART/RS485 device in order to avoid entering the sudo command:
Add the following file to /etc/udev/rules.d/89-ftdi-uart-rs485.rules:
# FTDI USB-RS485 Cable Permissions
# Rules written by Oscar Gomez Fuente ( oscargomezf@gmail.com )
# FTDI USB vendor ID = 0x0403
# FTDI USB product ID = 0x6001
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0660", GROUP="dialout", RUN+="echo USB-RS485 Cable CONNECTED!"
Edit the file /etc/gorup and add your username to the groups tty and dialout:
...
tty:x:5:oscargomez
...
dialout:x:20:oscargomez
Then reboot the system.
Reload rules after edit
# udevadm control --reload-rules