I made attempt 3 to use file_storage.c as a means of presenting an ISO image on the Pre as a CD-ROM drive over USB. I tried grabbing several of the more recent versions of file_storage.c from git.kernel.org in an attempt to back-port them to the 2.6.24 kernel.
I found the following: * file_storage.c got CD-rom support in January of 2009: * <pre>vermagic: 2.6.32-28-server SMP mod_unload modversions parm: file:names of backing files or devices (array of charp) parm: ro:true to force read-only (array of bool) parm: luns:number of LUNs (uint) parm: removable:true to simulate removable media (bool) parm: stall:false to prevent bulk stalls (bool) parm: cdrom:true to emulate cdrom instead of disk (bool) </pre>
I proceeded by using the January 2009 version, there was really no work needed to compile this in place of the old version. I did need to make one change. By default, if you load the resulting module (g_file_storage), it will attempt to use the same sysfs entries as f_mass_storage.c - */sys/devices/platform/musb_hdrc.0/gadget/gadget-lunX. * Attempting to insert the module is very disappointing when this occurs. To work around this, I changed the sysfs entry name by modifying the following line in fsg_bind() from
snprintf(curlun-dev.bus_id, BUS_ID_SIZE, %s-lun%d, gadget-dev.bus_id, i);
snprintf(curlun-dev.bus_id, BUS_ID_SIZE, %s-cdlun%d, gadget-dev.bus_id, i);
This enumerates the lun entries starting with gadget-cdlun0.
The results are not pleasing. I tried 3 tests:
The OS detected the device as File-CD based storage gadget, took about 5 minutes to install the driver and then didn’t see anything presented. I noted that if I rmmod’d the module, I would see a CD-ROM drive pop-up in windows explorer temporarily ultimately not helpful.
The BIOS post confirmed that there was a File-CD based storage gadget plugged in. I attempted to boot off the device and got the familiar message that my boot media was invalid.
After plugging this in and watching /var/log/messages fly by, I saw that the system discovered the gadget. It did take an unusual amount of time for the system to mount the device after discovering it (~20 second). After the device was mounted, I had no problems accessing the contents of the ISO.