Discussion:
[BitPim-devel] a900 filesystem
Aaron Z
2006-02-05 06:45:42 UTC
Permalink
I've been reading Aaron and Stephen's conversation on the A900; I
think the problem is that reading a 'pascal' string from the buffer is
assuming a one-byte length, and the a900's listdirectoryresponse
00000000 59 0a 00 00 00 00 00 01 00 00 00 47 47 c6 00 07 Y..........GG...
00000010 00 00 00 30 de 63 03 01 00 05 2f 62 72 65 77 ...0.c..../brew
By running bitpim under eclipse/pydev, this parses as follows:

header: 59 0a 00
entrynumber: 00 00 00 00
unknown1: 01 00 00 00 47 47 c6 00 07 00 00 00 30 de 63 03 01
subdir: [should be] 00 05 2f 62 72 65 77

... but subdir.readfrombuffer() sees a length of 0, not of 5, and dies
right there. So we get into this loop where we try to parse a bunch of
subdirs named '' (empty string), which is just the root dir all over
again.

Other-Aaron, you can temporarily fix this in your copy of bitpim by
reading two length bytes instead of one -- at prototype.py, line 341,
dup the self._sizeinbytes line. This just throws away the first byte,
of course, but for the moment, it'll do. Once I did this, I read the
filesystem beautifully, save for a double exception when I try to read
the .$ directory. I ignored this and bitpim continued to run, so I
didn't debug it further.

I, too, would love to sync my calendar with bitpim. Now that we've
gotten this far, Stephen, what's next?
Roger Binns
2006-02-05 07:06:44 UTC
Permalink
Use the analyser!
Post by Aaron Z
... but subdir.readfrombuffer() sees a length of 0, not of 5,
In the listfileresponse definition, I added a type/field named
SPURIOUSZERO to deal with something like this a while back.
It looks like variation of that will solve this particular
case for listdirectoryresponse.

Roger
Stephen Wood
2006-02-05 15:07:58 UTC
Permalink
Post by Aaron Z
...
I, too, would love to sync my calendar with bitpim. Now that we've
gotten this far, Stephen, what's next?
Nice work on figuring out how to read the filesystem. If you can figure out
a patch along the lines of Roger's suggestion, I'll test it out with other
phones and check it into the CVS if it doesn't break other phones.

In the mean time you can try to see if the calendar is accessible through AT
commands. AT#PISHR=n is a command that works on many Samsung phones. Aaron
S was planning to loop through possible AT#P.... commands to see what works,
but I havn't heard results of that yet. But he did indicate that many of
the AT commands mentioned in dev-doc/samsungnotes.txt don't work.

The other thing to do is try to identify the file system files with calendar
information. Most phones have calendar information available in file system
files, but the problem is usually that the files or directories they are in
are locked for writing.

Perhaps we should be using Bluetooth protocols, which I know nothing about.

To use the analyzer that Roger speaks of, select some lines in the protocol
log and type Ctrl-Alt-P. To analyze protocol logs saved to a file do:

python analyser.py file

With the later, you can edit .p files (run python protogen.py to compile the
.p files), and then use the analyzer to see how your updated definitions
work.

Stephen

--
Stephen Wood

One of the "Steves" of Project Steve at http://www.ncseweb.org/.
Aaron Solochek
2006-02-05 15:42:24 UTC
Permalink
Post by Aaron Z
...
I, too, would love to sync my calendar with bitpim. Now that we've
gotten this far, Stephen, what's next?
Nice work on figuring out how to read the filesystem. If you can figure
out a patch along the lines of Roger's suggestion, I'll test it out with
other phones and check it into the CVS if it doesn't break other phones.
In the mean time you can try to see if the calendar is accessible
through AT commands. AT#PISHR=n is a command that works on many Samsung
phones. Aaron S was planning to loop through possible AT#P.... commands
to see what works, but I havn't heard results of that yet. But he did
indicate that many of the AT commands mentioned in
dev-doc/samsungnotes.txt don't work.
The other thing to do is try to identify the file system files with
calendar information. Most phones have calendar information available
in file system files, but the problem is usually that the files or
directories they are in are locked for writing.
Perhaps we should be using Bluetooth protocols, which I know nothing about.
To use the analyzer that Roger speaks of, select some lines in the
protocol log and type Ctrl-Alt-P. To analyze protocol logs saved to a
python analyser.py file
With the later, you can edit .p files (run python protogen.py to compile
the .p files), and then use the analyzer to see how your updated
definitions work.
Yeah, I haven't gotten around to writing the code to loop through those commands
yet. It's on my to-do list.

