Skip to content

Commit bc9a2b1

Browse files
committed
d555 -> d500, fix recovery issues
1 parent 17f0ca6 commit bc9a2b1

File tree

3 files changed

+49
-58
lines changed

3 files changed

+49
-58
lines changed

third-party/realdds/src/dds-device-watcher.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ dds_device_watcher::dds_device_watcher( std::shared_ptr< dds_participant > const
6868
}
6969
continue;
7070
}
71-
else if( device.alive )
71+
else if( device.alive && guid == device.writer_guid)
7272
{
7373
// We already know about this device; likely this was a broadcast meant for someone else
74+
// If guid mismatches the device was reset without us getting a subscription
75+
// lost callback in time - handle like old device coming back to life
7476
continue;
7577
}
7678
else if( device.alive = device.in_use.lock() )

unit-tests/run-unit-tests.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def usage():
5555
print( ' --no-reset Do not try to reset any devices, with or without a hub' )
5656
print( ' --hub-reset If a hub is available, reset the hub itself' )
5757
print( ' --custom-fw-d400 If custom fw provided flash it if its different that the current fw installed' )
58-
print( ' --custom-fw-d555 If custom fw provided flash it if its different that the current fw installed' )
58+
print( ' --custom-fw-d500 If custom fw provided flash it if its different that the current fw installed' )
5959
print( ' --rslog Enable LibRS logging (LOG_DEBUG etc.) to console in each test' )
6060
print( ' --skip-disconnected Skip live test if required device is disconnected (only applies w/o a hub)' )
6161
print( ' --test-dir <> Path to test dir; default: librealsense/unit-tests' )
@@ -85,7 +85,7 @@ def usage():
8585
opts, args = getopt.getopt( sys.argv[1:], 'hvqr:st:',
8686
longopts=['help', 'verbose', 'debug', 'quiet', 'regex=', 'stdout', 'tag=', 'list-tags',
8787
'list-tests', 'no-exceptions', 'context=', 'repeat=', 'retry=', 'config=', 'no-reset', 'hub-reset',
88-
'rslog', 'skip-disconnected', 'live', 'not-live', 'device=', 'exclude-device=', 'test-dir=','skip-regex=','custom-fw-d400=','custom-fw-d555='] )
88+
'rslog', 'skip-disconnected', 'live', 'not-live', 'device=', 'exclude-device=', 'test-dir=','skip-regex=','custom-fw-d400=','custom-fw-d500='] )
8989
except getopt.GetoptError as err:
9090
log.e( err ) # something like "option -a not recognized"
9191
usage()
@@ -105,7 +105,7 @@ def usage():
105105
hub_reset = False
106106
skip_disconnected = False
107107
custom_fw_path=''
108-
custom_fw_d555_path=''
108+
custom_fw_d500_path=''
109109
rslog = False
110110
only_live = False
111111
only_not_live = False
@@ -180,10 +180,10 @@ def usage():
180180
skip_regex = arg
181181
elif opt == '--custom-fw-d400':
182182
custom_fw_path = arg # Store the custom firmware path
183-
log.i(f"custom firmware path was provided ${custom_fw_path}")
184-
elif opt == '--custom-fw-d555':
185-
custom_fw_d555_path = arg # Store the custom D555 firmware path
186-
log.i(f"custom D555 firmware path was provided ${custom_fw_d555_path}")
183+
log.i(f"custom D400 firmware path was provided ${custom_fw_path}")
184+
elif opt == '--custom-fw-d500':
185+
custom_fw_d500_path = arg # Store the custom D500 firmware path
186+
log.i(f"custom D500 firmware path was provided ${custom_fw_d500_path}")
187187

