Discussion:
[Bitpim-devel] Debugging using the python GUIs
A F
2004-02-12 07:41:06 UTC
Permalink
Hi there,

I'm new to Python, but have much experience as a developer (everything from Common Lisp, Scheme, and Prolog to good old C++, VB, Java and more recently C# and VB.Net).

I'm looking to add support for the LG 4600. I've dowloaded the code and am able to run it. I just have one general question... how can I start executing module bp.py and set a breakpoint in another file (for example, p_lg.py) and have it hit the breakpoint? I'd like to do this all in one of the GUIs (Idle or winPython) if possible (I get enough of command line debugging at work... I've had enough cdb and cordbg to last a lifetime!)

Thanks,

Anthony
Roger Binns
2004-02-12 08:14:51 UTC
Permalink
Post by A F
I'm looking to add support for the LG 4600.
Looking on phonescoop it seems that the phone is almost identical
to the 4400. If you are committing to support this phone, I will
add in the code necessary to get it going initially. Let me know
when you have some time (it will take a few iterations to get everything
going).

The information needed is:

- USB vendor/product id (almost certainly 0x1004/0x6000)
- Names and locations of index files for wallpapers and ringtones
(See line 45 in com_lgvx6000.py for that phone and line 42 in
com_lgvx4400.py)
- Figure out the length of an index record
- Verify the calendar works
- The phonebook should work as well
Post by A F
how can I start executing module bp.py and set a breakpoint in another
file (for example, p_lg.py) and have it hit the
breakpoint?
That file in particular is dynamically loaded which may make it quite
hard. See the Debugging and Tweaking section on
http://bitpim.sourceforge.net/developer.html
Post by A F
I'd like to do this all in one of the GUIs (Idle or winPython) if
possible (I get enough of command line debugging
at work... I've had enough cdb and cordbg to last a lifetime!)
Another debugger I have heard of is Hap at http://hapdebugger.sf.net/

However the command line pdb (especially as I point out in the debug
and tweak bit) works wonderfully. Its is very closely modelled on
the GNU Debugger (gdb) which is actually a very usable command line
debugger.

Roger
A F
2004-02-12 18:42:25 UTC
Permalink
Sure, I'll commit to supporting this phone. I'll be doing the work for my
own use anyway... I'm more than willing to share with the community. I
should have some time to devote to this on the weekend.

I'll check out the alternative debugger you suggested.

I've been checking out the filesystem on the phone, and I can't seem to find
the built in ringers/wallpapers. I've successfully added numerous custom
images and midi-files, but I'm curious as to why I can't locate the built in
ones. It will take a bit more investigation I suppose.

Thanks,

Anthony

----- Original Message -----
From: "Roger Binns" <***@rogerbinns.com>
To: <bitpim-***@lists.sourceforge.net>
Sent: Thursday, February 12, 2004 12:14 AM
Subject: Re: [Bitpim-devel] Debugging using the python GUIs
Post by Roger Binns
Post by A F
I'm looking to add support for the LG 4600.
Looking on phonescoop it seems that the phone is almost identical
to the 4400. If you are committing to support this phone, I will
add in the code necessary to get it going initially. Let me know
when you have some time (it will take a few iterations to get everything
going).
- USB vendor/product id (almost certainly 0x1004/0x6000)
- Names and locations of index files for wallpapers and ringtones
(See line 45 in com_lgvx6000.py for that phone and line 42 in
com_lgvx4400.py)
- Figure out the length of an index record
- Verify the calendar works
- The phonebook should work as well
Post by A F
how can I start executing module bp.py and set a breakpoint in another
file (for example, p_lg.py) and have it hit the
breakpoint?
That file in particular is dynamically loaded which may make it quite
hard. See the Debugging and Tweaking section on
http://bitpim.sourceforge.net/developer.html
Post by A F
I'd like to do this all in one of the GUIs (Idle or winPython) if
possible (I get enough of command line debugging
at work... I've had enough cdb and cordbg to last a lifetime!)
Another debugger I have heard of is Hap at http://hapdebugger.sf.net/
However the command line pdb (especially as I point out in the debug
and tweak bit) works wonderfully. Its is very closely modelled on
the GNU Debugger (gdb) which is actually a very usable command line
debugger.
Roger
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bitpim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Roger Binns
2004-02-12 22:17:54 UTC
Permalink
Post by A F
I've been checking out the filesystem on the phone, and I can't seem to find
the built in ringers/wallpapers. I've successfully added numerous custom
images and midi-files, but I'm curious as to why I can't locate the built in
ones. It will take a bit more investigation I suppose.
It won't. The reason is that the builtin ones are not present in the
filesystem. You can get the list by copying down the order they are
in the selection menu.

Roger
A F
2004-02-15 20:23:53 UTC
Permalink
Hi Roger,

I've gathered some of the information you requested for the LG 4600.

1) USB vendor/product id... I have no idea how to find this. I found the
getphoneinfo function in com_lg.py and I added a call to it in
com_lgvx4400.__init__. However, it seems to fetch standard strings (eg.
Manufacturer="LG Electronics Ltd.", Model="LG-4600"). Are there other
commands I can send to the phone to fetch the USB Vendor/Prod ID, or should
I be looking somewhere in the file system for this info?

2) Names and locations of index files. So the main "index" for both
ringers and wallpapers is a file called \$USER_DIRS. It's has a very simple
record structure which is [length of record (including this
field)][Directory name (which is 0 terminated)]. These point to directories
in \usr\Ringtone and \usr\Wallpaper. Each subdirectory in those dirs
contains 2 files: .desc(a fixed length file which contains mime type info
and file size) and a file named body (no extension) which is the actual
media file. The name of the subdirectory becomes the name of the
Ringtone/Wallpaper as seen when using the phone. As I mentioned before,
I've already added several tones and images to the phone, and this file did
NOT have to be modified. I simply created a new subdir under \usr\Wallpaper
(or Ringtone) and gave it an appropriate name. In that directory I dumped
in the .desc file (modified to reflect the mime type and file size) and the
body file. The $USER_DIRS files seems to update itself when you power cycle
the phone.

