HUB USB 断开,检测并重新加载,无需重启

问题描述 投票:0回答:1

我们的机器使用 WiFi 和 3G 通信。两个设备通过集线器共享相同的USB连接。

有一段时间,两个设备似乎都断开连接,并且固件无法恢复它们。 我们的目标是在不需要重新启动的情况下恢复这些接口。

比较工作良好的机器和不工作的机器,我们欣赏这些差异:

root@well-working:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ci_hdrc/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/2p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=ath9k_htc, 480M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 2: Dev 4, If 1, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 2: Dev 4, If 2, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 2: Dev 4, If 3, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 2: Dev 4, If 4, Class=Communications, Driver=cdc_ether, 480M
        |__ Port 2: Dev 4, If 5, Class=CDC Data, Driver=cdc_ether, 480M

root@well-working:~# ls -l /sys/bus/usb/devices/
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-0:1.0 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-0:1.0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.1 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.1:1.0 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.1/1-1.1:1.0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.0 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.1 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.2 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.2
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.3 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.3
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.4 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.4
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1.2:1.5 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2:1.5
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-1:1.0 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-1/1-1:1.0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 usb1 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1


root@non-working:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ci_hdrc/1p, 480M

root@non-working:~# ls -l /sys/bus/usb/devices/
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-0:1.0 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1/1-0:1.0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 usb1 -> ../../../devices/soc0/80080000.ahb/80090000.usb/ci_hdrc.1/usb1

当机器丢失 WiFi 和 3G 时,所有相关 USB 设备都会消失。

我们已经尝试更改其与功率相关的参数值,但没有成功。

root@non-working:~# ls /sys/bus/usb/devices/usb1/power/
    active_duration         connected_duration      runtime_active_time
    autosuspend             control                 runtime_status
    autosuspend_delay_ms    level                   runtime_suspended_time

以下是断开连接事件的示例:

[1795405.092245] usb 1-1: USB disconnect, device number 2
[1795405.113015] usb 1-1.1: USB disconnect, device number 3
[1795405.287948] option1 ttyUSB3: option_instat_callback: error -71
[1795405.893171] ath: phy0: Chip reset failed
[1795405.915900] ath: phy0: Unable to reset channel (2412 Mhz) reset status -22
[1795405.948908] ath: phy0: Unable to set channel
[1795406.054290] ath: phy0: Failed to wakeup in 500us
[1795406.134293] ath: phy0: DMA failed to stop in 10 ms AR_CR=0xa83aa0c7 AR_DIAG_SW=0xa83aa0c7 DMADBG_7=0xa83aa0c7
[1795406.262963] ath: phy0: Failed to wakeup in 500us
[1795407.423023] ath: phy0: DMA failed to stop in 10 ms AR_CR=0x803aa0c7 AR_DIAG_SW=0x803aa0c7 DMADBG_7=0x803aa0c7
[1795408.171040] usb 1-1.1: ath9k_htc: USB layer deinitialized
[1795408.341405] usb 1-1.2: USB disconnect, device number 4
[1795408.451976] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[1795408.527829] option 1-1.2:1.0: device disconnected
[1795408.612111] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[1795408.662332] option 1-1.2:1.1: device disconnected
[1795408.759173] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[1795408.809315] option 1-1.2:1.2: device disconnected
[1795408.913052] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[1795408.965253] option 1-1.2:1.3: device disconnected
[1795409.026255] cdc_ether 1-1.2:1.4 eth0: unregister 'cdc_ether' usb-ci_hdrc.1-1.2, CDC Ethernet Device

此时,我们恢复这些接口的唯一方法是重新启动整个机器... 当操作系统再次启动并加载其模块时,接口将再次被检测到

[    5.107845] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.114635] ehci-platform: EHCI generic platform driver
[    5.123058] usbcore: registered new interface driver usb-storage
[    5.131111] usbcore: registered new interface driver usbserial
[    5.137924] usbcore: registered new interface driver option
[    5.145798] usbserial: USB Serial support registered for GSM modem (1-port)
[    5.202460] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    5.209070] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
[    5.224634] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    5.236611] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    5.243661] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.251115] usb usb1: Product: EHCI Host Controller
[    5.256220] usb usb1: Manufacturer: Linux 3.17.2-fslc+g6725f55 ehci_hcd
[    5.263414] usb usb1: SerialNumber: ci_hdrc.1
[    5.288768] hub 1-0:1.0: USB hub found
[    5.293575] hub 1-0:1.0: 1 port detected

[    5.632202] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[    5.785868] usb 1-1: New USB device found, idVendor=0424, idProduct=2422
[    5.793740] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    5.826896] hub 1-1:1.0: USB hub found
[    5.833666] hub 1-1:1.0: 2 ports detected
[    6.136125] usb 1-1.1: new high-speed USB device number 3 using ci_hdrc
[    6.257841] usb 1-1.1: New USB device found, idVendor=0cf3, idProduct=9271
[    6.265532] usb 1-1.1: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[    6.274210] usb 1-1.1: Product: SKW17
[    6.279177] usb 1-1.1: Manufacturer: SKYLAB
[    6.284601] usb 1-1.1: SerialNumber: 12345
[    6.426135] usb 1-1.2: new high-speed USB device number 4 using ci_hdrc
[    6.528004] usb 1-1.2: New USB device found, idVendor=05c6, idProduct=9003
[    6.535563] usb 1-1.2: New USB device strings: Mfr=4, Product=3, SerialNumber=5
[    6.544201] usb 1-1.2: Product: UMTS/HSPA Module
[    6.550141] usb 1-1.2: Manufacturer: Quectel, Incorporated
[    6.580942] option 1-1.2:1.0: GSM modem (1-port) converter detected
[    6.606089] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[    6.636850] option 1-1.2:1.1: GSM modem (1-port) converter detected
[    6.661615] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[    6.689028] option 1-1.2:1.2: GSM modem (1-port) converter detected
[    6.711116] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[    6.742213] option 1-1.2:1.3: GSM modem (1-port) converter detected
[    6.765995] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3

硬件相关观察细节:

我们无法定义导致这些断开连接的原因。我们怀疑存在与硬件相关的问题。 使用振荡器分析 HUB 的晶体时钟,我们可以观察到异常行为:

当固件无法检测和恢复接口时,HUB 的晶体时钟似乎循环。 只有在启动时重新加载内核模块似乎才能重新初始化并正常工作。

linux module kernel usb usbserial
1个回答
0
投票

您是否尝试过将“ci_hdrc.1”(或代表您的USB接口的任何内容)写入“/sys/bus/platform/drivers/ci_hdrc/unbind”,然后写入“/sys/bus/platform/drivers/ci_hdrc/bind” ?这应该会重置所有内容并允许设备恢复正常运行而无需重新启动。我们最终将其用于 ESD 可能导致 USB 设备停止工作的产品。这是无需重新启动即可恢复的唯一方法。

© www.soinside.com 2019 - 2024. All rights reserved.