[maemo-developers] Finding the mmc cards

From: Murray Cumming murrayc at murrayc.com
Date: Wed Aug 29 15:09:30 EEST 2007
On Wed, 2007-08-29 at 12:39 +0300, Eero Tamminen wrote:
> Hi,
> Please file a documentation bug into Maemo Bugzilla.  We need this
> documented.  Handling of removable medias, especially with file systems
> as easily corrupted as FAT, needs special care from applications
> (stop using files when pre-unmount message is delivered on them so
> that unmounts succeed, do better error handling etc.)

Ah, so that's the GnomeVFSVolumeMonitor::volume_pre_unmount signal?
Thanks for that tip.

I'm using the GnomeVFSVolumeMonitor to detect the presence of the card
so far. For instance, see the rather unpleasant code in
volume_path_is_mounted() here:

I also respond to the GnomeVFSVolumeMonitor signals to detect actual
mounting and unmounting in on_vfs_volume_mounted() and
on_vfs_volume_unmounted() in the same file.

It's probably not a good example, but I don't know of a better one.

> ext maemo-developers-bounces at maemo.org wrote:
> > I agree that assuming mmc1 and mmc2 is potentially dangerous. In an answer to my 
> > original question on this subject, someone suggested that mmc0 and mmc1 were the 
> > correct names, whereas in my Scratchbox environment they are mmc1 and mmc2. 
> > Consequently, when I was implementing a scan for memory cards, I opted to look 
> > in the /media folder for files whose names begin "mmc", and to assume that any 
> > such file I find might be a memory card. This appears to work (in the 
> > test/development environment), but personally I hate making those kinds of 
> > assumptions. I would far rather have a definitive statement from someone to the 
> > effect that "if you do X, this will guarantee to find the memory cards and 
> > nothing else". For me, this is particularly important, as my application will be 
> > sold commercially and needs to work under all circumstances.
> > 
> > 
> > David Hazel
> > 
> >  
> > 
> >   	After our thread some weeks ago regarding reading the serial number from a 
> > MMC card, I've since implemented detection of the MMC card's presence by the 
> > existence of those same files.  I know my solution works on my device perfectly.
> > 
> > I figure it's probably a bad decision, because the architecture could change 
> > somewhat with the next hardware or software release.
> > 
> > Can someone tell me, is there an approved / documented way of identifying the 
> > location of any MMC cards currently installed?  I've noticed you can't simply 
> > look for /media/mmcX because that directory will exist even if there is no card 
> > inserted.
> > 
> > Also, what determines MMC1 vs MMC2 as the card's path for internal/external?  Is 
> > it possible these paths would change at some date?  I know some Linux distro's 
> > with SATA drives had a problem with the drives changing their /dev/sdX path 
> > every reboot.  I know that MY Nokia isn't doing anything similar, but I figure 
> > it's possible that my /media/mmc1 might be internal, but for someone else it 
> > could be the external slot - or maybe in the next hardware revision or something.
> > 
> > I did find the alias names located in the /sys/ path that specify "internal" is 
> > for one and "external" or removable or something for the other.  Also, are the 
> > names and paths the same for the 770's?  Since I have an n800 I don't know.  I'm 
> > hesitant to read too much data from /sys/ because it all looks _so_ 
> > Maemo-specific I wonder if I will tie my code too closely to one hardware revision.
> > 
> > Just looking for the most _compatible_ way to identify if/when and where a media 
> > card is present.
> > 
> > And as usual, from Python.
> > 
> > Thanks,
> > Tony
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
murrayc at murrayc.com

More information about the maemo-developers mailing list