(note: the card in this case is being read by a 3d printer. but this would not appear to be any different than being written or read by a PC) The ESP would not be writing to the SD. Just reading on a timed basis.
In a perfect world with code to detect whether the CD was being accessed by the PC.
Is this physically impossible, or just difficult due to the danger (that code might solve) of simultaneous access?
The project you link to needs a client on the PC to interface with the WebDAV server to access files and it is not something the operating system can do natively.
Ideally you need an MCU with native USB support as you cannot do this through a USB/UART interface chip as used on most ESP development boards.
I think there is now a variant of the ESP that does have built in USB but I know nothing of what it is capable of on USB.
The Teensy used to have a storage endpoint on it's native USB but I have never used it or know if it works/worked.
I'm tempted to accept defeat. There are no less than a dozen other posts over the last two years asking some variation of this same question. All answered by people far more knowledgeable with an "it's not possible" reply.
But... I know that i can wire the SD card to a USB connector without the ESP32 and create a memory stick.
And I know I can attach the ESP to the SD card and read it and transmit files to and from it over WiFi. That's pretty much what every SD project here is doing in some form.
And it seems to make sense that if I had a switch, I could switch connections between the two so that each could access the SD card at different times. That's the fundamental equivalent of physically pulling it out of one device by hand and putting it into another.
So in my imagination, it seems reasonable to suspect that I could either add some kind of switch chip that the ESP could control to achieve that so both machines aren't trying to access the disk at the same time. Or perhaps not even have to worry about that because it's something the SD card circuitry already deals with on any multi-core computer.
Am I totally off base here? Give me some of that hacker ingenuity and can-do spirit! This seems like a fun puzzle that needs solving. So many projects here would benefit from the ability to load and retrieve files from an SD thru that USB port.
Complexity has certainly increased. But I think the basic premise still stands. Both the PC and the ESP32 can read the MicroSD in their own way separately (right?). And switching between them would (again, I assume) be the equivalent of pulling the card out manually and swapping it between machines.
So I'm still searching for a way to enable the ESP to periodically read from the MicroSD while it remains connected to the PC.
As far as I can tell the ESP32-S3 is not currently supported by arduino-esp32. But the ESP32-S2 is supported and it has USB hardware. A USB Mass Storage example is included. I have very little experience with ESP32 S2 so I will not be trying this any time soon. But it would be interesting to hear about some hand-on experience.
Note CircuitPython and (I think MicroPython) use this feature on ESP32 S2 boards so these boards appear as USB hard drives.
Pico’s BOOTSEL mode lives in read-only memory inside the RP2040 chip, and can’t be overwritten accidentally. No matter what, if you hold down the BOOTSEL button when you plug in your Pico, it will appear as a drive onto which you can drag a new UF2 file.