@@ -111,18 +111,47 @@ we recommend running the factory reset script below. It will also flash the late
111111
112112 with tempfile.NamedTemporaryFile() as tmpBlFw:
113113 tmpBlFw.write(bytes (blBinary))
114- (f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
114+
115+ (f, device_info) = dai.DeviceBootloader.getFirstAvailableDevice()
115116 if not f:
116117 print (' No devices found, exiting...' )
117118 exit (- 1 )
118119
119- with dai.DeviceBootloader(bl, allowFlashingBootloader = True ) as bootloader:
120- progress = lambda p : print (f ' Flashing progress: { p* 100 :.1f } % ' )
120+ with dai.DeviceBootloader(device_info, allowFlashingBootloader = True ) as bootloader:
121+ progress = lambda p : print (f ' Factory reset progress: { p* 100 :.1f } % ' )
122+ # Override SBR table, to prevent booting flashed application
123+ [success, msg] = bootloader.flashBootloader(progress, tmpBlFw.name)
124+ if success:
125+ print (' Successfully overwritten SBR table. Device should now be reacheable through PoE' )
126+ else :
127+ print (f " Couldn't overwrite SBR table to unbrick the device. Error: { msg} " )
128+
129+ You can also **factory reset OAK POE at specific IP ** if it's not reachable (not in same LAN).
130+
131+ .. code-block :: python
132+
133+ import depthai as dai
134+ import tempfile
135+
136+ blBinary = dai.DeviceBootloader.getEmbeddedBootloaderBinary(dai.DeviceBootloader.Type.NETWORK )
137+ blBinary = blBinary + ([0x FF ] * ((8 * 1024 * 1024 + 512 ) - len (blBinary)))
138+
139+ with tempfile.NamedTemporaryFile() as tmpBlFw:
140+ tmpBlFw.write(bytes (blBinary))
141+
142+ device_info = dai.DeviceInfo()
143+ device_info.state = dai.XLinkDeviceState.X_LINK_BOOTLOADER
144+ device_info.desc.protocol = dai.XLinkProtocol.X_LINK_TCP_IP
145+ device_info.desc.name = " 192.168.34.110" # Set IP here
146+
147+ with dai.DeviceBootloader(device_info, allowFlashingBootloader = True ) as bootloader:
148+ progress = lambda p : print (f ' Factory reset progress: { p* 100 :.1f } % ' )
121149 # Override SBR table, to prevent booting flashed application
122150 [success, msg] = bootloader.flashBootloader(progress, tmpBlFw.name)
123151 if success:
124- print (' Successfully overwritten SBR table. Device should be reacheable through PoE after switching the boot switches back to previous (0x3) value ' )
152+ print (' Successfully overwritten SBR table. Device should now be reacheable through PoE' )
125153 else :
126154 print (f " Couldn't overwrite SBR table to unbrick the device. Error: { msg} " )
127155
156+
128157 .. include :: ../includes/footer-short.rst
0 commit comments