Re: Finding the mmc cards

2007-08-30 Thread Tony Maro
On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  I'm interested to hear that anything outside of the SD card has a choice
> in the matter. There was a time when hardware write-protection of this kind
> was exactly that: harware-enforced write-protection. I would have expected
> that, if I put the switch on an SD card into the "write-protected" position,
> the card itself would disable or ignore write operations (by, for example,
> disabling whatever line/signal is used to perform the write operation).
>

Nope, the specs leave it up to the device to implement, kind of like the old
notch on floppies ;-)

>From the Nokia n800 user manual:

This device does not support the write
protection feature of SD cards.

I don't believe the write protection switch was part of the original MMC
card design specs was it?  I'm not "in the loop" but it's only recently I
started seeing cards with the switch.  I'm assuming it sets some bit
somewhere to tell the hardware "Hey, leave me alone" which Maemo promptly
ignores.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-30 Thread Markku Vire

Hi,

MMC_MOUNTPOINT variable was present on 770 already and the device had
one (external) mmc slot only. N800 added a second memory card slot
(the internal one) and respective variable...

-Markku-

David Hazel wrote:
>> You can also use the environment variables MMC_MOUNTPOINT and
>> INTERNAL_MMC_MOUNTPOINT, but then you have to make sure that they are
>> always set correctly in your environment.  (I don't think using
>> environment variables for this kind of system information is a good
>> idea.)
> 
> Those environment variables seem oddly inconsistent to an ex-VMS man like
> me. Why not EXTERNAL_MMC_MOUNTPOINT and INTERNAL_MMC_MOUNTPOINT? Otherwise
> it's necessary to remember which one the unqualified MMC_MOUNTPOINT refers
> to (e.g. by remembering that the other one starts with INTERNAL rather than
> EXTERNAL - which itself is counter-intuitive, as I would expect the internal
> one to be the more "important" and therefore the unqualified one).


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread david . hazel


I'm interested to hear that anything outside of the SD card has a choice in the matter. There was a time when hardware write-protection of this kind was exactly that: harware-enforced write-protection. I would have expected that, if I put the switch on an SD card into the "write-protected" position, the card itself would disable or ignore write operations (by, for example, disabling whatever line/signal is used to perform the write operation).
David Hazel



 

On 8/29/07, David Hazel <[EMAIL PROTECTED]> wrote:
- whether write protected (yes, you can write-protect an SD card)
Yes, but the Nokia's do not support or honor that switch.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread Tony Maro
On 8/29/07, David Hazel <[EMAIL PROTECTED]> wrote:
>
>
> - whether write protected (yes, you can write-protect an SD card)


Yes, but the Nokia's do not support or honor that switch.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Finding the mmc cards

2007-08-29 Thread David Hazel
> You can also use the environment variables MMC_MOUNTPOINT and
> INTERNAL_MMC_MOUNTPOINT, but then you have to make sure that they are
> always set correctly in your environment.  (I don't think using
> environment variables for this kind of system information is a good
> idea.)

Those environment variables seem oddly inconsistent to an ex-VMS man like
me. Why not EXTERNAL_MMC_MOUNTPOINT and INTERNAL_MMC_MOUNTPOINT? Otherwise
it's necessary to remember which one the unqualified MMC_MOUNTPOINT refers
to (e.g. by remembering that the other one starts with INTERNAL rather than
EXTERNAL - which itself is counter-intuitive, as I would expect the internal
one to be the more "important" and therefore the unqualified one).

I also picked up on Tony's reply regarding the way in which /dev/mmcblk0 and
/dev/mmcblk1 seem to be reversed in semantics with respect to the cards they
relate to. With these two examples of inconsistency in card mappings, it
seems all the more important to me that some kind of API is provided that
can enumerate the cards with certainty (and with logical/naming consistency,
please!) and can determine a range of useful information about the cards.

Here are some ideas for the kind of information such an API might want to be
able to retrieve:
- serial number
- capacity
- whether FAT16 or FAT32 formatted
- mountpoint
- device file name
- whether write protected (yes, you can write-protect an SD card)


David Hazel

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Finding the mmc cards

2007-08-29 Thread David Hazel
I've added bug #1930. I hope I've done it right, because even that procedure
isn't particularly clear.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Eero Tamminen
Sent: 29 August 2007 10:40
To: ext [EMAIL PROTECTED]
Cc: maemo-developers@maemo.org
Subject: Re: Finding the mmc cards


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.)


- Eero

ext [EMAIL PROTECTED] 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@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread Tony Maro
On 8/29/07, Marius Vollmer <[EMAIL PROTECTED]> wrote:
>
>
> The internal card is always mounted on /media/mmc2, and the external
> card is always mounted on /media/mmc1.


And when the Nokia n900 (just guessing) gets released, and it has a memory
stick socket or some other type of memory card, I assume we won't be able to
rely on this anymore.  But, sounds like for at least the short term (or long
term in Internet years) relying on mount and /media/mmc* is the way to go.
Assuming you don't need notifications of card insert.

You can also use the environment variables MMC_MOUNTPOINT and
> INTERNAL_MMC_MOUNTPOINT, but then you have to make sure that they are
> always set correctly in your environment.  (I don't think using
> environment variables for this kind of system information is a good
> idea.)


Agreed.  Especially with the numbers of morons like me that are likely to
screw those up ;-)

The device files are not constant like this: the internal card might
> be /dev/mmcblk0 or /dev/mmcblk1, as far as I understand.  Someone with
> better low-level knowledge please correct me.


I had thought this might be the case, especially since my /dev/mmcblk0 goes
to /media/mmc2 and /dev/mmcblk1 goes to /media/mmc1 on my device.  Seemed
kind of reversed to me.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread Murray Cumming
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:
https://garage.maemo.org/plugins/scmsvn/viewcvs.php/modest/trunk/src/modest-tny-account-store.c?root=modest&view=markup

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 [EMAIL PROTECTED] 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@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
-- 
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread Marius Vollmer
"ext Tony Maro" <[EMAIL PROTECTED]> writes:

> Also, what determines MMC1 vs MMC2 as the card's path for
> internal/external?

The internal card is always mounted on /media/mmc2, and the external
card is always mounted on /media/mmc1.

You can also use the environment variables MMC_MOUNTPOINT and
INTERNAL_MMC_MOUNTPOINT, but then you have to make sure that they are
always set correctly in your environment.  (I don't think using
environment variables for this kind of system information is a good
idea.)

The device files are not constant like this: the internal card might
be /dev/mmcblk0 or /dev/mmcblk1, as far as I understand.  Someone with
better low-level knowledge please correct me.

> Is it possible these paths would change at some date?

It is possible, but I guess we stick with these locations for a long
time.

We could and should provide mechanisms so that applications don't need
to hardcode the locations, but I don't see a reason why we should
break applications that do hardcode them.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-29 Thread Eero Tamminen
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.)


- Eero

ext [EMAIL PROTECTED] 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@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Finding the mmc cards

2007-08-29 Thread david . hazel


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@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Finding the mmc cards

2007-08-28 Thread Kees Jongenburger
On 8/29/07, Tony Maro <[EMAIL PROTECTED]> wrote:
> 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.
>
Hello I use
cat /proc/partitions on my desktop system to see what the partition
are available
on my desktop system bus perhaps listening to dbus or kernel events is
the right way :)
looking at mtab or the output of mount will also help

greetings


> 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@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
>
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Finding the mmc cards

2007-08-28 Thread Tony Maro
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@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers