
我想讀取串行輸入(例如這裡)在linux命令列中,但我無法找到附加設備(Arduino)路徑。
我可以識別該設備:
# lsusb
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM) <- this one
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
但 dmesg 僅顯示此訊息相關
# dmesg | grep usb
[15026545.556311] usb 4-1: new full-speed USB device number 3 using xhci-hcd
[15026545.697929] usb 4-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
同樣讓我困惑的是 lspci 沒有顯示該設備:
# lspci
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 04)
00:02.0 PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 04)
00:03.0 PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 04)
01:00.0 Network controller: Qualcomm Atheros AR9287 Wireless Network Adapter (PCI-Express) (rev 01)
02:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter
查看/dev目錄:
# ls /dev/
autofs kmsg network_latency ram4 ttyS12
btrfs-control log network_throughput ram5 ttyS13
bus mapper null ram6 ttyS14
console mem port ram7 ttyS15
cpu_dma_latency memory_bandwidth ppp ram8 ttyS2
full mmcblk0 ptmx ram9 ttyS3
fuse mmcblk0boot0 pts random ttyS4
hwrng mmcblk0boot1 ram0 root ttyS5
i2c-0 mmcblk0p1 ram1 rtc0 ttyS6
i2c-1 mmcblk0rpmb ram10 shm ttyS7
i2c-2 mtd0 ram11 snd ttyS8
i2c-3 mtd0ro ram12 spidev0.2 ttyS9
i2c-4 mtd1 ram13 tty ubi_ctrl
i2c-5 mtd1ro ram14 ttyS0 urandom
i2c-6 mtdblock0 ram15 ttyS1 watchdog
i2c-7 mtdblock1 ram2 ttyS10 watchdog0
i2c-8 net ram3 ttyS11 zero
我能夠找出這些事情:
- 未建立 ttyUSB*/ttyACM* 路徑
- 設備的路徑是/dev/bus/usb/004/003
- USB 3.0 應該使用 xhci-hcd
還有一個輸出,這讓我更加困惑(iProduct 行顯示 2(錯誤)):
# lsusb -v -s 004:003
Bus 004 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x2341 Arduino SA
idProduct 0x0043 Uno R3 (CDC ACM)
bcdDevice 0.01
iManufacturer 1 Arduino (www.arduino.cc)
iProduct 2 (error)
iSerial 220 8553130343135121F1A0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 62
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 10.01
CDC ACM:
bmCapabilities 0x06
sends break
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 255
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Device Status: 0x0000
(Bus Powered)
這是否表示設備在這種環境下故障?您能幫我找出如何找到該設備的附加位址嗎?
背景資訊:我在這裡運行的系統是TurriOS(基於OpenWrt)。也測試了 Debian/Mint/Ubuntu/Manjaro,所有這些都可以毫無問題地連接 USB(設備本身沒有損壞)。
編輯:這是安裝 USB 串行驅動程式時與 dmesg 相關的輸出:
[15707335.904584] usbserial: USB Serial support registered for carelink
[15707335.904622] usbserial: USB Serial support registered for zio
[15707335.904657] usbserial: USB Serial support registered for funsoft
[15707335.904686] usbserial: USB Serial support registered for flashloader
[15707335.904714] usbserial: USB Serial support registered for google
[15707335.904743] usbserial: USB Serial support registered for libtransistor
[15707335.904771] usbserial: USB Serial support registered for vivopay
[15707335.904802] usbserial: USB Serial support registered for moto_modem
[15707335.904832] usbserial: USB Serial support registered for motorola_tetra
[15707335.904863] usbserial: USB Serial support registered for novatel_gps
[15707335.904891] usbserial: USB Serial support registered for hp4x
[15707335.904917] usbserial: USB Serial support registered for suunto
[15707335.904944] usbserial: USB Serial support registered for siemens_mpi
[15707336.867539] usbcore: registered new interface driver ti_usb_3410_5052
[15707336.867582] usbserial: USB Serial support registered for TI USB 3410 1 port adapter
[15707336.867611] usbserial: USB Serial support registered for TI USB 5052 2 port adapter
[15721145.188760] usb 4-1: new full-speed USB device number 4 using xhci-hcd
[15721145.330360] usb 4-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
編輯2: 當我谷歌搜尋時,我發現了這個腳本它明確聲稱,我需要:
opkg install kmod-usb-acm
為了連接這些設備。
答案1
您需要能夠識別 Arduino 並自動建立串行埠設備的核心模組。
根據 OpenWrt 的文檔:將 Arduino 連接到 OpenWrt:
請安裝以下軟體包(如果您使用終端機或使用 LuCi 軟體頁面,請使用「opkg install」)
kmod-usb-串口 kmod-usb-serial-ark3116 kmod-usb-serial-belkin kmod-usb-serial-ch341 kmod-usb-serial-cp210x kmod-usb-serial-ftdi kmod-usb-serial-mct210x kmod-usb-serial-ftdi kmod-usbmod-serial-mct kmod-usb -serial-mos7720 kmod-usb-serial-oti6858 kmod-usb-serial-pl2303 kmod-usb-serial-simple kmod-usb-serial-ti-usb
實際上,如果您可以識別 arduino(或克隆)中使用的 USB 轉串口晶片是什麼,您可能只需要其中一個。無論如何,它們不需要太多空間,所以如果您不確定或懶惰,您可以全部安裝。
正如評論中所述,您可能還需要在該列表中添加kmod-usb-acm
.