<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2>Tony,</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2>Thanks
for the reply and for re-posting my question to the list. I'm replying to "all"
so that this goes to the list, too.</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2>Regarding the "cat XXXXX" info that a couple of people have mentioned,
the problem I was having here is that it seemed to presume that I know a-priori
which device I need to incorporate into the path to get what I want. I won't
know this without first being able to determine which device a particular
(persistent) file is sitting on. Hence the first part of my question. I think
your suggestion about df may give me what I want. I suppose I was expecting
there to be something analogous to Mac OS's IOKit (which has functions that do
exactly the filename-to-containing-device translation that I've
described).</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2>Sorry
about the capitals. I'm aware of the connotations with shouting, but I couldn't
think of any other way of emphasising how I need to be able to get the
information I'm after (and I only capitalised the relevant words). Some of the
earlier replies read as if people thought I wanted to see the serial number
from a command line, rather than programmatically.</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2><FONT
face="Times New Roman" color=#000000 size=3>> That's Linux 101, but certainly
is alien to anyone who has done Palm, PocketPC or Windows development.
</FONT><BR></FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2>And to
ex-VMS programmers ;-)</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2>Actually, what's most alien is the amount of hunting around that seems to
be needed to find out how everything needs to be done on the N800 specifically
(as opposed to Linux in general). The real "how to do it" developer
information seems almost nonexistent when it comes to the specifics of
Maemo/Nokia N800. No other platform that I've ever programmed for (and there are
many, going back over 24 years) has been so couched in mystery. (Where, for
example, is the documentation - as opposed to just header comments -
for the Hildon APIs? I haven't found any yet. Even the GTK+ and GLib stuff is
little more than header comments with a few extra bits of description tacked on.
There's very little proper top-down documentation that I've been able to
find.)</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2>Thanks
for the info you've given me so far, anyway.</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff size=2>David
Hazel</FONT></SPAN></DIV>
<DIV><SPAN class=875141420-12082007><FONT face=Arial color=#0000ff
size=2> </DIV></FONT></SPAN>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Tony Maro
[mailto:tonymaro@gmail.com]<BR><B>Sent:</B> 12 August 2007 20:01<BR><B>To:</B>
David Hazel; maemo-developers@maemo.org<BR><B>Subject:</B> Re: Obtaining flash
memory serial numbers on Nokia N800<BR><BR></FONT></DIV>On 8/12/07, <B
class=gmail_sendername>David Hazel</B> <<A
href="mailto:david.hazel@enchaine.com">david.hazel@enchaine.com</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>OK, so far I haven't had a
reply that really answers my original questions, so let me rephrase
them:</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff
size=2></FONT><BR>I'd tend to disagree, but let's go on ;-) <BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>1. Given a full directory
path, how can I determine FROM WITHIN AN APPLICATION which storage device
(memory card) this corresponds with? In other words, starting with something
of the form "/dir1/dir2/dir3/file", how can I identify the storage device
that this resides on?</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><BR>Well, that one would
best be determined by reading the output of df or mount I would think.
Because the Linux file system is so flexible, there may not be an actual
"device" associated with a given path. Some of the paths in the file
system are actually output from running applications. Others might be
mounted across the network using any number of network file systems. For
instance, the /proc directory doesn't really exist on a Linux hard drive so
much as is output by a program running on the machine. So when you say
you want to "find which storage device a path corresponds with" there may not
be an answer because the question is wrong. Read on for more info...
<BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>2. Having found the above,
how can I then find that storage device's serial number? (Again, FROM WITHIN
AN APPLICATION)</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><BR>Um, actually that was
the answer everyone provided. No need to yell - that's generally what
gets most Linux advocates bristling and starts flame wars. <BR><BR>Just
read the text file at the specified location. Where we said "cat
XXXXXX", cat was just meaning dump the contents of that file to the console,
so you could just open that file like any text file and read the serial number
out of it. That's Linux 101, but certainly is alien to anyone who has
done Palm, PocketPC or Windows development. <BR><BR>So in Python for instance,
you might do:<BR><BR>mypath =
'/sys/devices/platform/mmci-omap.1/mmc1*/cid'<BR>srcfile =
open(mypath,'r')<BR>myserial = srcfile.readline()<BR>srcfile.close()<BR>#
tada! no need for any include's either. Nice and simple. <BR><BR>You can
use the same method to find the type of processor in the device, how much
memory card space is in use, and untold many other tidbits of cool
information. Keep in mind, Linux aka Unix was originally designed around
everything communicating to each other through what is basically console
I/O. It's a really neat system when you think about it. This means
there's no special API that needs written or header files that must be
available for each language in order to access this information. Other
aspects of the Linux OS are actually changed just simply by writing to these
fake "text files" in your directory structure. These fake "text files"
are just the communications medium between applications. And that's a
Fact. ;-) <BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Fact: I can
programmatically determine an SD card's serial number on a Windows Mobile
device. Therefore I expect this to be possible on the Nokia 800 as
well.</FONT></SPAN></DIV></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial
color=#0000ff size=2></FONT><BR>Sure, just read it from the file system as
described above. Linux provides the /sys/devices (or on a desktop
normally /proc/whatever) "file system" to make it easier to do this, so
there's not even an API you need. Just read the settings you're looking
for from the OS supplied text file. <BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Fact: I can
programmatically map a directory path onto its corresponding device under
Mac OS X (which is BSD Unix with go-faster stripes). Therefore I expect to
be able to do something similar on an N800 running a variant of Linux (which
is Unix-like, right?).</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN><FONT
face=Arial color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff
size=2></FONT><BR></DIV></DIV></BLOCKQUOTE></DIV><BR>If you're talking about
"mounting" sure, but you'll need to do it as root for security reasons.
If that's not what you mean, you'll need to clarify. <BR><BR>Someone who's a C
programmer might be able to expound on my comments and give other options as
well.<BR><BR>Also, on a side note, you sent your response directly to me and
not the list, so I'm submitting it back to the list as well assuming it was an
oversight on your part. <BR></BLOCKQUOTE></BODY></HTML>