automount/unmounting of mmc device in embedded linux-kernel 2.6

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm developing an application on embedded linux kernel 2.6 powered device and Auto mounting and un-mounting process is not works correctly.



e.g. checking dmesg show kernel correctly determine insertion/removing of MMC device( I also can check this via /sys/blk/mmcblk0 ), after booting with MMC in slot ,MMC is initially mounted to /mnt/sdcard, but after removing MMC from slot,this directory is still valid with no data inside.



(please consider removing MMC without umount is one of my test cases and system must automatically unmount after a moment in this situation),Also after re-insertion of MMC ,it will not mount again(checking dmesg show kernel detect MMC insertion).



my Device use busybox mdev instead of udev and hotplug is enabled but mmcblk device handling is commented and I have no Idea how auto mounting is handled.
this is my hotplug code :



#!/bin/sh
#
# A generic /sbin/hotplug multiplexer program
#
# This script allows any program to be called when /sbin/hotplug is
# called. It will run any programs located in the default hotplug
# directory (currently /etc/hotplug.d/) that match up with the first
# argument that this script is called with. The matching is done by
# adding a directory name to the default directory and looking for any
# programs in that directory that are executable, and end in .hotplug
# (to allow backup programs to be live on safely.)
#
# For example, if /sbin/hotplug is called with the usb argument then
# this script will look in the /etc/hotplug.d/usb/ directory for any
# executable programs that end in .hotplug.
#
# After all programs in the argument directory are executed, the
# "default" directory is searched for any executable programs in it,
# that end in .hotplug. The default directory is currently
# /etc/hotplug.d/default/
#
# - Greg Kroah-Hartman
# May 1, 2003
#
# Released under the GPL Version 2.
#

DIR="/etc/hotplug.d"

#for I in "$DIR/$1/"*.hotplug "$DIR/"default/*.hotplug ; do
# if [ -f $I ]; then
# test -x $I && $I $1 ;
# fi
#done


#for debug
# if [ $DEVNAME ]; then
# echo "===== USB hotplug event =====" >> $DEVNAME.txt
# else
# echo "===== USB hotplug event =====" >> hotplug_event.txt
# fi
# echo "DEVPATH:$DEVPATH"
# echo "SUBSYSTEM:$SUBSYSTEM"
# echo "DEVTYPE:$DEVTYPE"
# echo "DEVNAME:$DEVNAME"
# echo "MAJOR:$MAJOR"
# echo "MINOR:$MINOR"
# echo "PRODUCT:$PRODUCT"
# echo "INTERFACE:$INTERFACE"
# echo "TYPE:$TYPE"
# echo "VENDOR_ID:$VENDOR_ID"
# echo "GUID:$GUID"
# echo "SPEFICIER_ID:$SPEFICIER_ID"
# echo "VERSION:$VERSION"
# echo "0:$0"
# echo "1:$1"
# echo "2:$2"
# echo "3:$3"



if [ $ACTION = add ]; then
echo "== add =="
if [ $SUBSYSTEM = net ]; then
echo "== net =="
if [ $INTERFACE = eth0 ]; then
echo "== eth0 =="
. /mnt/etc/enet.cfg
ifconfig eth0 hw ether $ENETCFG_MAC
ifconfig eth0 up
fi
elif [ $DEVTYPE = partition ]; then
echo "== partition =="
if [ $MAJOR = 8 ]; then
echo "== USB storage =="
mount /dev/$DEVNAME
elif [ $MAJOR = 179 ]; then
echo "== SD Card =="
#mount /dev/mmcblk0p1
fi
fi
elif [ $ACTION = remove ]; then
echo "== remove =="
if [ $SUBSYSTEM = net ]; then
echo "== net =="
if [ $INTERFACE = eth0 ]; then
echo "== eth0 =="
# ifconfig eth0 down
fi
elif [ $DEVTYPE = partition ]; then
echo "== partition =="
if [ $MAJOR = 8 ]; then
echo "== USB storage =="
if [ $DEVNAME = sda1 ]; then
umount /mnt/usb
else
umount /mnt/usb2
fi
elif [ $MAJOR = 179 ]; then
echo "== SD Card =="
#umount /mnt/sdcard
fi
fi
fi

exit 0


Do you have any idea how it handles auto mounting / un-mounting of MMC_block?
2- also when I un-commenting these section, problem is still remain.



EDIT:
Seems this is not related to the automount.sh script ,because I edit and checks many times and if this script be called it must correctly handled mount/unmount process of MMc,the only thing is remain is bug in the busybox version of mine(which is V1.10.11).







