Any #ESP32 experts here? I am currently pondering about an idea for a project, for which I need to be able to configure some settings easily on my ESP without access to a programmer. My idea now was to emulate a MSD with a fake filesystem with only one file - config.txt. If this file is read, I want to send a generated file with the current configuration settings from memory. If the file is written, I parse the file and set the settings accordingly. Is something like this possible?
@DJGummikuh Not sure I get exactly what you are trying to do, but wokwi.com provides an emulator so you can build a fake system on your PC, including an SD card (note that it doesn't give you persistent flash, but that is available (4, 8 or 16MB) on every esp32 as well).
@algaeman nah sorry, you misunderstood me here. I want to program a physical ESP such that it advertises itself as a USB Stick / generic mass storage device and allows configuration from a user by writing a config.txt file to the ESP as if the are copying it to a USB drive or sd card, using standard explorer file handling.
@DJGummikuh This won't be so easy on flash, b/c Arduino doesn't expose the raw diskio for fatfs, but if you start from https://github.com/espressif/arduino-esp32/blob/master/libraries/SD_MMC/examples/SD2USBMSC/SD2USBMSC.ino, you can put a polling in the loop to check for changes to /config.ini, and take some action based on that.
arduino-esp32/libraries/SD_MMC/examples/SD2USBMSC/SD2USBMSC.ino at master · espressif/arduino-esp32

Arduino core for the ESP32. Contribute to espressif/arduino-esp32 development by creating an account on GitHub.

GitHub
@algaeman if I could emulate the raw fat structure from code, I wouldn't actually need a fat fs in flash. That is already helpful, thank you, I guess I have to start looking into low-level FAT next 👍
@DJGummikuh https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/examples/USBMSC/USBMSC.ino. But, I think you are better off using fatfs, and put the raw functions (https://github.com/espressif/arduino-esp32/blob/master/libraries/SD_MMC/src/SD_MMC.cpp#L420-L425) into FFat.cpp. You need to be able to access it from both sides. Note that there are very messy race conditions in there, so you will have to carefully mutex the access, or else let it sit for a while after changes before reading.
arduino-esp32/libraries/USB/examples/USBMSC/USBMSC.ino at master · espressif/arduino-esp32

Arduino core for the ESP32. Contribute to espressif/arduino-esp32 development by creating an account on GitHub.

GitHub
@algaeman thank you. The beauty is that it doesn't actually have to be symmetrical (beyond what is needed from the host FS stack). Since I only need the content, I would be cool if you send me a wtf.bmp file (which is just a badly named properties file), after sending it, I would still tell the host there is only one "config.txt" on the drive.. Will have to play around with that a lot, but I do see a path forward, thanks!