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]
마지막으로, USB 관련 내용이 많기 때문에 ESP32 연결 문제에 중점을 두기를 바랍니다.
[ 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
답변1
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(제가 선택한 직렬 브리지)을 다시 사용할 수 있었습니다.