share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm developing an application on embedded linux kernel 2.6 powered device and Auto mounting and un-mounting process is not works correctly.



    e.g. checking dmesg show kernel correctly determine insertion/removing of MMC device( I also can check this via /sys/blk/mmcblk0 ), after booting with MMC in slot ,MMC is initially mounted to /mnt/sdcard, but after removing MMC from slot,this directory is still valid with no data inside.



    (please consider removing MMC without umount is one of my test cases and system must automatically unmount after a moment in this situation),Also after re-insertion of MMC ,it will not mount again(checking dmesg show kernel detect MMC insertion).



    my Device use busybox mdev instead of udev and hotplug is enabled but mmcblk device handling is commented and I have no Idea how auto mounting is handled.
    this is my hotplug code :



    #!/bin/sh
    #
    # A generic /sbin/hotplug multiplexer program
    #
    # This script allows any program to be called when /sbin/hotplug is
    # called. It will run any programs located in the default hotplug
    # directory (currently /etc/hotplug.d/) that match up with the first
    # argument that this script is called with. The matching is done by
    # adding a directory name to the default directory and looking for any
    # programs in that directory that are executable, and end in .hotplug
    # (to allow backup programs to be live on safely.)
    #
    # For example, if /sbin/hotplug is called with the usb argument then
    # this script will look in the /etc/hotplug.d/usb/ directory for any
    # executable programs that end in .hotplug.
    #
    # After all programs in the argument directory are executed, the
    # "default" directory is searched for any executable programs in it,
    # that end in .hotplug. The default directory is currently
    # /etc/hotplug.d/default/
    #
    # - Greg Kroah-Hartman
    # May 1, 2003
    #
    # Released under the GPL Version 2.
    #

    DIR="/etc/hotplug.d"

    #for I in "$DIR/$1/"*.hotplug "$DIR/"default/*.hotplug ; do
    # if [ -f $I ]; then
    # test -x $I && $I $1 ;
    # fi
    #done


    #for debug
    # if [ $DEVNAME ]; then
    # echo "===== USB hotplug event =====" >> $DEVNAME.txt
    # else
    # echo "===== USB hotplug event =====" >> hotplug_event.txt
    # fi
    # echo "DEVPATH:$DEVPATH"
    # echo "SUBSYSTEM:$SUBSYSTEM"
    # echo "DEVTYPE:$DEVTYPE"
    # echo "DEVNAME:$DEVNAME"
    # echo "MAJOR:$MAJOR"
    # echo "MINOR:$MINOR"
    # echo "PRODUCT:$PRODUCT"
    # echo "INTERFACE:$INTERFACE"
    # echo "TYPE:$TYPE"
    # echo "VENDOR_ID:$VENDOR_ID"
    # echo "GUID:$GUID"
    # echo "SPEFICIER_ID:$SPEFICIER_ID"
    # echo "VERSION:$VERSION"
    # echo "0:$0"
    # echo "1:$1"
    # echo "2:$2"
    # echo "3:$3"



    if [ $ACTION = add ]; then
    echo "== add =="
    if [ $SUBSYSTEM = net ]; then
    echo "== net =="
    if [ $INTERFACE = eth0 ]; then
    echo "== eth0 =="
    . /mnt/etc/enet.cfg
    ifconfig eth0 hw ether $ENETCFG_MAC
    ifconfig eth0 up
    fi
    elif [ $DEVTYPE = partition ]; then
    echo "== partition =="
    if [ $MAJOR = 8 ]; then
    echo "== USB storage =="
    mount /dev/$DEVNAME
    elif [ $MAJOR = 179 ]; then
    echo "== SD Card =="
    #mount /dev/mmcblk0p1
    fi
    fi
    elif [ $ACTION = remove ]; then
    echo "== remove =="
    if [ $SUBSYSTEM = net ]; then
    echo "== net =="
    if [ $INTERFACE = eth0 ]; then
    echo "== eth0 =="
    # ifconfig eth0 down
    fi
    elif [ $DEVTYPE = partition ]; then
    echo "== partition =="
    if [ $MAJOR = 8 ]; then
    echo "== USB storage =="
    if [ $DEVNAME = sda1 ]; then
    umount /mnt/usb
    else
    umount /mnt/usb2
    fi
    elif [ $MAJOR = 179 ]; then
    echo "== SD Card =="
    #umount /mnt/sdcard
    fi
    fi
    fi

    exit 0


    Do you have any idea how it handles auto mounting / un-mounting of MMC_block?
    2- also when I un-commenting these section, problem is still remain.



    EDIT:
    Seems this is not related to the automount.sh script ,because I edit and checks many times and if this script be called it must correctly handled mount/unmount process of MMc,the only thing is remain is bug in the busybox version of mine(which is V1.10.11).







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm developing an application on embedded linux kernel 2.6 powered device and Auto mounting and un-mounting process is not works correctly.



      e.g. checking dmesg show kernel correctly determine insertion/removing of MMC device( I also can check this via /sys/blk/mmcblk0 ), after booting with MMC in slot ,MMC is initially mounted to /mnt/sdcard, but after removing MMC from slot,this directory is still valid with no data inside.



      (please consider removing MMC without umount is one of my test cases and system must automatically unmount after a moment in this situation),Also after re-insertion of MMC ,it will not mount again(checking dmesg show kernel detect MMC insertion).



      my Device use busybox mdev instead of udev and hotplug is enabled but mmcblk device handling is commented and I have no Idea how auto mounting is handled.
      this is my hotplug code :



      #!/bin/sh
      #
      # A generic /sbin/hotplug multiplexer program
      #
      # This script allows any program to be called when /sbin/hotplug is
      # called. It will run any programs located in the default hotplug
      # directory (currently /etc/hotplug.d/) that match up with the first
      # argument that this script is called with. The matching is done by
      # adding a directory name to the default directory and looking for any
      # programs in that directory that are executable, and end in .hotplug
      # (to allow backup programs to be live on safely.)
      #
      # For example, if /sbin/hotplug is called with the usb argument then
      # this script will look in the /etc/hotplug.d/usb/ directory for any
      # executable programs that end in .hotplug.
      #
      # After all programs in the argument directory are executed, the
      # "default" directory is searched for any executable programs in it,
      # that end in .hotplug. The default directory is currently
      # /etc/hotplug.d/default/
      #
      # - Greg Kroah-Hartman
      # May 1, 2003
      #
      # Released under the GPL Version 2.
      #

      DIR="/etc/hotplug.d"

      #for I in "$DIR/$1/"*.hotplug "$DIR/"default/*.hotplug ; do
      # if [ -f $I ]; then
      # test -x $I && $I $1 ;
      # fi
      #done


      #for debug
      # if [ $DEVNAME ]; then
      # echo "===== USB hotplug event =====" >> $DEVNAME.txt
      # else
      # echo "===== USB hotplug event =====" >> hotplug_event.txt
      # fi
      # echo "DEVPATH:$DEVPATH"
      # echo "SUBSYSTEM:$SUBSYSTEM"
      # echo "DEVTYPE:$DEVTYPE"
      # echo "DEVNAME:$DEVNAME"
      # echo "MAJOR:$MAJOR"
      # echo "MINOR:$MINOR"
      # echo "PRODUCT:$PRODUCT"
      # echo "INTERFACE:$INTERFACE"
      # echo "TYPE:$TYPE"
      # echo "VENDOR_ID:$VENDOR_ID"
      # echo "GUID:$GUID"
      # echo "SPEFICIER_ID:$SPEFICIER_ID"
      # echo "VERSION:$VERSION"
      # echo "0:$0"
      # echo "1:$1"
      # echo "2:$2"
      # echo "3:$3"



      if [ $ACTION = add ]; then
      echo "== add =="
      if [ $SUBSYSTEM = net ]; then
      echo "== net =="
      if [ $INTERFACE = eth0 ]; then
      echo "== eth0 =="
      . /mnt/etc/enet.cfg
      ifconfig eth0 hw ether $ENETCFG_MAC
      ifconfig eth0 up
      fi
      elif [ $DEVTYPE = partition ]; then
      echo "== partition =="
      if [ $MAJOR = 8 ]; then
      echo "== USB storage =="
      mount /dev/$DEVNAME
      elif [ $MAJOR = 179 ]; then
      echo "== SD Card =="
      #mount /dev/mmcblk0p1
      fi
      fi
      elif [ $ACTION = remove ]; then
      echo "== remove =="
      if [ $SUBSYSTEM = net ]; then
      echo "== net =="
      if [ $INTERFACE = eth0 ]; then
      echo "== eth0 =="
      # ifconfig eth0 down
      fi
      elif [ $DEVTYPE = partition ]; then
      echo "== partition =="
      if [ $MAJOR = 8 ]; then
      echo "== USB storage =="
      if [ $DEVNAME = sda1 ]; then
      umount /mnt/usb
      else
      umount /mnt/usb2
      fi
      elif [ $MAJOR = 179 ]; then
      echo "== SD Card =="
      #umount /mnt/sdcard
      fi
      fi
      fi

      exit 0


      Do you have any idea how it handles auto mounting / un-mounting of MMC_block?
      2- also when I un-commenting these section, problem is still remain.



      EDIT:
      Seems this is not related to the automount.sh script ,because I edit and checks many times and if this script be called it must correctly handled mount/unmount process of MMc,the only thing is remain is bug in the busybox version of mine(which is V1.10.11).







      share|improve this question














      I'm developing an application on embedded linux kernel 2.6 powered device and Auto mounting and un-mounting process is not works correctly.



      e.g. checking dmesg show kernel correctly determine insertion/removing of MMC device( I also can check this via /sys/blk/mmcblk0 ), after booting with MMC in slot ,MMC is initially mounted to /mnt/sdcard, but after removing MMC from slot,this directory is still valid with no data inside.



      (please consider removing MMC without umount is one of my test cases and system must automatically unmount after a moment in this situation),Also after re-insertion of MMC ,it will not mount again(checking dmesg show kernel detect MMC insertion).



      my Device use busybox mdev instead of udev and hotplug is enabled but mmcblk device handling is commented and I have no Idea how auto mounting is handled.
      this is my hotplug code :



      #!/bin/sh
      #
      # A generic /sbin/hotplug multiplexer program
      #
      # This script allows any program to be called when /sbin/hotplug is
      # called. It will run any programs located in the default hotplug
      # directory (currently /etc/hotplug.d/) that match up with the first
      # argument that this script is called with. The matching is done by
      # adding a directory name to the default directory and looking for any
      # programs in that directory that are executable, and end in .hotplug
      # (to allow backup programs to be live on safely.)
      #
      # For example, if /sbin/hotplug is called with the usb argument then
      # this script will look in the /etc/hotplug.d/usb/ directory for any
      # executable programs that end in .hotplug.
      #
      # After all programs in the argument directory are executed, the
      # "default" directory is searched for any executable programs in it,
      # that end in .hotplug. The default directory is currently
      # /etc/hotplug.d/default/
      #
      # - Greg Kroah-Hartman
      # May 1, 2003
      #
      # Released under the GPL Version 2.
      #

      DIR="/etc/hotplug.d"

      #for I in "$DIR/$1/"*.hotplug "$DIR/"default/*.hotplug ; do
      # if [ -f $I ]; then
      # test -x $I && $I $1 ;
      # fi
      #done


      #for debug
      # if [ $DEVNAME ]; then
      # echo "===== USB hotplug event =====" >> $DEVNAME.txt
      # else
      # echo "===== USB hotplug event =====" >> hotplug_event.txt
      # fi
      # echo "DEVPATH:$DEVPATH"
      # echo "SUBSYSTEM:$SUBSYSTEM"
      # echo "DEVTYPE:$DEVTYPE"
      # echo "DEVNAME:$DEVNAME"
      # echo "MAJOR:$MAJOR"
      # echo "MINOR:$MINOR"
      # echo "PRODUCT:$PRODUCT"
      # echo "INTERFACE:$INTERFACE"
      # echo "TYPE:$TYPE"
      # echo "VENDOR_ID:$VENDOR_ID"
      # echo "GUID:$GUID"
      # echo "SPEFICIER_ID:$SPEFICIER_ID"
      # echo "VERSION:$VERSION"
      # echo "0:$0"
      # echo "1:$1"
      # echo "2:$2"
      # echo "3:$3"



      if [ $ACTION = add ]; then
      echo "== add =="
      if [ $SUBSYSTEM = net ]; then
      echo "== net =="
      if [ $INTERFACE = eth0 ]; then
      echo "== eth0 =="
      . /mnt/etc/enet.cfg
      ifconfig eth0 hw ether $ENETCFG_MAC
      ifconfig eth0 up
      fi
      elif [ $DEVTYPE = partition ]; then
      echo "== partition =="
      if [ $MAJOR = 8 ]; then
      echo "== USB storage =="
      mount /dev/$DEVNAME
      elif [ $MAJOR = 179 ]; then
      echo "== SD Card =="
      #mount /dev/mmcblk0p1
      fi
      fi
      elif [ $ACTION = remove ]; then
      echo "== remove =="
      if [ $SUBSYSTEM = net ]; then
      echo "== net =="
      if [ $INTERFACE = eth0 ]; then
      echo "== eth0 =="
      # ifconfig eth0 down
      fi
      elif [ $DEVTYPE = partition ]; then
      echo "== partition =="
      if [ $MAJOR = 8 ]; then
      echo "== USB storage =="
      if [ $DEVNAME = sda1 ]; then
      umount /mnt/usb
      else
      umount /mnt/usb2
      fi
      elif [ $MAJOR = 179 ]; then
      echo "== SD Card =="
      #umount /mnt/sdcard
      fi
      fi
      fi

      exit 0


      Do you have any idea how it handles auto mounting / un-mounting of MMC_block?
      2- also when I un-commenting these section, problem is still remain.



      EDIT:
      Seems this is not related to the automount.sh script ,because I edit and checks many times and if this script be called it must correctly handled mount/unmount process of MMc,the only thing is remain is bug in the busybox version of mine(which is V1.10.11).









      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 27 at 12:29

























      asked Feb 26 at 13:34









      Mahmoud Hosseinipour

      1013




      1013

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426682%2fautomount-unmounting-of-mmc-device-in-embedded-linux-kernel-2-6%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426682%2fautomount-unmounting-of-mmc-device-in-embedded-linux-kernel-2-6%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay