我有一台 3D 打印机,它通过 USB 线连接到我的笔记本电脑(全新安装 Ubuntu 19.04)。
据我了解,3D 打印机通过 USB 创建虚拟 COM 端口。加载操作系统后,我可以毫无问题地连接到打印机。但如果我拔下 USB 电缆并再次插入,则无法建立连接。
我已经尝试过了:
- 用户已添加到
tty
和dialout
组 - 添加 udev-rule(创建文件 /etc/udev/rules.d/50-myusb.rules,内容为
KERNEL=="ttyUSB[0-9]*",MODE="0666"
:) - 调制解调器管理器已删除
操作系统加载后,我输入命令
ls -l /dev/ttyUSB0
并得到预期的输出:
crw-rw-rw- 1 root dialout 188, 0 сен 9 18:37 /dev/ttyUSB0
重新插入 USB 线后,相同的命令输出是:
crw------- 1 root root 188, 0 сен 9 18:56 /dev/ttyUSB0
所以,我的问题是:为什么?!以及如何解决它?
编辑
命令的输出groups
是:
igor adm tty dialout cdrom sudo dip plugdev lpadmin sambashare
编辑2
我拔掉电缆,然后重新插上。结果/dev/ttyUSB0
再次出现错误权限。然后我离开电脑几个小时去工作......此后,权限神奇地变成了:
crw-rw-rw- 1 root dialout 188, 0 сен 13 13:47 /dev/ttyUSB0
因此,申请了正确的许可/dev/ttyUSB0
,但是花费了太多时间......
编辑3
tail -f dmesg $(find . -name \*log)
目录 /var/log 中的命令输出:
==> ./kern.log <==
Sep 13 22:38:45 igor kernel: [129395.359713] usb 2-1.1: new full-speed USB device number 14 using ehci-pci
Sep 13 22:38:46 igor kernel: [129395.468908] usb 2-1.1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.63
Sep 13 22:38:46 igor kernel: [129395.468912] usb 2-1.1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Sep 13 22:38:46 igor kernel: [129395.468914] usb 2-1.1: Product: USB2.0-Serial
Sep 13 22:38:46 igor kernel: [129395.469312] ch341 2-1.1:1.0: ch341-uart converter detected
Sep 13 22:38:46 igor kernel: [129395.470094] usb 2-1.1: ch341-uart converter now attached to ttyUSB0
==> ./syslog <==
Sep 13 22:38:45 igor kernel: [129395.359713] usb 2-1.1: new full-speed USB device number 14 using ehci-pci
Sep 13 22:38:46 igor kernel: [129395.468908] usb 2-1.1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.63
Sep 13 22:38:46 igor kernel: [129395.468912] usb 2-1.1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Sep 13 22:38:46 igor kernel: [129395.468914] usb 2-1.1: Product: USB2.0-Serial
Sep 13 22:38:46 igor kernel: [129395.469312] ch341 2-1.1:1.0: ch341-uart converter detected
Sep 13 22:38:46 igor kernel: [129395.470094] usb 2-1.1: ch341-uart converter now attached to ttyUSB0
Sep 13 22:39:47 igor systemd-udevd[428]: message repeated 4139 times: [ Process 'hid2hci --method=dell --devpath=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.2/2-1.6.2:1.0' failed with exit code 1.]
因此,我看到了一条错误消息,但不明白哪里出了问题。