Skip to content

Commit 77bbceb

Browse files
committed
fix recovery issues
..
1 parent 9ccd332 commit 77bbceb

File tree

3 files changed

+39
-48
lines changed

3 files changed

+39
-48
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ 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}")
183+
log.i(f"custom D400 firmware path was provided ${custom_fw_path}")
184184
elif opt == '--custom-fw-d555':
185185
custom_fw_d555_path = arg # Store the custom D555 firmware path
186186
log.i(f"custom D555 firmware path was provided ${custom_fw_d555_path}")

unit-tests/test-fw-update.py

Lines changed: 35 additions & 46 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')
24+
parser.add_argument('--custom-fw-d400', type=str, help='Path to custom D400 firmware file')
2525
parser.add_argument('--custom-fw-d555', type=str, help='Path to custom D555 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 "D555" in product_name and args.custom_fw_d555:
164+
custom_fw_path = args.custom_fw_d555
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 D555 we currently do not have bundled FW
175+
image_file = find_image_or_exit(product_name) if "D555" not in product_name 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)