/dev/ttyUSB0 を使用できますが、呼び出しを試みると消えます。

/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。ワークフローを説明するために2つの説明を追加します。

# 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 brlttyminicom(私が選択したシリアルブリッジ)を再利用できました。

関連情報