thagrol / Guides

449 stars 43 forks source link

mass storage gadget - present a text file #12

Closed johngebbie closed 2 years ago

johngebbie commented 2 years ago

Is it possible to present just a normal text file to the USB host? I want to pass a script so the user can go sh /dev/something. (And the script will execute commands passed by serial.)

Thank you.

thagrol commented 2 years ago

Not tham I am aware of. A text file is not an (emulated) block device which USB mass storage gadget on the Pi and the SB host expect.

While you could pass a text file to the mass storage gadget at best the USB host would see it as an uninitialised and unformatted device. Or, to put it another way, if you wrote a text file to a USB stick using dd or an image writer (etcher, win32discimager, etc) would you expect the PC to be able to read it?