Discussion:
[BitPim-devel] brew protocol problem
Simon C
2005-09-24 21:28:34 UTC
Permalink
I've managed to reproduce a problem reported by 8100 bitpim users when the
brew directory has too many files in.
It is due to too many directories in the filesystem, files themselves are
not a problem

This is a protocol trace of bitpim obtaining the contents of the brew
directory:

14:18:07.311 LG-VX8100: brew request Data - 8 bytes
<#! p_brew.listdirectoriesrequest !#>
00000000 59 02 05 62 72 65 77 00 Y..brew.

14:18:07.391 LG-VX8100: brew response Data - 263 bytes
<#! p_brew.listdirectoriesresponse !#>
00000000 59 02 00 1a 00 fc 00 62 72 65 77 2f 31 30 35 31
Y......brew/1051
00000010 32 00 62 72 65 77 2f 31 31 37 39 37 00 62 72 65
2.brew/11797.bre
00000020 77 2f 31 32 34 31 34 00 62 72 65 77 2f 31 32 35
w/12414.brew/125
00000030 31 33 00 62 72 65 77 2f 31 33 31 33 36 00 62 72
13.brew/13136.br
00000040 65 77 2f 31 33 34 37 38 00 62 72 65 77 2f 31 33
ew/13478.brew/13
00000050 39 32 31 00 62 72 65 77 2f 31 33 39 32 32 00 62
921.brew/13922.b
00000060 72 65 77 2f 31 36 34 35 32 00 62 72 65 77 2f 31
rew/16452.brew/1
00000070 36 34 35 34 00 62 72 65 77 2f 31 38 31 36 39 00
6454.brew/18169.
00000080 62 72 65 77 2f 33 33 31 34 00 62 72 65 77 2f 33
brew/3314.brew/3
00000090 35 35 32 00 62 72 65 77 2f 33 36 38 32 00 62 72
552.brew/3682.br
000000a0 65 77 2f 33 39 35 39 00 62 72 65 77 2f 33 39 36
ew/3959.brew/396
000000b0 36 00 62 72 65 77 2f 34 39 37 32 00 62 72 65 77
6.brew/4972.brew
000000c0 2f 35 36 39 31 00 62 72 65 77 2f 38 34 35 31 00
/5691.brew/8451.
000000d0 62 72 65 77 2f 38 38 33 36 00 62 72 65 77 2f 39
brew/8836.brew/9
000000e0 36 33 39 00 62 72 65 77 2f 64 6f 77 6e 6c 6f 61
639.brew/downloa
000000f0 64 00 62 72 65 77 2f 65 6e 00 62 72 65 77 2f 65
d.brew/en.brew/e
00000100 73 00 00 72 65 00 00 s..re..

The response looks ok, the number of directories is 0x1A according to the
response, but the actual number of directories listed in the packet is 2
less. Obviously the packet has overflowed. Bitpim ignores the packet length
0xFC and also read the spurious characters "re" at the end of the packets as
a directory. This results in either a crash or directories with garbage
names listed, trying to list the contents of these directoris results in a
crash.

The directories were created by downloading loads of apps (free demos).

Has anyone seen this behavior before? Does anyone know what happens with
other brew phones when the number of directory is too long to list in a
single packet.


Simon
Simon C
2005-09-25 04:37:08 UTC
Permalink
There is a brew command to list directories one at a time. I replaced the
existing function with this new command.
The comments in the existing code look like this has been tried before
without success, so I added it to the brew protocol file but defined an
attribute to access this new way of reading the filesystem so it would not
affect anything except the 8100. I did test on the 4400 and the 6100 and it
worked OK.

This fixes the problem with too many directories causing the filebrowser to
crash.

Also fixed bogus calender entry crash and allowed underscores and hyphens in
wallpaper and ringtone names.

New code attached with diffs.

