We currently have devices functioning well, logging data to an SD card. We can retrieve the data by physically removing the SD card whenever needed.
However, we'd like to avoid removing the SD card entirely and instead access the data directly via a USB cable.
I’m looking for ideas or scenarios where we could list all the files on the SD card using Python. We've already written a code to access the serial. But we want to list the files and also aim to copy files from the SD card.
I understand implementing USB mass storage on particle devices can be difficult, but are there any workarounds? Has anyone successfully achieved this or have an example code to share?
USB mass storage is not possible on the Boron. The best solution is a two-part solution that uses WebUSB from a webapp as the front-end, and a USB control request handler on the Boron. You could also use a node.js command line tool with the particle-usb package.
Your Boron firmware would register a USB control request handler. This works separate from the USB serial (CDC) debug log, and allows structured data to be transmitted. You can only register one USB control request handler per application, but typically use format like JSON which would make it possible to implement separate command like list files, download file, etc..
You could also just take over the USB serial port and disable serial logging and implement a command line interface, however this is less useful for downloading files and is less flexible.