/dev/ttyUSB0 可用,但嘗試呼叫後它消失了
如果我通過 USB 將我的 ESP32 連接到我的 Ubuntu (22.04),它可以在
/dev/ttyUSB0
. 如果我打電話 - 例如sudo ampy --port /dev/ttyUSB0 ls
出現錯誤消息Traceback (most recent call last): File "/usr/local/bin/ampy", line 8, in <module> sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1656, in invoke super().invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/ampy/cli.py", line 99, in cli _board = pyboard.Pyboard(port, baudrate=baud, rawdelay=delay) File "/usr/local/lib/python3.10/dist-packages/ampy/pyboard.py", line 147, in __init__ raise PyboardError('failed to access ' + device) ampy.pyboard.PyboardError: failed to access /dev/ttyUSB0
在 Ubuntu 20.04 上,這工作得很好,沒有任何問題。但是自從升級後,這個問題就被拋出了。
我的 Ubuntu 設置有什麼要更改的嗎?使用者有以下組:
adm dialout cdrom sudo dip plugdev render lpadmin lxd sambashare docker
這是 的輸出
ls
。我添加了兩條評論來描述工作流程:# Plug in the ESP32 michael@michael-Laptop:~$ ls /dev/tty* /dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8 /dev/ttyS12 /dev/ttyS19 /dev/ttyS25 /dev/ttyS31 /dev/ttyUSB0 /dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9 /dev/ttyS13 /dev/ttyS2 /dev/ttyS26 /dev/ttyS4 /dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyprintk /dev/ttyS14 /dev/ttyS20 /dev/ttyS27 /dev/ttyS5 /dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyS0 /dev/ttyS15 /dev/ttyS21 /dev/ttyS28 /dev/ttyS6 /dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyS1 /dev/ttyS16 /dev/ttyS22 /dev/ttyS29 /dev/ttyS7 /dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyS10 /dev/ttyS17 /dev/ttyS23 /dev/ttyS3 /dev/ttyS8 /dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7 /dev/ttyS11 /dev/ttyS18 /dev/ttyS24 /dev/ttyS30 /dev/ttyS9 michael@michael-Laptop:~$ ls /dev/tty* /dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8 /dev/ttyS12 /dev/ttyS19 /dev/ttyS25 /dev/ttyS31 /dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9 /dev/ttyS13 /dev/ttyS2 /dev/ttyS26 /dev/ttyS4 /dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyprintk /dev/ttyS14 /dev/ttyS20 /dev/ttyS27 /dev/ttyS5 /dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyS0 /dev/ttyS15 /dev/ttyS21 /dev/ttyS28 /dev/ttyS6 /dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyS1 /dev/ttyS16 /dev/ttyS22 /dev/ttyS29 /dev/ttyS7 /dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyS10 /dev/ttyS17 /dev/ttyS23 /dev/ttyS3 /dev/ttyS8 /dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7 /dev/ttyS11 /dev/ttyS18 /dev/ttyS24 /dev/ttyS30 /dev/ttyS9 # Plugout and plugin the ESP32 michael@michael-Laptop:~$ ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Mär 19 06:52 /dev/ttyUSB0 michael@michael-Laptop:~$ ls -l /dev/ttyUSB0 ls: Zugriff auf '/dev/ttyUSB0' nicht möglich: Datei oder Verzeichnis nicht gefunden michael@michael-Laptop:~$ ls /dev/tty* /dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8 /dev/ttyS12 /dev/ttyS19 /dev/ttyS25 /dev/ttyS31 /dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9 /dev/ttyS13 /dev/ttyS2 /dev/ttyS26 /dev/ttyS4 /dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyprintk /dev/ttyS14 /dev/ttyS20 /dev/ttyS27 /dev/ttyS5 /dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyS0 /dev/ttyS15 /dev/ttyS21 /dev/ttyS28 /dev/ttyS6 /dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyS1 /dev/ttyS16 /dev/ttyS22 /dev/ttyS29 /dev/ttyS7 /dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyS10 /dev/ttyS17 /dev/ttyS23 /dev/ttyS3 /dev/ttyS8 /dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7 /dev/ttyS11 /dev/ttyS18 /dev/ttyS24 /dev/ttyS30 /dev/ttyS9
—- 添加
dmesg
輸出好的,這絕對是我所不知道的…… @dirkt 你能解釋一下輸出的內容嗎?
以下連結為紅色:
並且這條消息也有很多紅線:
[ 49.700482] nouveau 0000:01:00.0: gr: DATA_ERROR 0000009c [] ch 2 [003fbf0000 systemd-logind[985]] subc 0 class 9197 mthd 0d78 data 00000004
接下來是這個
[ 49.832345] gnome-shell[1294]: segfault at 5596ea4d51c5 ip 00007f0afb25ceb7 sp 00007ffddb278bb8 error 4 in libgbm.so.1.0.0[7f0afb256000+7000]
最後,我希望這集中在我的 ESP32 連接問題上,因為 USB 內容很多
[ 83.658545] nouveau 0000:01:00.0: bus: MMIO write of 10000000 FAULT at 002a00 [ !ENGINE ]
這是輸出的集合:
[ 49.700360] nouveau 0000:01:00.0: gr: DATA_ERROR 0000009c [] ch 2 [003fbf0000 systemd-logind[985]] subc 0 class 9197 mthd 0d78 data 00000004 [ 49.700447] nouveau 0000:01:00.0: gr: DATA_ERROR 0000009c [] ch 2 [003fbf0000 systemd-logind[985]] subc 0 class 9197 mthd 0d78 data 00000004 [ 49.700482] nouveau 0000:01:00.0: gr: DATA_ERROR 0000009c [] ch 2 [003fbf0000 systemd-logind[985]] subc 0 class 9197 mthd 0d78 data 00000004 [ 49.832345] gnome-shell[1294]: segfault at 5596ea4d51c5 ip 00007f0afb25ceb7 sp 00007ffddb278bb8 error 4 in libgbm.so.1.0.0[7f0afb256000+7000] [ 49.832384] Code: 18 c3 90 f3 0f 1e fa 48 8b 07 ff a0 c0 00 00 00 0f 1f 00 f3 0f 1e fa 48 8b 07 ff a0 a8 00 00 00 0f 1f 00 f3 0f 1e fa 48 8b 07 <ff> a0 b0 00 00 00 0f 1f 00 f3 0f 1e fa 48 8b 07 ff a0 b8 00 00 00 [ 50.035755] rfkill: input handler enabled [ 52.299029] rfkill: input handler disabled [ 62.559834] systemd-journald[434]: File /var/log/journal/3f503f1656cc4352a889052ae6692375/user-1000.journal corrupted or uncleanly shut down, renaming and replacing. [ 63.052568] rfkill: input handler enabled [ 65.125545] rfkill: input handler disabled [ 65.339576] audit: type=1400 audit(1647699924.695:85): apparmor="DENIED" operation="capable" profile="/snap/snapd/15177/usr/lib/snapd/snap-confine" pid=3840 comm="snap-confine" capability=4 capname="fsetid" [ 67.400897] audit: type=1326 audit(1647699926.753:86): auid=1000 uid=1000 gid=1000 ses=3 subj=? pid=3840 comm="snap-store" exe="/snap/snap-store/558/usr/bin/snap-store" sig=0 arch=c000003e syscall=314 compat=0 ip=0x7f85943b876d code=0x50000 [ 68.076416] audit: type=1400 audit(1647699927.429:87): apparmor="DENIED" operation="connect" profile="snap.snap-store.ubuntu-software" name="/run/user/1000/at-spi/bus" pid=3840 comm="snap-store" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000 [ 69.760939] audit: type=1107 audit(1647699929.112:88): pid=954 uid=103 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop/PolicyKit1/Authority" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.7" pid=3840 label="snap.snap-store.ubuntu-software" peer_pid=970 peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?' [ 69.760961] audit: type=1420 audit(1647699929.112:89): subj_apparmor=unconfined [ 69.761676] audit: type=1107 audit(1647699929.112:90): pid=954 uid=103 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop/PolicyKit1/Authority" interface="org.freedesktop.PolicyKit1.Authority" member="CheckAuthorization" mask="send" name=":1.7" pid=3840 label="snap.snap-store.ubuntu-software" peer_pid=970 peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?' [ 69.761696] audit: type=1420 audit(1647699929.112:91): subj_apparmor=unconfined [ 69.788634] audit: type=1107 audit(1647699929.140:92): pid=954 uid=103 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop/PolicyKit1/Authority" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.7" pid=3840 label="snap.snap-store.ubuntu-software" peer_pid=970 peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?' [ 69.788670] audit: type=1420 audit(1647699929.140:93): subj_apparmor=unconfined [ 69.789381] audit: type=1107 audit(1647699929.140:94): pid=954 uid=103 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop/PolicyKit1/Authority" interface="org.freedesktop.PolicyKit1.Authority" member="CheckAuthorization" mask="send" name=":1.7" pid=3840 label="snap.snap-store.ubuntu-software" peer_pid=970 peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?' [ 70.362315] kauditd_printk_skb: 1 callbacks suppressed [ 70.362322] audit: type=1400 audit(1647699929.717:96): apparmor="DENIED" operation="open" profile="snap.snap-store.ubuntu-software" name="/etc/PackageKit/Vendor.conf" pid=3840 comm="snap-store" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 [ 83.651321] ACPI: \_SB_.PCI0.PEG0.PEGP: failed to evaluate _DSM [ 83.658545] nouveau 0000:01:00.0: bus: MMIO write of 10000000 FAULT at 002a00 [ !ENGINE ] [ 180.681078] usb 2-1.4: new full-speed USB device number 4 using ehci-pci [ 180.828308] usb 2-1.4: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00 [ 180.828315] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 180.828317] usb 2-1.4: Product: CP2102 USB to UART Bridge Controller [ 180.828319] usb 2-1.4: Manufacturer: Silicon Labs [ 180.828320] usb 2-1.4: SerialNumber: 0001 [ 180.855749] usbcore: registered new interface driver usbserial_generic [ 180.855768] usbserial: USB Serial support registered for generic [ 180.859082] usbcore: registered new interface driver cp210x [ 180.859114] usbserial: USB Serial support registered for cp210x [ 180.859154] cp210x 2-1.4:1.0: cp210x converter detected [ 180.860044] usb 2-1.4: cp210x converter now attached to ttyUSB0 [ 180.914950] input: PC Speaker as /devices/platform/pcspkr/input/input23 [ 181.433918] input: BRLTTY 6.4 Linux Screen Driver Keyboard as /devices/virtual/input/input24 [ 182.932720] usb 2-1.4: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1 [ 182.933473] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0 [ 182.933505] cp210x 2-1.4:1.0: device disconnected [ 249.064792] usb 2-1.4: USB disconnect, device number 4 [ 252.466888] usb 3-2: new full-speed USB device number 2 using xhci_hcd [ 252.665144] usb 3-2: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00 [ 252.665164] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 252.665170] usb 3-2: Product: CP2102 USB to UART Bridge Controller [ 252.665175] usb 3-2: Manufacturer: Silicon Labs [ 252.665180] usb 3-2: SerialNumber: 0001 [ 252.683233] cp210x 3-2:1.0: cp210x converter detected [ 252.689407] usb 3-2: cp210x converter now attached to ttyUSB0 [ 268.444106] usb 3-2: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1 [ 268.447566] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0 [ 268.447632] cp210x 3-2:1.0: device disconnected [ 355.671608] nouveau 0000:01:00.0: Enabling HDA controller [ 362.191120] ACPI: \_SB_.PCI0.PEG0.PEGP: failed to evaluate _DSM [ 389.497934] usb 3-2: USB disconnect, device number 2 [ 392.335966] usb 3-2: new full-speed USB device number 3 using xhci_hcd [ 392.533200] usb 3-2: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00 [ 392.533210] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 392.533214] usb 3-2: Product: CP2102 USB to UART Bridge Controller [ 392.533218] usb 3-2: Manufacturer: Silicon Labs [ 392.533221] usb 3-2: SerialNumber: 0001 [ 392.550293] cp210x 3-2:1.0: cp210x converter detected [ 392.556443] usb 3-2: cp210x converter now attached to ttyUSB0 [ 410.282303] usb 3-2: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1 [ 410.285810] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0 [ 410.285877] cp210x 3-2:1.0: device disconnected
我對 USB→串列轉換器有完全相同的問題。
在 20.04(甚至 21.10)上執行良好,在 22.04 上我看到設備出現了很短的時間,然後 1 或 2 秒後消失了。
dmesg 輸出:
[ 2713.068159] usb 1-2: new full-speed USB device number 32 using xhci_hcd [ 2713.222910] usb 1-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00 [ 2713.222922] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2713.222927] usb 1-2: Product: TTL232RG-VREG1V8 [ 2713.222931] usb 1-2: Manufacturer: FTDI [ 2713.222934] usb 1-2: SerialNumber: FT08D7RY [ 2713.228289] ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected [ 2713.228361] usb 1-2: Detected FT232RL [ 2713.229373] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0 [ 2714.563520] usb 1-2: usbfs: interface 0 claimed by ftdi_sio while 'brltty' sets config #1 [ 2714.564784] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0 [ 2714.564845] ftdi_sio 1-2:1.0: device disconnected
如果您查看 dmesg 輸出,罪魁禍首是“brltty”守護程序。
不知何故,它正在接管 ftdi 驅動程序(我想)。看起來像是基於我從 2011 年在這裡發現的內容(https://bugs.launchpad.net/ubuntu/+source/brltty/+bug/874181)的回歸。可能需要解決,因為盲文訪問可能是輔助功能的關鍵。
無論如何,對我的修復是:
sudo apt remove brltty
,我可以再次使用 minicom(我選擇的串列橋接器)。