Simon
-----Original Message-----
Sent: Saturday, September 24, 2005 2:29 PM
To: Bitpim-Devel (E-mail)
Subject: [BitPim-devel] brew protocol problem
I've managed to reproduce a problem reported by 8100 bitpim
users when the
brew directory has too many files in.
It is due to too many directories in the filesystem, files
themselves are
not a problem
This is a protocol trace of bitpim obtaining the contents of the brew
14:18:07.311 LG-VX8100: brew request Data - 8 bytes
<#! p_brew.listdirectoriesrequest !#>
00000000 59 02 05 62 72 65 77 00 Y..brew.
14:18:07.391 LG-VX8100: brew response Data - 263 bytes
<#! p_brew.listdirectoriesresponse !#>
00000000 59 02 00 1a 00 fc 00 62 72 65 77 2f 31 30 35 31
Y......brew/1051
00000010 32 00 62 72 65 77 2f 31 31 37 39 37 00 62 72 65
2.brew/11797.bre
00000020 77 2f 31 32 34 31 34 00 62 72 65 77 2f 31 32 35
w/12414.brew/125
00000030 31 33 00 62 72 65 77 2f 31 33 31 33 36 00 62 72
13.brew/13136.br
00000040 65 77 2f 31 33 34 37 38 00 62 72 65 77 2f 31 33
ew/13478.brew/13
00000050 39 32 31 00 62 72 65 77 2f 31 33 39 32 32 00 62
921.brew/13922.b
00000060 72 65 77 2f 31 36 34 35 32 00 62 72 65 77 2f 31
rew/16452.brew/1
00000070 36 34 35 34 00 62 72 65 77 2f 31 38 31 36 39 00
6454.brew/18169.
00000080 62 72 65 77 2f 33 33 31 34 00 62 72 65 77 2f 33
brew/3314.brew/3
00000090 35 35 32 00 62 72 65 77 2f 33 36 38 32 00 62 72
552.brew/3682.br
000000a0 65 77 2f 33 39 35 39 00 62 72 65 77 2f 33 39 36
ew/3959.brew/396
000000b0 36 00 62 72 65 77 2f 34 39 37 32 00 62 72 65 77
6.brew/4972.brew
000000c0 2f 35 36 39 31 00 62 72 65 77 2f 38 34 35 31 00
/5691.brew/8451.
000000d0 62 72 65 77 2f 38 38 33 36 00 62 72 65 77 2f 39
brew/8836.brew/9
000000e0 36 33 39 00 62 72 65 77 2f 64 6f 77 6e 6c 6f 61
639.brew/downloa
000000f0 64 00 62 72 65 77 2f 65 6e 00 62 72 65 77 2f 65
d.brew/en.brew/e
00000100 73 00 00 72 65 00 00 s..re..
The response looks ok, the number of directories is 0x1A
according to the
response, but the actual number of directories listed in the
packet is 2
less. Obviously the packet has overflowed. Bitpim ignores the
packet length
0xFC and also read the spurious characters "re" at the end of
the packets as
a directory. This results in either a crash or directories
with garbage
names listed, trying to list the contents of these directoris
results in a
crash.
The directories were created by downloading loads of apps
(free demos).
Has anyone seen this behavior before? Does anyone know what
happens with
other brew phones when the number of directory is too long to
list in a
single packet.
Simon
-------------------------------------------------------
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv
or your very
http://sourceforge.net/geronimo.php
_______________________________________________
BitPim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Joe Pham
2005-09-26 05:13:34 UTC
Permalink
This looks like that it might work for the other LG phones as well. For now, I suggest that isolating all of you chages to com_lgvx8100, which later can be moved to com_brew.

-Joe Pham




______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!
Simon C
2005-09-26 05:19:49 UTC
Permalink
Yes that is why I added the new attribute. The new code will only run if the
8100 is selected.

Simon
-----Original Message-----
Sent: Sunday, September 25, 2005 10:14 PM
Subject: Re: [BitPim-devel] vx8100 fixes
This looks like that it might work for the other LG phones as
well. For now, I suggest that isolating all of you chages to
com_lgvx8100, which later can be moved to com_brew.
-Joe Pham
______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!
-------------------------------------------------------
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv
or your very
http://sourceforge.net/geronimo.php
_______________________________________________
BitPim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Joe Pham
2005-09-26 05:35:45 UTC
Permalink
What I meant was that you probably don't need the changes in any other modules except for com_lgvx8100 (all changes in one file), which can be migrated to com_brew later.

