On Mon, 30 Oct 2006, Hughes, James wrote:

> > Depending on your situation, you might want to set up 
> > g_file_storage so that it pretends to have removable media.  
> > Every so often your user program could "remove the media" 
> > (this can be done using sysfs), update the contents of the 
> > backing file, and then "insert the media".  If somebody had 
> > attached a laptop and was reading the data at the time, then 
> > the "remove the media" step would fail and your program would 
> > know not to update the contents at that moment.
> 
> This sounds like a good direction to take, although I am not familiar
> with how to use sysfs to 'remove the media' - pointers in this direction
> much appreciated.

There is some explanation in the rather long comment at the start of the 
file_storage.c source file.  Basically you have to find the gadget's 
directory, which is probably under /sys/devices/platform, and look in 
the *_lun0 subdirectory.  There you should see a file named "file".  
Writing a blank line to it corresponds to ejecting the media, and writing 
the name of a backing file corresponds to inserting that file as the 
medium.  For this to work you must specify "removable=y" when you install 
g_file_storage.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to