首页 > 解决方案 > USB 设备枚举在运行时更改

问题描述

我正在使用带有 Raspberry Pi 4 的 USB 设备,该设备最初被枚举为(USB0, USB1, USB2, USB3)。由于一些电源波动,所有 USB 端口被断开并重新连接。但是这一次,端口连接为(USB0, USB3, USB4, USB5)而不是(USB0, USB1, USB2, USB3),这会导致我的应用程序出现串行读取问题。我的 python 程序正在使用 USB1 和 USB2。

如何强制设备使用与以前相同的枚举重新连接?

USB 设备断开连接(来自 dmesg 日志):

[72459.273350] usb 1-1.2: USB disconnect, device number 4
[72459.273967] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[72459.274044] option 1-1.2:1.0: device disconnected
[72459.275380] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[72459.275425] option 1-1.2:1.1: device disconnected
[72459.276084] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[72459.276127] option 1-1.2:1.2: device disconnected
[72459.276562] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[72459.276624] option 1-1.2:1.3: device disconnected

USB 设备重新连接(来自 dmesg 日志):

[72459.772212] option 1-1.2:1.0: GSM modem (1-port) converter detected
[72459.772482] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[72459.772674] option 1-1.2:1.1: GSM modem (1-port) converter detected
[72459.773101] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3
[72459.773305] option 1-1.2:1.2: GSM modem (1-port) converter detected
[72459.775595] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB4
[72459.775884] option 1-1.2:1.3: GSM modem (1-port) converter detected
[72459.777303] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB5

标签: linuxraspberry-piembedded-linux

解决方案


推荐阅读