3) Length of index record... see above

4 + 5) Neither the phone nor calendar seems to work. I have to do some
more playing to check out where it is failing, but I suspect the phone is
different than the vx4500 in how it handles the PIM info. A cursory look at
the file system shows a \pim directory which contains pbentry.dat (which
contains the entries, obviously. These appear to be fixed length records
which include the name, and various offsets into the other files),
pbnumber.dat, pbgroup, and record_id. I'll investigate further when I get
the chance.

Anthony

----- Original Message -----
From: "Roger Binns" <***@rogerbinns.com>
To: <bitpim-***@lists.sourceforge.net>
Sent: Thursday, February 12, 2004 12:14 AM
Subject: Re: [Bitpim-devel] Debugging using the python GUIs
Post by Roger Binns
Post by A F
I'm looking to add support for the LG 4600.
Looking on phonescoop it seems that the phone is almost identical
to the 4400. If you are committing to support this phone, I will
add in the code necessary to get it going initially. Let me know
when you have some time (it will take a few iterations to get everything
going).
- USB vendor/product id (almost certainly 0x1004/0x6000)
- Names and locations of index files for wallpapers and ringtones
(See line 45 in com_lgvx6000.py for that phone and line 42 in
com_lgvx4400.py)
- Figure out the length of an index record
- Verify the calendar works
- The phonebook should work as well
Post by A F
how can I start executing module bp.py and set a breakpoint in another
file (for example, p_lg.py) and have it hit the
breakpoint?
That file in particular is dynamically loaded which may make it quite
hard. See the Debugging and Tweaking section on
http://bitpim.sourceforge.net/developer.html
Post by A F
I'd like to do this all in one of the GUIs (Idle or winPython) if
possible (I get enough of command line debugging
at work... I've had enough cdb and cordbg to last a lifetime!)
Another debugger I have heard of is Hap at http://hapdebugger.sf.net/
However the command line pdb (especially as I point out in the debug
and tweak bit) works wonderfully. Its is very closely modelled on
the GNU Debugger (gdb) which is actually a very usable command line
debugger.
Roger
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bitpim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Roger Binns
2004-02-16 04:46:11 UTC
Permalink
Post by A F
1) USB vendor/product id... I have no idea how to find this.
It is usually part of the hardware instance. Look in the com
port browser.

