Skip to content

Instantly share code, notes, and snippets.

@huzhifeng
Created August 22, 2016 03:28
Show Gist options
  • Save huzhifeng/1a9b5d5b08b96d2f6e742451fa5cd3e1 to your computer and use it in GitHub Desktop.
Save huzhifeng/1a9b5d5b08b96d2f6e742451fa5cd3e1 to your computer and use it in GitHub Desktop.
udev rule for usb serial
/etc/udev/rules.d/90-tty-usb.rules
# CP210x
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE="0666"
How to add udev rule for usb serial device
[huzhifeng@CentOS72 ~]$ minicom
Cannot create lockfile for /dev/ttyUSB0: 权限不够
[huzhifeng@CentOS72 ~]$ su root -l
[root@CentOS72 ~]# ls -al /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 8月 22 08:59 /dev/ttyUSB0
[root@CentOS72 ~]# lsusb | grep CP210x
Bus 001 Device 055: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
[root@CentOS72 ~]# udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
[root@CentOS72 ~]# echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE="0666"' > /etc/udev/rules.d/90-tty-usb.rules
[root@CentOS72 ~]# udevadm control --reload
# Plug in/out CP210x
[root@CentOS72 ~]# udevadm test $(udevadm info -q path -n /dev/ttyUSB0)
[root@CentOS72 ~]# ls -l /dev/ttyUSB0
crw-rw-rw- 1 root dialout 188, 0 8月 22 11:03 /dev/ttyUSB0
[root@CentOS72 ~]#
@andrejpodzimek
Copy link

This doesn't work on 238.76 (or maybe since a much earlier version already) any more. It simply does nothing at all; no changes. Rules in udev are completely broken (and probably will remain that way, considering that it hasn't been fixed for >months).

@gonzafernan
Copy link

Works fine for me. Thanks a lot, you saved me a lot of time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment