Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions picamera2/devices/imx500/imx500.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,20 @@ def __init__(self, network_file: str, camera_id: str = '', tensor_injection: boo
if self.device_fd is None:
raise RuntimeError('IMX500: Requested camera dev-node not found')

# Progress status specific debugfs entries.
# Progress status specific debugfs entries. These are cosmetic (they only feed the
# firmware upload progress bar), so a PermissionError here must not break IMX500.
if imx500_device_id:
self.fw_progress = open(f'/sys/kernel/debug/imx500-fw:{imx500_device_id}/fw_progress', 'r')
path = f'/sys/kernel/debug/imx500-fw:{imx500_device_id}/fw_progress'
try:
self.fw_progress = open(path, 'r')
except (PermissionError, FileNotFoundError) as err:
print(f'IMX500: Unable to open {path} ({err}). Firmware upload progress bar will not be displayed')
if spi_device_id:
self.fw_progress_chunk = open(f'/sys/kernel/debug/rp2040-spi:{spi_device_id}/transfer_progress', 'r')
path = f'/sys/kernel/debug/rp2040-spi:{spi_device_id}/transfer_progress'
try:
self.fw_progress_chunk = open(path, 'r')
except (PermissionError, FileNotFoundError) as err:
print(f'IMX500: Unable to open {path} ({err}). Firmware upload progress bar will not be displayed')

if self.config['network_file'] != '':
if tensor_injection:
Expand Down Expand Up @@ -449,6 +458,9 @@ def get_fw_upload_progress(self, stage_req) -> tuple:
return (0, 0)

def show_network_fw_progress_bar(self):
if not self.fw_progress and not self.fw_progress_chunk:
# No readable progress source: skip the bar so the worker does not spin on (0, 0).
return
p = multiprocessing.Process(target=self.__do_progress_bar,
args=(FW_NETWORK_STAGE, 'Network Firmware Upload'))
p.start()
Expand Down
2 changes: 1 addition & 1 deletion tests/imx500.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

print("Got output tensors on", tensor_count, "of", NUM_FRAMES, "frames")
if tensor_count < NUM_FRAMES // 2:
print("ERROR: expected at least", NUM_FRAMES // 2, "frames with output tensors")
print("ERROR: expected at least", NUM_FRAMES // 2, "frames with output tensors, got", tensor_count)

picam2.stop()
picam2.close()
Loading