在使用RDKx5进行海康相机(MV-CS016-10UC)进行开发时,出现相机频繁掉线情况。
运行相机取流和识别的测试程序时,运行一段时间后会出现0x80000007(数据传输错误)与0x80000000(相机句柄错误),而后取流守护线程重启usb并重新初始化设备,运行一段时间后重复上述错误。
查询内核日志可知,设备(MV-CS016-10UC,USB ID 2bdf:0001,序列号 DA5291287)频繁发生USB断开与重连。
日志显示以下重复模式:
相机所连接的USB集线器(GenesysLogic USB3.1 Hub, ID 05e3:0626)以及上一级USB2.0集线器(GenesysLogic USB2.1 Hub, ID 05e3:0610)周期性断开,随后重新枚举。
每次集线器重新连接后,相机设备被重新发现并枚举,伴随“LPM exit latency is zeroed, disabling LPM”消息,表明USB链路电源管理被禁用。
整个过程循环发生,设备号持续递增(如设备号从96递增至103),表明系统多次尝试恢复连接但随即再次断开。
因此该问题导致相机无法稳定工作,表现为反复掉线。
可以确定代码直接从本地移植编译,本地编译运行代码不会有该现象发生。
并且如果同时连接网线和该相机,会出现网线和相机频繁掉线的情况。
尝试降低相机分辨率,原分辨率带宽在3000Mbps,降低后带宽在400Mbps,断连依然出现,频率减低;如果带上bpu推理,断连更加频繁。
更换多块开发板,更换不同系统版本(3.4.1与3.3.3),更换多个相同品牌(MV-CS016-10UC)相机,可稳定复现。
下面是3.4.1系统的部分内核日志:
[ 1661.957660] usb 2-1: USB disconnect, device number 96
[ 1661.957695] usb 2-1.1: USB disconnect, device number 97
[ 1662.044687] usb 1-1: USB disconnect, device number 42
[ 1662.344699] usb 1-1: new high-speed USB device number 43 using xhci-hcd
[ 1662.527078] usb 1-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice= 6.56
[ 1662.527104] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1662.527115] usb 1-1: Product: USB2.1 Hub
[ 1662.527122] usb 1-1: Manufacturer: GenesysLogic
[ 1662.563285] hub 1-1:1.0: USB hub found
[ 1662.565052] hub 1-1:1.0: 4 ports detected
[ 1662.674902] usb 2-1: new SuperSpeed USB device number 98 using xhci-hcd
[ 1662.708112] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 1662.708174] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1662.708212] usb 2-1: Product: USB3.1 Hub
[ 1662.708244] usb 2-1: Manufacturer: GenesysLogic
[ 1662.739551] hub 2-1:1.0: USB hub found
[ 1662.739952] hub 2-1:1.0: 4 ports detected
[ 1663.054769] usb 2-1.1: new SuperSpeed USB device number 99 using xhci-hcd
[ 1663.527233] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1663.527782] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 1663.527808] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 1663.527830] usb 2-1.1: Product: MV-CS016-10UC
[ 1663.527846] usb 2-1.1: Manufacturer: U3V
[ 1663.527863] usb 2-1.1: SerialNumber: DA5291287
[ 1663.735452] usb 2-1.1: reset SuperSpeed USB device number 99 using xhci-hcd
[ 1663.765213] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1663.895136] usb 2-1.1: reset SuperSpeed USB device number 99 using xhci-hcd
[ 1663.925271] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1663.927744] usb 2-1.1: usbfs: process 6803 (camera_detect_t) did not claim interface 2 before use
[ 1664.656369] usb 2-1: USB disconnect, device number 98
[ 1664.656410] usb 2-1.1: USB disconnect, device number 99
[ 1664.744700] usb 1-1: USB disconnect, device number 43
[ 1665.074748] usb 2-1: new SuperSpeed USB device number 100 using xhci-hcd
[ 1665.110419] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 1665.110484] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1665.110521] usb 2-1: Product: USB3.1 Hub
[ 1665.110557] usb 2-1: Manufacturer: GenesysLogic
[ 1665.139311] hub 2-1:1.0: USB hub found
[ 1665.139713] hub 2-1:1.0: 4 ports detected
[ 1665.254649] usb 1-1: new high-speed USB device number 44 using xhci-hcd
[ 1665.437759] usb 1-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice= 6.56
[ 1665.437825] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1665.437859] usb 1-1: Product: USB2.1 Hub
[ 1665.437891] usb 1-1: Manufacturer: GenesysLogic
[ 1665.474971] hub 1-1:1.0: USB hub found
[ 1665.475370] hub 1-1:1.0: 4 ports detected
[ 1665.534672] usb 2-1.1: new SuperSpeed USB device number 101 using xhci-hcd
[ 1666.151489] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1666.152333] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 1666.152387] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 1666.152424] usb 2-1.1: Product: MV-CS016-10UC
[ 1666.152457] usb 2-1.1: Manufacturer: U3V
[ 1666.152487] usb 2-1.1: SerialNumber: DA5291287
[ 1666.295462] usb 2-1.1: reset SuperSpeed USB device number 101 using xhci-hcd
[ 1666.325286] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1666.465439] usb 2-1.1: reset SuperSpeed USB device number 101 using xhci-hcd
[ 1666.494938] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1666.496485] usb 2-1.1: usbfs: process 6803 (camera_detect_t) did not claim interface 2 before use
[ 1667.453291] usb 2-1: USB disconnect, device number 100
[ 1667.453333] usb 2-1.1: USB disconnect, device number 101
[ 1667.544695] usb 1-1: USB disconnect, device number 44
[ 1667.854853] usb 2-1: new SuperSpeed USB device number 102 using xhci-hcd
[ 1667.889831] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 1667.889854] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1667.889863] usb 2-1: Product: USB3.1 Hub
[ 1667.889872] usb 2-1: Manufacturer: GenesysLogic
[ 1667.922994] hub 2-1:1.0: USB hub found
[ 1667.923392] hub 2-1:1.0: 4 ports detected
[ 1668.044656] usb 1-1: new high-speed USB device number 45 using xhci-hcd
[ 1668.227754] usb 1-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice= 6.56
[ 1668.227819] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1668.227856] usb 1-1: Product: USB2.1 Hub
[ 1668.227887] usb 1-1: Manufacturer: GenesysLogic
[ 1668.290672] hub 1-1:1.0: USB hub found
[ 1668.290971] hub 1-1:1.0: 4 ports detected
[ 1668.324735] usb 2-1.1: new SuperSpeed USB device number 103 using xhci-hcd
[ 1668.948549] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1668.949391] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 1668.949446] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 1668.949482] usb 2-1.1: Product: MV-CS016-10UC
[ 1668.949513] usb 2-1.1: Manufacturer: U3V
[ 1668.949544] usb 2-1.1: SerialNumber: DA5291287
[ 1669.095464] usb 2-1.1: reset SuperSpeed USB device number 103 using xhci-hcd
[ 1669.125285] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1669.255403] usb 2-1.1: reset SuperSpeed USB device number 103 using xhci-hcd
[ 1669.285274] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 1669.287756] usb 2-1.1: usbfs: process 6803 (camera_detect_t) did not claim interface 2 before use
下面是3.3.3系统的内核部分日志:
[ 302.314068] usb 2-1: USB disconnect, device number 37
[ 302.314090] usb 2-1.1: USB disconnect, device number 38
[ 302.626725] usb 1-1: reset high-speed USB device number 63 using xhci-hcd
[ 302.959487] usb 2-1: new SuperSpeed USB device number 39 using xhci-hcd
[ 302.992167] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 302.992186] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 302.992192] usb 2-1: Product: USB3.1 Hub
[ 302.992197] usb 2-1: Manufacturer: GenesysLogic
[ 303.011235] hub 2-1:1.0: USB hub found
[ 303.011558] hub 2-1:1.0: 4 ports detected
[ 303.339404] usb 2-1.1: new SuperSpeed USB device number 40 using xhci-hcd
[ 303.916680] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 303.917083] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 303.917093] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 303.917100] usb 2-1.1: Product: MV-CS016-10UC
[ 303.917106] usb 2-1.1: Manufacturer: U3V
[ 303.917113] usb 2-1.1: SerialNumber: DA5291289
[ 304.069622] usb 2-1.1: reset SuperSpeed USB device number 40 using xhci-hcd
[ 304.099728] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 304.239602] usb 2-1.1: reset SuperSpeed USB device number 40 using xhci-hcd
[ 304.279711] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 304.281311] usb 2-1.1: usbfs: process 5722 (camera_detect_t) did not claim interface 2 before use
[ 304.809270] usb 2-1: USB disconnect, device number 39
[ 304.809291] usb 2-1.1: USB disconnect, device number 40
[ 305.122469] usb 1-1: reset high-speed USB device number 63 using xhci-hcd
[ 305.459484] usb 2-1: new SuperSpeed USB device number 41 using xhci-hcd
[ 305.492207] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 305.492220] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 305.492226] usb 2-1: Product: USB3.1 Hub
[ 305.492232] usb 2-1: Manufacturer: GenesysLogic
[ 305.522904] hub 2-1:1.0: USB hub found
[ 305.523209] hub 2-1:1.0: 4 ports detected
[ 305.839395] usb 2-1.1: new SuperSpeed USB device number 42 using xhci-hcd
[ 306.302563] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 306.302975] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 306.302986] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 306.302993] usb 2-1.1: Product: MV-CS016-10UC
[ 306.302999] usb 2-1.1: Manufacturer: U3V
[ 306.303004] usb 2-1.1: SerialNumber: DA5291289
[ 306.519587] usb 2-1.1: reset SuperSpeed USB device number 42 using xhci-hcd
[ 306.549823] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 306.699583] usb 2-1.1: reset SuperSpeed USB device number 42 using xhci-hcd
[ 306.739684] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 306.741218] usb 2-1.1: usbfs: process 5722 (camera_detect_t) did not claim interface 2 before use
[ 307.289467] usb 2-1: USB disconnect, device number 41
[ 307.289488] usb 2-1.1: USB disconnect, device number 42
[ 307.586224] usb 1-1: reset high-speed USB device number 63 using xhci-hcd
[ 307.909484] usb 2-1: new SuperSpeed USB device number 43 using xhci-hcd
[ 307.942173] usb 2-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice= 6.56
[ 307.942186] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 307.942192] usb 2-1: Product: USB3.1 Hub
[ 307.942199] usb 2-1: Manufacturer: GenesysLogic
[ 307.970695] hub 2-1:1.0: USB hub found
[ 307.971002] hub 2-1:1.0: 4 ports detected
[ 308.299415] usb 2-1.1: new SuperSpeed USB device number 44 using xhci-hcd
[ 308.782635] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 308.783063] usb 2-1.1: New USB device found, idVendor=2bdf, idProduct=0001, bcdDevice= 1.00
[ 308.783073] usb 2-1.1: New USB device strings: Mfr=5, Product=3, SerialNumber=6
[ 308.783080] usb 2-1.1: Product: MV-CS016-10UC
[ 308.783085] usb 2-1.1: Manufacturer: U3V
[ 308.783092] usb 2-1.1: SerialNumber: DA5291289
[ 308.979608] usb 2-1.1: reset SuperSpeed USB device number 44 using xhci-hcd
[ 309.019757] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 309.149575] usb 2-1.1: reset SuperSpeed USB device number 44 using xhci-hcd
[ 309.179677] usb 2-1.1: LPM exit latency is zeroed, disabling LPM.
[ 309.181224] usb 2-1.1: usbfs: process 5722 (camera_detect_t) did not claim interface 2 before use
该情况可能是什么原因导致的,有什么解决办法吗?
测试代码:测试代码 提取码: w524