Discussion:
[Bitpim-devel] Re: [Bitpim-user] Samsung A620 - timeout issue?
Roger Binns
2004-03-09 08:27:37 UTC
Permalink
0:21:34.217 Samsung A620: brew response Data - 6 bytes
<#! p_brew.listdirectoriesresponse !#>
00000000 59 02 00 00 00 ff Y.....
You can view this in the analyser.

59 commandmode
02 command
00 errorcode

The next two bytes are the number of entries, in this case zero.
The next two bytes after that are the data length followed by
the subdirectories.

The A620 looks like it can have nonsense if there are zero entries.

I have changed the description so that if there are zero entries,
the rest of the packet is ignored.

Here is how I diagnosed and fixed this:

- I looked at your file in the analyser (run analyser.py supplying
filename with contents, or with no arguments and what you want to
view in the clipboard). You can also bring up the analyser in
BitPim pressing Ctrl-Alt-P (if you have anything highlighted then
only that is shown).

That showed how far into the packet things were parsed.

- I then looked at the description in p_brew.p which showed that the
above is nonsense after numentries==0

- I added an if statement so the rest of the packet is only looked
at if there are more than zero entries

- I verified that the code in com_brew.py did not look at the other
fields (datalen, items) if numentries is zero (as they wouldn't
exist).

- I then checked the code still worked on two different phones on
directories that did and did not contain subdirectories

- Then I committed the whole lot back to CVS :-)
I'm trying to come up to speed on the python language, how cell phone
communication is performed, and how bitpim works, so please bear with me.
You may find the code cross referencer as well as API documentation quite
useful (programming language section on developer page).
Is there any documentation on how to start adding support for a new phone?
web/phonespec.html
My guess is that I'll need to cut-n-paste the brew communication code
Cut-n-paste of code is bad! In general you override things in derived
classes.
and
add some sort of retry on the listdirectoriesresponse when this case occurs,
but for all I know the retry might need to belong in the brew code too.
Although the subject says "timeout", the error you got didn't say timeout
and my investigation above shows it is a data formatting issue that
is now fixed.
Is there any sort of existing documentation on the brew protocol?
Yes, the BitPim source code :-)

Roger

Loading...