import time
from machine import Pin
led = Pin('LED_GREEN', Pin.OUT)
while (True):
led.on()
time.sleep_ms(250)
led.off()
time.sleep_ms(250)
on a camera connected through USB to an android device.
I believe I’m successfully copying the script cat /storage/D21A-D8D4/main.py returns the copied script. Then I’m sending a reset command through serial (/dev/ttyACMX) using
Find OpenMV storage device root by scanning every external media for the file ‘.openmv_disk’;
If this fails, parse dumpsys mount output to find Volume with fsLabel=OPENMV
Unmounting said storage;
Waiting a whole 5 seconds;
Reset OpenMV camera with the above command.
The other tricky part for me was to ensure I was sending the command to the right serial ttyACMX. To find it I used the following grep 1209/abd1 /sys/class/tty/*/device/uevent and mapping the matching tty device to /dev/$tty.