2010-03-01 12:00:27 SD/MMC Hotplug using mdev questions
Y F Michael Kou (UNITED STATES)
Message: 86674
A while ago, I enter a thread mentioning that when I mount the SD in the rc file. The SD is discovered at the end of the rc script execution so it depend on how fas the SD is discovered, the SD may not mounted everytime. Then someone suggest that I use Hotplug (I think it was Mike) and it works great until our project has changed so that now we require the SD to be removed and insert several time when the hardware is running.
The problem I see is that the kernel does not seem to see the SD being removed everytime (we use PF7). For example, I remove the SD and there will be nothing. Then I insert the SD, the console will then show me the SD is being removed. I then remove and insert the SD again and now the kernel will see the SD and load the driver. However, sometime it will work just fine. I change the delay and it does not seem to improve the situation. Any suggestion here is welcome.
The next problem is mdev related. I have the line 'mmcblk.p. 0:0 0777 @mount /dev/$MDEV /mnt/SD/' in the /etc/mdev.conf file. it does mount the SD correctly. However, if I remove the SD, I need to umount the drive but I cannot come up with a good way to do it. I understand that you can use '$umount /mnt/SD' but I cannot put another statement in mdev.conf with the same device (mmcblk.p.). Just wonder if there is any good way to do it so that when the SD is removed, the device will be umount and when the SD is insert, it will mount the device.
Thanks.
Michael Kou
QuoteReplyEditDelete
2010-03-01 12:02:07 Re: SD/MMC Hotplug using mdev questions
Y F Michael Kou (UNITED STATES)
Message: 86675
BTW, I am using 2009R1 distribution and 2009R1.1 toolchain.
Michael Kou
QuoteReplyEditDelete
2010-03-01 21:10:14 Re: SD/MMC Hotplug using mdev questions
Sonic Zhang (CHINA)
Message: 86688
Which blackfin evaluation board do you use?
QuoteReplyEditDelete
2010-03-02 22:21:39 Re: SD/MMC Hotplug using mdev questions
Y F Michael Kou (UNITED STATES)
Message: 86734
BlueTechnix CM-BF537E
QuoteReplyEditDelete
2010-03-03 01:04:44 Re: SD/MMC Hotplug using mdev questions
Sonic Zhang (CHINA)
Message: 86737
There is no way to remove a disk partition automatically after you unplug the sd card. Do it before you unplug it.
QuoteReplyEditDelete
2010-03-03 02:57:48 Re: SD/MMC Hotplug using mdev questions
Wolfgang Muees (GERMANY)
Message: 86740
Michael Kou,
maybe you have missed some step.
echo /bin/mdev >/proc/sys/kernel/hotplug
in your RC file.
mmcblk[0-9] 0:0 0664 */bin/hotplug-sd
mmcblk[0-9]p[1-9] 0:0 0664 */bin/hotplug-sd
in /etc/mdev.conf
And last, in your /bin/hotplug-sd:
#!/bin/sh
SD_MPOINT=/data/mnt/sdcard
case "$ACTION" in
add|"")
mkdir -p $SD_MPOINT
mount -t auto $MDEV $SD_MPOINT
;;
remove)
umount $SD_MPOINT
rmdir $SD_MPOINT
;;
esac
And - for coldplug - I think that /bin/mdev is called with the "-s" option from the RC scripts.
The delay between hotplug insertion (detection at PF7) and the mmc detection scan should be set to 500ms. 100 is too low. It is in the platform resource file.
Maybe you put some prink statements in the detection code and see what is going on.
regards
Wolfgang
TranslateQuoteReplyEditDelete
2010-03-03 15:25:34 Re: SD/MMC Hotplug using mdev questions
Y F Michael Kou (UNITED STATES)
Message: 86763
Wolfgang:
Thanks for your reply. I did have the mdev.conf written similar to what you have here and I just discover the $ACTION variable. I am now struggling with the script. However, I was using the if-else-fi so may be I will give the case esac a try.
Did you put #!/bin/sh in your /bin/hotplug-sd script file? When I run the script this way, it said 'bad interrupter' then I got some syntax error. However, on one of our remote linux machine, the script was just running fine. Wonder if BusyBox is the problem. However, I don't think I can remove BusyBox because mdev is on it.
Thanks again.
Michael Kou
QuoteReplyEditDelete
2010-03-04 03:01:58 Re: SD/MMC Hotplug using mdev questions
Wolfgang Muees (GERMANY)
Message: 86778
Michael,
ESAC is better because the mount action is done in TWO cases: if ACTION is add and if ACTION is empty. (I assume the second case is for coldplug).
Yes, I have '!/bin/sh" in the first line of the script. If this does not work for you...
Hmmm- I think, in my system /bin/sh is a link to /bin/msh. There is a config option to select MSH as the shell in the uclinux config. Try this.
regards
Wolfgang