> I need to try the above with Mac OS and Linux, but the approach seems to have promise.

Hmmm . . . the behavior is different with Linux and Mac OS :-(

Neither notices the "eject" of the media with the "clear_backing_file" option.  In fact, the file storage gadget actually allows changes after the eject on both OSes!

I noticed that if I do a "cat /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/file" after the "clear_backing_file" I still get /root/data/backing_file.  I would have expected a null result.  This probably explains why Mac OS & Linux are able to still access the backing store!

Any idea what might be going on here?  Should I be doing something different for the "clear_backing_store".

Steve


On 4/19/07, Steve Sakoman <sakoman@gmail.com> wrote:
>I think it's a good idea, play with it; If it works well let me know :-)

I've only done a small amount of Windows XP testing, but it seems to work quite well!

Here's what I ended up doing for an init.d script:

###################################
#!/bin/sh
#
# A startup script for file storage gadget
#
# Usage /etc/init.d/S75fsgadget start|stop|restart|set_backing_file|clear_backing_file

start() {
        echo "Starting file storage gadget..."
        /sbin/modprobe g_file_storage stall=0 removable=1
}

stop() {
        echo "Stopping file storage gadget"
          /sbin/modprobe -r g_file_storage
}

set_backing_file() {
        echo "/root/data/backing_file" > /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/file
}

clear_backing_file() {
        echo "" > /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/file
}

case "$1" in
start)
        start
        set_backing_file
        ;;
stop)
        clear_backing_file
        stop
        ;;
restart)
        stop
        start
        ;;
set_backing_file)
        set_backing_file
        ;;
clear_backing_file)
        clear_backing_file
        ;;

*)
        echo "Usage /etc/init.d/S75fsgadget start|stop|restart|set_backing_file|clear_backing_file"
        exit 1
esac
##############################

With this script the fs gadget starts up at boot and shuts down cleanly at shutdown.

If I use the clear_backing_file option from the command line, Windows notices the "eject" of the media correctly and keeps the drive in "My Computer".

If I then use the set_backing_file option, Windows notices the "insert" of the media and shows the files on the desktop.

If I use the stop option, Windows notices that the drive itself is gone and removes it from "My Computer", conversely the start option cause the drive to appear in "My Computer"

I need to try the above with Mac OS and Linux, but the approach seems to have promise.

Thanks again,

Steve





On 4/19/07, Alexandre Pereira Nunes <alex@omnisystem.com.br> wrote:
Steve Sakoman wrote:
> Alexandre,
>
> Sounds like you have some personal experience with the FS gadget.
> Thanks for the advice!  I'll give it try.
>
> Steve
>
> Do you think it would make sense to bundle this all up in an init.d
> start/stop/restart file?  The start could do the  modprobe & what you
> call the #1 command, the stop would do your #2 command, and the  restart
... would do stop and then start ?

I think it's a good idea, play with it; If it works well let me know :-)

- Alexandre


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users