hardwareinstance
USB\VID_1004&PID_6000&MI_02\SERIAL_NUMBER_02
This is how the device is named internally. For example USB devices
include the vendor (VID) and product (PID) identities

Every LG phone so far has been VID=1004, PID=6000
Post by A F
com_lgvx4400.__init__. However, it seems to fetch standard strings (eg.
Manufacturer="LG Electronics Ltd.", Model="LG-4600").
That is just what the modem gives. You can't actually get it via the USB
diagnostics interface.
Post by A F
Are there other
commands I can send to the phone to fetch the USB Vendor/Prod ID, or should
I be looking somewhere in the file system for this info?
You have to look in the driver hardware instance bindings.
Post by A F
2) Names and locations of index files. So the main "index" for both
ringers and wallpapers is a file called \$USER_DIRS.
That file serves a different purpose. I think it lists all directories
that could be deleted if you wanted to do a factory reset. Or maybe
it is the directories that should be counted if you are trying to figure
out how much space has been used.
Post by A F
These point to directories in \usr\Ringtone and \usr\Wallpaper.
Yet another naming convention ... On other LG phones it is user/sound/ringer
and brew/shared respectively.
Post by A F
Each subdirectory in those dirs contains 2 files: .desc(a fixed length file
which contains mime type info and file size) and a file named body (no
extension) which is the actual media file. The name of the subdirectory
becomes the name of the Ringtone/Wallpaper as seen when using the phone.
Yet another different scheme. And they love duplicating information (eg
file size is stored in two different places). I wonder how they map
the files into phonebook entries. On the other phones, there is an
index file which maps numerical indices into the filenames.
Post by A F
NOT have to be modified. I simply created a new subdir under \usr\Wallpaper
(or Ringtone) and gave it an appropriate name.
Can the directory name include the extension (eg could you name it example.jpg)?
Post by A F
3) Length of index record... see above
Sounds like no index at all.
Post by A F
4 + 5) Neither the phone nor calendar seems to work. I have to do some
more playing to check out where it is failing, but I suspect the phone is
different than the vx4500 in how it handles the PIM info. A cursory look at
the file system shows a \pim directory which contains pbentry.dat (which
contains the entries, obviously. These appear to be fixed length records
which include the name, and various offsets into the other files),
pbnumber.dat, pbgroup, and record_id. I'll investigate further when I get
the chance.
That is in fact exactly how the other phones store the pim. Can you set the
phone type in BitPim to be VX4500, and then request the phonebook? Please
email me the last 4 packets from the protocol log.

Roger
A F
2004-02-16 07:59:17 UTC
Permalink
Hi Roger,

1) USB vendor product id: This isn't a USB device. In fact, the USB
cables sold for the 5450 (which is seemingly almost identical to the 4600)
will not work with the 4600. This phone requires a usb-serial cable sold
through futuredial (the same cable as the vx1200 I believe). Under the
"Data-In" menu, the Method menu gives only 2 options: RS-232 and closed.

2) The index files. Actually, the filesize is only stored in one place -
the .desc file. I forgot to mention that that is also the file that stores
the image or ringtone's 'index' (ie. the order they appear when browsing
using the phone). I'm assuming that you mistook my description of the
fields in $USER_DIRS where I said [length of the record][directory]... what
I meant was "length of the next string". For example 19(hex), following by
a directory name (\usr\wallpapers\blahblah) that is 25 (including trailing
null) characters long. This is not the same as the size of the blahblah
file. (sorry for being unclear).

3) Can the directory name include the extension? I don't believe so, and
I'm scared to try as I've heard of users who get into infinite power cycling
loops after messing up the values in the .desc file.