188188
def find_build_dir( dir ):
189189
"""
@@ -474,9 +474,9 @@ def test_wrapper_( test, configuration=None, repetition=1, curr_retry=0, max_ret
474474
if test.name == "test-fw-update" and custom_fw_path:
475475
opts.append('--custom-fw-d400')
476476
opts.append(custom_fw_path)
477-
if test.name == "test-fw-update" and custom_fw_d555_path:
478-
opts.append('--custom-fw-d555')
479-
opts.append(custom_fw_d555_path)
477+
if test.name == "test-fw-update" and custom_fw_d500_path:
478+
opts.append('--custom-fw-d500')
479+
opts.append(custom_fw_d500_path)
480480
try:
481481
test.run_test( configuration = configuration, log_path = log_path, opts = opts )
482482
except FileNotFoundError as e:

unit-tests/test-fw-update.py

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,10 @@
2121

2222
# Parse command-line arguments
2323
parser = argparse.ArgumentParser(description="Test firmware update")
24-
parser.add_argument('--custom-fw-d400', type=str, help='Path to custom firmware file')
25-
parser.add_argument('--custom-fw-d555', type=str, help='Path to custom D555 firmware file')
24+
parser.add_argument('--custom-fw-d400', type=str, help='Path to custom D400 firmware file')
25+
parser.add_argument('--custom-fw-d500', type=str, help='Path to custom D500 firmware file')
2626
args = parser.parse_args()
2727

28-
custom_fw_d400_path = args.custom_fw_d400
29-
custom_fw_d555_path = args.custom_fw_d555
30-
if custom_fw_d400_path:
31-
log.i(f"Custom D400 firmware path provided: {custom_fw_d400_path}")
32-
elif custom_fw_d555_path:
33-
log.i(f"Custom D555 firmware path provided: {custom_fw_d555_path}")
34-
else:
35-
log.i(f"No Custom firmware path provided. using bundled firmware")
36-
3728

3829
def send_hardware_monitor_command(device, command):
3930
# byte_index = -1
@@ -61,7 +52,7 @@ def extract_version_from_filename(file_path):
6152
return None
6253

6354
filename = os.path.basename(file_path)
64-
match = re.search(r'(\d+)[._](\d+)[._](\d+)[._](\d+)', filename)
55+
match = re.search(r'[-_](\d+)[._](\d+)[._](\d+)[._](\d+)', filename)
6556
if match:
6657
groups = match.groups()
6758
if groups[3] == '0':
@@ -77,15 +68,14 @@ def extract_version_from_filename(file_path):
7768

7869
def get_update_counter(device):
7970
product_line = device.get_info(rs.camera_info.product_line)
80-
product_name = device.get_info(rs.camera_info.name)
8171
opcode = 0x09
8272
start_index = 0x30
8373
size = None
8474

8575
if product_line == "D400":
8676
size = 0x2
87-
elif "D555" in product_name:
88-
return 0 # D555 does not have update counter
77+
elif product_line == "D500":
78+
return 0 # D500 do not have update counter
8979
else:
9080
log.f( "Incompatible product line:", product_line )
9181

@@ -157,11 +147,22 @@ def find_image_or_exit( product_name, fw_version_regex = r'(\d+\.){3}(\d+)' ):
157147
device, ctx = test.find_first_device_or_exit()
158148
product_line = device.get_info( rs.camera_info.product_line )
159149
product_name = device.get_info( rs.camera_info.name )
160-
serial_number = device.get_info(rs.camera_info.serial_number)
161-
log.d( 'product line:', product_line, 'serial number:', serial_number )
150+
log.d( 'product line:', product_line )
162151
###############################################################################
163152
#
164153

154+
current_fw_version = rsutils.version( device.get_info( rs.camera_info.firmware_version ))
155+
log.d( 'current FW version:', current_fw_version )
156+
157+
# Determine which firmware to use based on product
158+
bundled_fw_version = rsutils.version("")
159+
custom_fw_path = None
160+
custom_fw_version = None
161+
if product_line == "D400" and args.custom_fw_d400:
162+
custom_fw_path = args.custom_fw_d400
163+
elif product_line == "D500" and args.custom_fw_d500:
164+
custom_fw_path = args.custom_fw_d500
165+
165166

166167
test.start( "Update FW" )
167168
# check if recovery. If so recover
@@ -170,8 +171,10 @@ def find_image_or_exit( product_name, fw_version_regex = r'(\d+\.){3}(\d+)' ):
170171
log.d( "recovering device ..." )
171172
try:
172173
# always flash signed fw when device on recovery before flashing anything else
173-
image_file = find_image_or_exit(product_name)
174-
cmd = [fw_updater_exe, '-r', '-f', image_file, '-s', serial_number]
174+
# on D500 we currently do not have bundled FW
175+
image_file = find_image_or_exit(product_name) if not product_line == "D500" else custom_fw_path
176+
cmd = [fw_updater_exe, '-r', '-f', image_file]
177+
del device, ctx
175178
log.d( 'running:', cmd )
176179
subprocess.run( cmd )
177180
recovered = True
@@ -186,41 +189,27 @@ def find_image_or_exit( product_name, fw_version_regex = r'(\d+\.){3}(\d+)' ):
186189
log.f( "Unexpected error while trying to recover device:", e )
187190
else:
188191
device, ctx = test.find_first_device_or_exit()
189-
# check we got the same serial number
190-
new_serial_number = device.get_info(rs.camera_info.serial_number)
191-
if new_serial_number != serial_number:
192-
log.f( "Recovered device has different serial number:", new_serial_number )
192+
current_fw_version = rsutils.version(device.get_info(rs.camera_info.firmware_version))
193+
log.d("FW version after recovery:", current_fw_version)
193194

194-
current_fw_version = rsutils.version( device.get_info( rs.camera_info.firmware_version ))
195-
log.d( 'current FW version:', current_fw_version )
196-
bundled_fw_version = rsutils.version("")
197-
if device.supports( rs.camera_info.recommended_firmware_version ): # currently, D500 does not support recommended FW
198-
bundled_fw_version = rsutils.version( device.get_info( rs.camera_info.recommended_firmware_version ) )
199-
log.d( 'bundled FW version:', bundled_fw_version )
200-
custom_fw_d400_version = extract_version_from_filename(custom_fw_d400_path)
201-
log.d( 'custom FW D400 version:', custom_fw_d400_version )
202-
custom_fw_d555_version = extract_version_from_filename(custom_fw_d555_path)
203-
log.d( 'custom FW D555 version:', custom_fw_d555_version )
204-
205-
# Determine which custom firmware to use based on product
206-
custom_fw_path = None
207-
custom_fw_version = None
208-
if product_line == "D400" and custom_fw_d400_path:
209-
custom_fw_path = custom_fw_d400_path
210-
custom_fw_version = custom_fw_d400_version
211-
elif "D555" in product_name and custom_fw_d555_path:
212-
custom_fw_path = custom_fw_d555_path
213-
custom_fw_version = custom_fw_d555_version
195+
196+
if custom_fw_path:
197+
custom_fw_version = extract_version_from_filename(custom_fw_path)
198+
log.d('Using custom FW version: ', custom_fw_version)
199+
elif device.supports(rs.camera_info.recommended_firmware_version): # currently, D500 does not support recommended FW
200+
log.i(f"No Custom firmware path provided. using bundled firmware")
201+
bundled_fw_version = rsutils.version(device.get_info(rs.camera_info.recommended_firmware_version))
202+
log.d('bundled FW version:', bundled_fw_version)
203+
else:
204+
log.w("No custom FW provided and no bundled FW version available; skipping FW update test")
205+
exit(0)
214206

215207
if (current_fw_version == bundled_fw_version and not custom_fw_path) or \
216208
(current_fw_version == custom_fw_version):
217209
if recovered or 'nightly' not in test.context:
218210
log.d('versions are same; skipping FW update')
219211
test.finish()
220212
test.print_results_and_exit()
221-
else:
222-
# It is expected that, post-recovery, the FW versions will be the same
223-
test.check(not recovered, on_fail=test.ABORT)
224213

225214
update_counter = get_update_counter( device )
226215
log.d( 'update counter:', update_counter )
@@ -236,7 +225,7 @@ def find_image_or_exit( product_name, fw_version_regex = r'(\d+\.){3}(\d+)' ):
236225
image_file = find_image_or_exit(product_name, fw_version_regex) if not custom_fw_path else custom_fw_path
237226
# finding file containing image for FW update
238227

239-
cmd = [fw_updater_exe, '-f', image_file, '-s', serial_number]
228+
cmd = [fw_updater_exe, '-f', image_file]
240229
if custom_fw_path:
241230
# Add '-u' only if the path doesn't include 'signed'
242231
if ('signed' not in custom_fw_path.lower()

0 commit comments

Comments
 (0)