Skip to content

Commit dd41421

Browse files
committed
Updated flash_bootloader example and core
1 parent 04baab2 commit dd41421

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

examples/bootloader/flash_bootloader.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@
1414
print("Specify either 'usb' or 'network' bootloader type")
1515
exit()
1616

17-
(found, info) = dai.DeviceBootloader.getFirstAvailableDevice()
18-
if not found:
17+
deviceInfos = dai.DeviceBootloader.getAllAvailableDevices()
18+
if len(deviceInfos) == 0:
1919
print("No device found to flash. Exiting.")
2020
exit(-1)
21+
else:
22+
for i, di in enumerate(deviceInfos):
23+
print(f'[{i}] {di.getMxId()} [{di.desc.protocol.name}]', end='')
24+
if di.state == dai.XLinkDeviceState.X_LINK_BOOTLOADER:
25+
with dai.DeviceBootloader(di) as bl:
26+
print(f' current bootloader: {bl.getVersion()}', end='')
27+
print()
28+
selected = input(f'Which DepthAI device to flash bootloader for [0..{len(deviceInfos)-1}]: ')
29+
info = deviceInfos[int(selected)]
2130

2231
hasBootloader = (info.state == dai.XLinkDeviceState.X_LINK_BOOTLOADER)
2332
if hasBootloader:
@@ -31,6 +40,7 @@
3140
# Open DeviceBootloader and allow flashing bootloader
3241
print(f"Booting latest bootloader first, will take a tad longer...")
3342
with dai.DeviceBootloader(info, allowFlashingBootloader=True) as bl:
43+
print("Bootloader version to flash:", bl.getVersion())
3444
currentBlType = bl.getType()
3545

3646
if blType == dai.DeviceBootloader.Type.AUTO:

0 commit comments

Comments
 (0)