4) Length of the index record... as mentioned, it's an index file (again,
the .desc file). This file contains the mime type, file length (actually
the sum of the size of the media file and the .desc file size), and
numerical index. Each ringtone/wallpaper gets it's own .desc file. Not all
the info in the .desc file has been identified, but we know the position and
length of the file size field, index field, and mime type field.

5) Phone book info. I tried to fetch the phonebook using the vx4500
setting as suggested. I've attached the exception thrown as well as the
protocol log. It appears to be the same behavior when using the 4400
setting. Obviously, the file structures are different among the phones. I
will try to determine the structure for the 4600 pim files when I get
chance.

I'll be out of town for the next few days so I won't be able to experiment
with the phone. I will, however, still have access to email should you need
any more information.

Do you have anything you'd like me to try when I return? I'd like to get
into some coding tasks if possible. As I've mentioned, this is my first
exposure to Python, but I'm starting to catch on.

Anthony


----- Original Message -----
From: "Roger Binns" <***@rogerbinns.com>
To: <bitpim-***@lists.sourceforge.net>
Sent: Sunday, February 15, 2004 8:46 PM
Subject: Re: [Bitpim-devel] Debugging using the python GUIs
Post by Roger Binns
Post by A F
1) USB vendor/product id... I have no idea how to find this.
It is usually part of the hardware instance. Look in the com
port browser.
hardwareinstance
USB\VID_1004&PID_6000&MI_02\SERIAL_NUMBER_02
This is how the device is named internally. For example USB devices
include the vendor (VID) and product (PID) identities
Every LG phone so far has been VID=1004, PID=6000
Post by A F
com_lgvx4400.__init__. However, it seems to fetch standard strings (eg.
Manufacturer="LG Electronics Ltd.", Model="LG-4600").
That is just what the modem gives. You can't actually get it via the USB
diagnostics interface.
Post by A F
Are there other
commands I can send to the phone to fetch the USB Vendor/Prod ID, or should
I be looking somewhere in the file system for this info?
You have to look in the driver hardware instance bindings.
Post by A F
2) Names and locations of index files. So the main "index" for both
ringers and wallpapers is a file called \$USER_DIRS.
That file serves a different purpose. I think it lists all directories
that could be deleted if you wanted to do a factory reset. Or maybe
it is the directories that should be counted if you are trying to figure
out how much space has been used.
Post by A F
These point to directories in \usr\Ringtone and \usr\Wallpaper.
Yet another naming convention ... On other LG phones it is
user/sound/ringer
Post by Roger Binns
and brew/shared respectively.
Post by A F
Each subdirectory in those dirs contains 2 files: .desc(a fixed length file
which contains mime type info and file size) and a file named body (no
extension) which is the actual media file. The name of the subdirectory
becomes the name of the Ringtone/Wallpaper as seen when using the phone.
Yet another different scheme. And they love duplicating information (eg
file size is stored in two different places). I wonder how they map
the files into phonebook entries. On the other phones, there is an
index file which maps numerical indices into the filenames.
Post by A F
NOT have to be modified. I simply created a new subdir under \usr\Wallpaper
(or Ringtone) and gave it an appropriate name.
Can the directory name include the extension (eg could you name it example.jpg)?
Post by A F
3) Length of index record... see above
Sounds like no index at all.
Post by A F
4 + 5) Neither the phone nor calendar seems to work. I have to do some
more playing to check out where it is failing, but I suspect the phone is
different than the vx4500 in how it handles the PIM info. A cursory look at
the file system shows a \pim directory which contains pbentry.dat (which
contains the entries, obviously. These appear to be fixed length records
which include the name, and various offsets into the other files),
pbnumber.dat, pbgroup, and record_id. I'll investigate further when I get
the chance.
That is in fact exactly how the other phones store the pim. Can you set the
phone type in BitPim to be VX4500, and then request the phonebook? Please
email me the last 4 packets from the protocol log.
Roger
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bitpim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Loading...