I've got a Pi Zero W that I'm using in OTG/gadget mode. I've activated dwc2 USB, partitioned and formatted the file that is to be used as filesystem and loaded g_mass_storage. It is working fine in Windows - I can connect and see the contents, add/delete files, eject and reconnect seeing changes fine. I can mount it in Raspbian to check contents and can also attach it to other devices and interact with it fine.
However, I've got some devices that are very picky about what USB devices they will connect to (basically only flash drives). The problem is the OTG mass storage is being identified as "File-Stor Gadget (Rev: 0404)", which is causing it to be rejected.
I can successfully use a USB flash drive in the target devices and have scraped the vendor/product ID from it to see if I can mimic them via g_mass_storage.
I have therefore adjusted modprobe to the following:
sudo modprobe g_mass_storage file=/home/pi/piusb.bin stall=0 removable=1 idVendor=0x0781 idProduct=0x5572 bcdDevice=0x011a iManufacturer="SanDisk" iProduct="Cruzer Switch" iSerialNumber="1234567890"
Unfortunately this doesn't seem to make any difference to how it is presented to the device.
PS When connecting to Windows, here's what the USB mass storage displays:
USBSTOR\DISK&VEN_LINUX&PROD_FILE-STOR_GADGET&REV_0404\1234567890&0 USBSTOR\DiskLinux___File-Stor_Gadget0404 USBSTOR\DiskLinux___File-Stor_Gadget USBSTOR\DiskLinux___ USBSTOR\Linux___File-Stor_Gadget0 Linux___File-Stor_Gadget0 USBSTOR\GenDisk GenDisk
& here's what SanDisk shows:
USBSTOR\DISK&VEN_SANDISK&PROD_CRUZER_SWITCH&REV_1.26\4C532015741508522393&0 USBSTOR\DiskSanDisk_Cruzer_Switch___1.26 USBSTOR\DiskSanDisk_Cruzer_Switch___ USBSTOR\DiskSanDisk_ USBSTOR\SanDisk_Cruzer_Switch___1 SanDisk_Cruzer_Switch___1 USBSTOR\GenDisk GenDisk