-Joe Pham




______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!
Simon C
2005-09-26 14:26:46 UTC
Permalink
I've moved the fix all into the 8100 code attached.

The bug in the file system affects other LG phones as well which is why I
put the fix in the brew files. I tried this on the 4400 and it suffers from
the same problem. I suspect that if you tried the 4650 you would see the
same thing, to reproduce add several subdirectories to the same directory on
the phone (I would not recommend the root) so that the number of combined
characters in the names of the directories exceeds 256. At this point the
file view gets messed up with blank and/or corrupted entries, trying to view
those bad entries crashes bitpim, and of course you cant see all the
directories on the phone. I used a different program to create the extra
directories that does not suffer the same problem, the fix was based on
observing the serial port protocol it used to communicate the 4400.

Simon
Joe Pham
2005-09-27 01:42:04 UTC
Permalink
As noted in the original code, your changes only work for single-level dir listings, not recursive ones. Since only users of the 8100 (that I know of) reported this problem, I isolated your changes to com_lgvx8100 as a work around for that phone, until a permanent solution is found. I'm attaching the changes for your testing.

-Joe Pham
Roger Binns
2005-09-27 02:50:12 UTC
Permalink
Post by Joe Pham
As noted in the original code, your changes only work for single-level
dir listings, not recursive ones.
IIRC that is why the code ended up the way it is. The phone doesn't
really have the idea of handles so a request has to represent the
entire state for the phone to respond. I think it keeps one item
of state around. Consequently recursive directory listings will
screw it up if not done right. I have never tried it, but would
expect that you can't write to two files at the same time either.

Roger
Simon C
2005-09-27 03:16:20 UTC
Permalink
I was wondering what the comments were about. I made a change to fix the
recursion problem.

com_lgvx8100.py code changes attached. No changes to the p_brew.p you sent
me. I presume you will ignore the p_lgvx8100.p I sent earlier.

Simon


P.S. the annonymous CVS is playing up and I cannot update, any chance of
getting developer access, I wont commit anything without your OK :)
-----Original Message-----
Sent: Monday, September 26, 2005 6:42 PM
Subject: RE: [BitPim-devel] vx8100 fixes
As noted in the original code, your changes only work for
single-level dir listings, not recursive ones. Since only
users of the 8100 (that I know of) reported this problem, I
isolated your changes to com_lgvx8100 as a work around for
that phone, until a permanent solution is found. I'm
attaching the changes for your testing.
-Joe Pham
Simon C
2005-09-27 03:21:28 UTC
Permalink
Yes, that was the problem, you have to finish gathering all the info for the
current directory before moving onto the next.

Simon
-----Original Message-----
Binns
Sent: Monday, September 26, 2005 7:50 PM
Subject: Re: [BitPim-devel] vx8100 fixes
Post by Joe Pham
As noted in the original code, your changes only work for
single-level
Post by Joe Pham
dir listings, not recursive ones.
IIRC that is why the code ended up the way it is. The phone doesn't
really have the idea of handles so a request has to represent the
entire state for the phone to respond. I think it keeps one item
of state around. Consequently recursive directory listings will
screw it up if not done right. I have never tried it, but would
expect that you can't write to two files at the same time either.
Roger
-------------------------------------------------------
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv
or your very
http://sourceforge.net/geronimo.php
_______________________________________________
BitPim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Joe Pham
2005-09-27 22:52:19 UTC
Permalink
Post by Simon C
com_lgvx8100.py code changes attached.
I'll check it out & let you know.
Post by Simon C
I presume you will ignore the p_lgvx8100.p I sent earlier.
Yes.
Post by Simon C
P.S. the annonymous CVS is playing up and I cannot update, any >chance of getting developer access
I'll look into it.

-Joe Pham




______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!
Loading...