I have a device that saves screenshots when you put a flash drive with exFAT/FAT32 and a specific directory tree in its USB socket. I want to livestream these screenshots to other devices as fast as possible via ethernet:
device -> flash drive -> ethernet
So I tried an ARM device (Orange Pi Zero) with OTG support and g_mass_storage
kernel module which emulates an USB flash drive via USB OTG:
g_mass_storage - To have your Pi Zero appear as a mass storage device (flash drive), first create a mini filesystem in a file on your Pi with
sudo dd if=/dev/zero of=/piusb.bin bs=512 count=2880
and set it up as a fat32 filesystem withsudo mkdosfs /piusb.bin
. Then, when enabling it, addfile=/piusb.bin stall=0
onto the end, for examplesudo modprobe g_mass_storage file=/piusb.bin stall=0
.
Next I mounted the emulated flash drive for testing purpose on a Laptop (Linux Mint 18) and the flash drive file via sudo mount /piusb.bin /mnt/
on the ARM device. But when I add new files/directories in one system it doesn't appear on the other. I have to remount the device/file first to refresh the files.
So is it even possible to read (and stream) the written data at the same time on my ARM device with g_mass_storage
? Or is there a better way to solve my problem?