Arch-Linux

Arduino:avrdude:ser_open():無法打開設備“/dev/ttyACM1”:輸入/輸出錯誤

  • May 9, 2021

我在arch linux上使用arduino ide,arduino uno通過USB連接。我確信我在 ide 菜單中選擇了正確的埠和板。

當我跑步時,ls -l /dev/ttyACM*我得到:

crw-rw---- 1 root uucp 166, 0 14. dub 12.44 /dev/ttyACM0
crw-rw-rw- 1 root uucp 166, 1 14. dub 12.54 /dev/ttyACM1

但是當我點擊上傳我得到這個錯誤:

Sketch uses 440 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

avrdude: Version 6.3, compiled on Jul  7 2020 at 19:38:43
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "//etc/avrdude.conf"
        User configuration file is "/home/john/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/ttyACM1
        Using Programmer              : arduino
        Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "/dev/ttyACM1": Input/output error

avrdude done.  Thank you.

the selected serial port 
does not exist or your board is not connected

最新的 linux 核心和 LTS 上仍然存在錯誤。


我的設備是聯想thinkpad X390:Linux 5.11.14-arch1-1


當我將 arduino 插入 USB 並執行時,sudo dmesg我收到以下消息:

[ 1605.378324] usb 1-4: new full-speed USB device number 14 using xhci_hcd
[ 1605.520509] usb 1-4: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[ 1605.520517] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 1605.520521] usb 1-4: Manufacturer: Arduino (www.arduino.cc)
[ 1605.520523] usb 1-4: SerialNumber: 7583434383935150E152
[ 1605.523881] cdc_acm 1-4:1.0: ttyACM1: USB ACM device
[ 1630.618749] usb 1-9: reset full-speed USB device number 10 using xhci_hcd
[ 1630.792727] audit: type=1130 audit(1618567069.016:82): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1632.601215] audit: type=1100 audit(1618567070.822:83): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:authentication grantors=? acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=failed'
[ 1635.720577] audit: type=1100 audit(1618567073.942:84): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:authentication grantors=pam_faillock,pam_permit,pam_faillock acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[ 1635.721507] audit: type=1101 audit(1618567073.942:85): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[ 1635.722751] audit: type=1110 audit(1618567073.946:86): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[ 1635.727018] audit: type=1105 audit(1618567073.949:87): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'

我怎樣才能解決這個問題 ?

謝謝你的幫助

**PS:**如果您需要更多資訊,請在下方評論,我會盡快添加。

我遇到了同樣的問題,唯一對我有幫助的解決方法是禁用 grub 配置中的 USB 自動掛起。

禁用它後,我可以很好地使用我的 arduino 板。

所以我做了:

  1. sudo vim /etc/default/grub
  2. 搜尋這一行GRUB_CMDLINE_LINUX_DEFAULT=""(它可能已經在引號內填充了不同的東西)
  3. 將其更改為包含usbcore.autosuspend=-1引號內的某處
  4. sudo update-grub
  5. 然後重新啟動

這對我有幫助,因為我在Google搜尋後意識到問題實際上是每當我嘗試使用 arduino 時它就會重新連接。因此,當使用 minicom 訪問串列輸出時,arduino 被斷開並立即重新連接。我只是在使用時才注意到它, watch -n 1 ' sudo dmesg | tail -n 20' 以查看執行 minicom 時會發生什麼。

在 grub 中禁用自動掛起後,此行為應該會改變。

引用自:https://unix.stackexchange.com/questions/645033