Pandora-Scripts: Added check for g_cdc in op_storage.sh
authorMichael Mrozek <EvilDragon@openpandora.de>
Mon, 21 Jun 2010 23:30:39 +0000 (01:30 +0200)
committerMichael Mrozek <EvilDragon@openpandora.de>
Mon, 21 Jun 2010 23:30:39 +0000 (01:30 +0200)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_storage.sh
recipes/pandora-system/pandora-scripts/pandorascripts.pnd

index 236a0d6..7efef41 100644 (file)
@@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 DEPENDS = "zenity dbus"
 RDEPENDS = "zenity dbus"
 
-PR = "r27"
+PR = "r28"
 
 SRC_URI = " \
           file://op_bright.sh \
@@ -35,6 +35,7 @@ SRC_URI = " \
           file://op_lcdsettings.sh \
 #          file://op_lcdsettings.desktop \
            file://op_lcdrate.sh \
+          file://op_storage.sh \
           file://op_nubmode.sh \
 #        file://op_nubmode.desktop \
           file://gui.conf \
@@ -71,6 +72,7 @@ do_install() {
           install -m 0755 ${WORKDIR}/op_lcdsettings.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_lcdrate.sh ${D}${prefix}/pandora/scripts/
          install -m 0755 ${WORKDIR}/op_nubmode.sh ${D}${prefix}/pandora/scripts/
+         install -m 0755 ${WORKDIR}/op_storage.sh ${D}${prefix}/pandora/scripts/
 
           install -d ${D}${prefix}/pandora/menu/
           install -m 0755 ${WORKDIR}/pandorascripts.pnd ${D}${prefix}/pandora/menu/
index 760cff6..d293cb5 100755 (executable)
@@ -6,11 +6,19 @@ while mainsel=$(zenity --title="SD Card Mass Storage" --width="380" --height="20
   if umount /dev/mmcblk0p1
   then
     # switch to mass storage
-    rmmod g_cdc
+    if lsmod | grep g_cdc &>/dev/null
+       then
+       echo Found g_cdc - removing...
+       rmmod g_cdc
+       ethernet=1
+    fi
     modprobe g_file_storage file=/dev/mmcblk0p1 stall=0
     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."
     rmmod g_file_storage
-    modprobe g_cdc
+    if [ $ethernet=1 ]; then
+      echo Reloading g_cdc...
+      modprobe g_cdc
+    fi
     $remount
   else
      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
@@ -21,11 +29,19 @@ while mainsel=$(zenity --title="SD Card Mass Storage" --width="380" --height="20
   if umount /dev/mmcblk1p1
   then
     # switch to mass storage
-    rmmod g_cdc
+     if lsmod | grep g_cdc &>/dev/null
+       then
+       echo Found g_cdc - removing...
+       rmmod g_cdc
+       ethernet=1
+    fi
     modprobe g_file_storage file=/dev/mmcblk1p1 stall=0
     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."
     rmmod g_file_storage
-    insmod g_cdc
+    if [ $ethernet=1 ]; then
+      echo Reloading g_cdc...
+      modprobe g_cdc
+    fi
     $remount
   else
      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
index 2e46dad..b777886 100644 (file)
Binary files a/recipes/pandora-system/pandora-scripts/pandorascripts.pnd and b/recipes/pandora-system/pandora-scripts/pandorascripts.pnd differ