-Aaron
Aaron Z
2006-02-05 17:19:14 UTC
Permalink
Post by Stephen Wood
Nice work on figuring out how to read the filesystem. If you can figure out
a patch along the lines of Roger's suggestion, I'll test it out with other
phones and check it into the CVS if it doesn't break other phones.
No luck so far -- I'd thought it would be, redefine PACKET
listdirectoryresponse in p_samsungspha900.p (and rerun protogen), but
I still end up in p_brew.listdirectoryresponse instead of
psamsungspha900.listdirectoryresponse.
Post by Stephen Wood
In the mean time you can try to see if the calendar is accessible through AT
commands. AT#PISHR=n is a command that works on many Samsung phones.
No dice here, either. Response is "ERROR". I'm hesitant to cycle
through AT#P commands because I don't want to break the phone -- got a
little worried when trying to sync put it in "USB connected" mode and,
even after rebooting, it didn't leave until I tried to browse the
filesystem again.

If I use a terminal program, how do I get out of brew mode and back
into where I can type AT commands?
Post by Stephen Wood
The other thing to do is try to identify the file system files with calendar
information. Most phones have calendar information available in file system
files, but the problem is usually that the files or directories they are in
are locked for writing.
The calendar is in nvm/nvm/schedule. There's nothing that looks like
an amsRegistry file. Still want a copy of a filesystem, or can you
point me to where I should start writing my own parser?
Post by Stephen Wood
Perhaps we should be using Bluetooth protocols, which I know nothing about.
According to the Bluetooth info screen on the phone, the A900 doesn't
support the SYNCH profile. I think that's a showstopper.
Post by Stephen Wood
python analyser.py file
If I'm in the analyser while running bitpim, this works fine; if I try
to run it standalone, clicking on a packet gets me the tooltip "module
object has no attribute listdirectoryrequest - Finding class", and it
doesn't parse the packet. Any suggestions?
Stephen Wood
2006-02-05 17:54:38 UTC
Permalink
Post by Aaron Z
If I use a terminal program, how do I get out of brew mode and back
into where I can type AT commands?
One of the items in the right click menu in the file system view is "Go to
modem mode." This should put the phone back where AT commands work. Power
cycling may do it to.
--
Stephen Wood

One of the "Steves" of Project Steve at http://www.ncseweb.org/.
Stephen Wood
2006-02-05 18:09:50 UTC
Permalink
Post by Aaron Z
No luck so far -- I'd thought it would be, redefine PACKET
listdirectoryresponse in p_samsungspha900.p (and rerun protogen), but
I still end up in p_brew.listdirectoryresponse instead of
psamsungspha900.listdirectoryresponse.
I think the changes have to be in p_brew.p. The trick is doing something
that doesn't break it for other phones.
Post by Aaron Z
No dice here, either. Response is "ERROR". I'm hesitant to cycle
through AT#P commands because I don't want to break the phone -- got a
little worried when trying to sync put it in "USB connected" mode and,
even after rebooting, it didn't leave until I tried to browse the
filesystem again.
I havn't fried any phones with AT commands, but I won't tell you it is
safe. If you do try cycling through commands, avoid commands that end in W.


Did you "AT#PMODE=1" before trying other AT#PXXXX commands?
Post by Aaron Z
The calendar is in nvm/nvm/schedule. There's nothing that looks like
an amsRegistry file. Still want a copy of a filesystem, or can you
point me to where I should start writing my own parser?
Files can be parsed with packet definitions. For an example, see "PACKET
amsregistry" in p_samsungspha620.p. There is an option in the file system
viewer to write a file out in the form that the packet analyzer likes. You
may need to tweak with a header line in the file to get it to match up with
the right packet definition.

--
Stephen Wood

One of the "Steves" of Project Steve at http://www.ncseweb.org/.

Loading...