查看规则:
udevadm info -a -n /dev/ttyUSB0
编辑rules添加规则:
sudo vim /etc/udev/rules.d/99-usb-serial.rules
方法一:
添加以下规则:
SUBSYSTEMS=="usb", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", MODE="0777", SYMLINK+="ttycsky", GROUP="jun", OWNER="jun"
使rules生效:
sudo udevadm trigger
拔插usb tty设备看结果:
jun@ubuntu:/etc/udev$ ls /dev/ttyU* /dev/ttyc* -l
lrwxrwxrwx 1 root root 7 Sep 4 05:24 /dev/ttycsky -> ttyUSB0
crwxrwxrwx 1 jun jun 188, 0 Sep 4 05:24 /dev/ttyUSB0
方法二:
添加以下规则:
KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0777", SYMLINK+="ttycsky", GROUP="jun", OWNER="jun"
使rules生效:
sudo udevadm trigger
拔插usb tty设备看结果:
jun@ubuntu:/etc/udev$ ls /dev/ttyU* /dev/ttyc* -l
lrwxrwxrwx 1 root root 7 Sep 4 05:26 /dev/ttycsky -> ttyUSB0
crwxrwxrwx 1 jun jun 188, 0 Sep 4 05:26 /dev/ttyUSB0