88import pyrealsense2 as rs
99from rspy import test , log
1010from rspy .stopwatch import Stopwatch
11+ import pyrsutils as rsutils
1112import threading
1213
1314# This test monitors firmware error notifications during streaming to ensure hardware stability
1415
1516STREAMING_DURATION_SECONDS = 10 # Duration to stream and monitor for FW errors
1617ERROR_TOLERANCE = 0 # No firmware errors should be tolerated
1718
18- # Known errors that might be expected in certain environments
19- KNOWN_ERRORS = [
20- "Motion Module failure" , # RSDSO-20645
21- # Add other known/expected errors here as needed
22- ]
19+ def get_known_errors_for_firmware (current_fw_version ):
20+ """Get list of known errors based on firmware version"""
21+ known_errors = []
22+
23+ # Motion Module failure is a known issue starting before firmware 5.17.0.12
24+ if (current_fw_version >= rsutils .version ("5.17.0.12" )):
25+ known_errors .append ("Motion Module failure" ) # See also RSDSO-20645
26+ # Add other version-specific known errors here as needed
27+
28+ return known_errors
2329
2430class FirmwareErrorMonitor :
25- def __init__ (self ):
31+ def __init__ (self , known_errors = None ):
2632 self .firmware_errors = []
2733 self .hardware_errors = []
2834 self .known_errors = []
35+ self .known_error_list = known_errors or []
2936 self .lock = threading .Lock ()
3037
3138 def notification_callback (self , notification ):
@@ -39,7 +46,7 @@ def notification_callback(self, notification):
3946 log .d (f"Notification received - Category: { category } , Severity: { severity } , Description: { description } " )
4047
4148 # Check if this is a known error that should be ignored
42- is_known_error = any (known_error in description for known_error in KNOWN_ERRORS )
49+ is_known_error = any (known_error in description for known_error in self . known_error_list )
4350
4451 if is_known_error :
4552 error_info = {
@@ -99,8 +106,15 @@ def get_error_summary(self):
99106
100107 log .i (f"Testing device: { device_name } (S/N: { device_serial } , FW: { firmware_version } )" )
101108
102- # Set up error monitor
103- error_monitor = FirmwareErrorMonitor ()
109+ # Get known errors for this firmware version
110+ known_errors = get_known_errors_for_firmware (firmware_version )
111+ if known_errors :
112+ log .i (f"Known errors for firmware { firmware_version } : { ', ' .join (known_errors )} " )
113+ else :
114+ log .i (f"No known errors defined for firmware { firmware_version } " )
115+
116+ # Set up error monitor with firmware-specific known errors
117+ error_monitor = FirmwareErrorMonitor (known_errors )
104118
105119 # Query all available sensors and register notification callbacks
106120 sensors = device .query_sensors ()
@@ -191,4 +205,4 @@ def get_error_summary(self):
191205
192206 log .i ("Firmware error monitoring test completed successfully" )
193207
194- test .print_results_and_exit ()
208+ test .print_results_and_exit ()
0 commit comments