Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
April 9, 2007, 7:31 pm

Hi,
I have a gumstix running linux version below.
# uname -r
2.6.11gum
It has a MMC slot which I use for collecting log files. My
requirements is that if the MMC card is mounted, my application would
archive log files to the MMC card. If the card is not mounted (user
not inserted), the my application would not archive log files, so as
to not write to the internal flash.
My question is: how can I programmatically detect whether or not a MMC
card is mounted?
Thanks for any help.
P
I have a gumstix running linux version below.
# uname -r
2.6.11gum
It has a MMC slot which I use for collecting log files. My
requirements is that if the MMC card is mounted, my application would
archive log files to the MMC card. If the card is not mounted (user
not inserted), the my application would not archive log files, so as
to not write to the internal flash.
My question is: how can I programmatically detect whether or not a MMC
card is mounted?
Thanks for any help.
P

Re: How to programmatically detect a mounted device
| I have a gumstix running linux version below.
|
| # uname -r
| 2.6.11gum
|
| It has a MMC slot which I use for collecting log files. My
| requirements is that if the MMC card is mounted, my application would
| archive log files to the MMC card. If the card is not mounted (user
| not inserted), the my application would not archive log files, so as
| to not write to the internal flash.
|
| My question is: how can I programmatically detect whether or not a MMC
| card is mounted?
By scanning the contents of /proc/mounts (if you have /proc enabled and
mounted).
--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
We've slightly trimmed the long signature. Click to see the full one.

Re: How to programmatically detect a mounted device

Here is a little /bin/sh routine that you probably might find
useful, or can modify to suit...
is_reader() {
test=$( cat /proc/scsi/usb-storage*/* 2> /dev/null | grep
"Card Reader"; cat /proc/bus/usb/devices 2> /dev/null |
grep Cnt=0[1-9] ) if [ "$test" = "" ]; then
return 0
else
return 1
fi
}
TonyB
There are 10 types of people in this world, those that read
binary and those who don't!
--
__ __ _ I N C. http://www.sysdev.org
/ __|\// __|| \ __ __ / snipped-for-privacy@sysdev.org
__ __ _ I N C. http://www.sysdev.org
/ __|\// __|| \ __ __ / snipped-for-privacy@sysdev.org
We've slightly trimmed the long signature. Click to see the full one.
Site Timeline
- » IDE driver in polling mode
- — Next thread in » Embedded Linux
-
- » DMA transfer size limited on MPC8272
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Communist Chinese Military Companies
- — The site's Newest Thread. Posted in » Field-Programmable Gate Arrays
-