Turning on and off the USB mass storage driver
You can use two little handy scripts to turn on and off the USB mass storage driver permanently:
(All scripts must have UNIX line endings (Crimson Editor and UltraEdit can do this on request))
To turn it on, use this script:
usbOn.gpe
#!/bin/bash # Unmount SD... umount /mnt/sd # Start modules modprobe net2272 modprobe g_file_storage file=/dev/mmcsd/disc0/part1 # Launch back menu cd /usr/gp2x exec /usr/gp2x/gp2xmenu
To turn it off again, use this script:
usbOff.gpe
#!/bin/bash # Stop modules rmmod g_file_storage rmmod net2272 # Remount SD... mount /proc mount -o remount,sync,noatime / if test ! "`mount | grep "/disc0/"`"; then echo "Mount SD disc, if not mounted..." mount -t vfat -o iocharset=utf8,noatime,sync /dev/discs/disc0/part1 /mnt/sd fi # launch back menu cd /usr/gp2x exec /usr/gp2x/gp2xmenu
It works while you are in the menu, I don't know what happens/which conflicts can happen. USE AT OWN RISK
gfoot: Neat. I've tried using this while developing, but it's not as useful as it first seems. Because the mass storage driver is operating on the hardware device, not the mounted filesystem, it doesn't work properly if the SD card is mounted at the time - I had inconsistencies between which GPH programs could see which files, and also between the PC and the GP2X. If this really is what is happening, it's probably risking corruption of the filesystem. I guess the gp2xmenu USB option unmounts and remounts for you.
c0diq: gfoot, I modified the scripts to unmount the SD in the usbOn.gpe and remount it in the usbOff.gpe. Hope this helps.