I'm somewhat really dissapointed. You are selling a device with sdcard slot, but in general the sdcard slot ist unusable.
I have code which is running in host and standalone mode on the main branch (not needing sdcard). But when I want to run the same code with the branch sdcard_support, the code only works in host mode. The only thing the code is doing: Serving the file system. So about nothing what could break. A nice side effect: The device is soft bricked after flashing the application.
I have one idea for a reason. Running the code in standalone in the main branch, the webserver serves the directory /media/mmcsd-0-0/ with the application file in it. In host mode this is not existing. But this is also the folder where the sdcard is mounted. So i think there is a conflict with that path and possibly the application cannot be loaded, since its not on the sdcard, which is now mounted at that path.
import time
import depthai as dai
# Create pipelinepipeline = dai.Pipeline()
# Define source and output
scriptServer = pipeline.create(dai.node.Script)
# Properties
scriptServer.setProcessor(dai.ProcessorType.LEON_CSS)
scriptServer.setScript("""
import http.server
import socketserver
import socket
import fcntl
import struct
import os
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
-1071617759, # SIOCGIFADDR
struct.pack('256s', ifname[:15].encode())
)[20:24])
# Note: `chdir` here will prevent unmount, this should be improved!
# os.chdir('/media/mmcsd-0-0/')
PORT = 80
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
ip = get_ip_address('re0')
node.warn(f'===== HTTP file server accessible at: http://{ip}')
httpd.serve_forever()""")
flash = True
# Flash the pipeline
if flash:
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
progress = lambda p: print(f'Flashing progress: {p * 100:.1f}%')
bootloader.flash(progress, pipeline)
else:
# Connect to device and start pipeline
with dai.Device() as device:
device.startPipeline(pipeline)
print('======== Press C to capture JPEG images to SDcard')
while True:
key = input()[0]
if key == ord('q'):
break
time.sleep(1)