2 while mainsel=$(zenity --title="SD Card Mass Storage" --width="380" --height="200" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "sd1" "Switch SD Card 1 to Mass Storage Mode" "sd2" "Switch SD Card 2 to Mass Storage Mode" ); do
5 remount=$(cat /proc/mounts | grep /dev/mmcblk0p1 | awk '{print "mount " $1 " " $2 " -o " $4}' | sed "s/,codepage=[A-Za-z0-9]*,/,/g")
6 if umount /dev/mmcblk0p1
8 # switch to mass storage
9 if lsmod | grep g_cdc &>/dev/null
11 echo Found g_cdc - removing...
15 modprobe g_file_storage file=/dev/mmcblk0p1 stall=0
16 zenity --title="SD Card 1 Mass Storage Mode" --info --text="SD Card Slot 1 is currently in Mass Storage Mode.\n\nClick on OK when you're finished with your data transfer\nand want to go back to normal mode."
18 if [ $ethernet=1 ]; then
19 echo Reloading g_cdc...
24 zenity --title="Error" --error --text="Error.\nEither there is no card in SD Slot 1 or some program\nis currently accessing the card.\n\nPlease make sure to close any programs that currently access te SD Card." --timeout 6
28 remount=$(cat /proc/mounts | grep /dev/mmcblk0p1 | awk '{print "mount " $1 " " $2 " -o " $4}' | sed "s/,codepage=[A-Za-z0-9]*,/,/g")
29 if umount /dev/mmcblk1p1
31 # switch to mass storage
32 if lsmod | grep g_cdc &>/dev/null
34 echo Found g_cdc - removing...
38 modprobe g_file_storage file=/dev/mmcblk1p1 stall=0
39 zenity --title="SD Card 2 Mass Storage Mode" --info --text="SD Card Slot 2 is currently in Mass Storage Mode.\n\nClick on OK when you're finished with your data transfer\nand want to go back to normal mode."
41 if [ $ethernet=1 ]; then
42 echo Reloading g_cdc...
47 zenity --title="Error" --error --text="Error.\nEither there is no card in SD Slot 2 or some program\nis currently accessing the card.\n\nPlease make sure to close any programs that currently access te SD Card." --timeout 6