linux - 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
解决方案
推荐阅读
- java - 为什么模拟 mongotemplate.aggregate() 返回 NullPointerException [Spring Boot Mockito]
- c++ - 他们是在 C++ 中实现类的更好方法吗?
- php - 是否可以将 PHP imap_search 与新标准一起使用?
- python - 是否可以在 matplotlib 中的动画期间改变速度
- django - Django 实现自定义模型字段,无需迁移
- c++ - 结构内向量的初始化
- swift - 斯威夫特为什么通过防范 NIL 来展开可选的行不通
- performance - 当offline_user_session表有很多记录时keycloak启动很慢
- node.js - MQTT.js 一次将发送多少条消息?
- php - Laravel Nova indexQuery 范围重用