BitPim

Manage data in CDMA phones from LG, Samsung, Sanyo and others

BitPim Developer information

Project Management

BitPim uses SourceForge for project management. You can get to all the source, trackers (bugs, feature requests etc), mailing list and more at sourceforge.net/projects/bitpim

Source code

The source is stored in Subversion at sourceforge.net/svn/?group_id=75211. You can check it out using the Subversion tools for your platform. Note that the main code is at https://bitpim.svn.sourceforge.net/svnroot/bitpim/trunk/bitpim.

Mailing list

There is a bitpim-devel mailing list for developers where the techie action happens. You should also subscribe to bitpim-cvs-checkins if you want notification of all changes that happen to the source.

Programming language

BitPim is written in a programming language named Python. In addition to running well on many different platforms, Python also has that most important feature of being easy to read. It is also very easy to learn, and VERY productive.

Here are three pages that help you navigate your way through the code.


Cross Referenced

All the code coloured in, and using a cross referencer. Library and function calls are hyperlinked to their definitions. (The cross referencer isn't perfect ... yet)


API Documentation

Documentation generated from appropriate comments in the source code.


Development log

When we used CVS, this page showed the most recent 500 changes with diffs so you can see what has been happening recently. If you know of a tool that does the same thing for Subversion then please let us know.

If you have standalone code that implements some feature that isn't in Python, feel free to contribute that. It can be used as the basis for Python code, or as a test suite. The hard part is figuring out what to do and how to do it, and you will have already solved that :-)

Getting Started

You can do your development on Windows, Linux or Mac. If you do any work on the user interface, you should try your code out on at least two of the platforms since there are often minor platform specific differences that should be taken into account.

You will need to download and install the list of packages below. For Python packages that don't come with a binary installer, there is usually a setup.py file in the top level of what you downloaded. Simply type python setup.py install and the package will be installed. You will need to have administrative/root access.

If you want to work on USB code, or using the USB module then you will need C compilers and some other tools. Please post on bitpim-devel for further details.


Install Python

You muse use Python 2.5. Linux already comes with Python. MacOS X 10.3 does as well. For other platforms, grab it from www.python.org. If you are on Linux with an older version then you can install 2.5 alongside your existing version by building from source rpms on python.org
 


Install wxPython

wxPython is the graphics toolkit used. Grab it from www.wxpython.org. Note that you must use version 2.8.8.1 and you must use the Unicode version built for Python 2.5.

Linux users should use the GTK2 version and will probably need to rebuild from source on all versions of Linux. The simplest way is to download the GTK2 source rpm from the binaries download of wxPython and then do one of the following depending on your distro. For all commands it is assumed that you are root. If you want to do the building as a non-root user, you need to setup your rpm build environment as detailed here. After the rpm is built, scroll back a bit in the console to see exactly where the built file ended up.

Remember to delete any existing wxPython rpms from your rpmdir before building, or make sure you specify the correct version number in the install lines (rpm -U)

RPM based distro

wget http://easynews.dl.sourceforge.net/wxpython/wxPython2.8-2.8.8.1-1.src.rpm
rpmbuild --rebuild --define 'pyver 2.5' wxPython2.8-2.8.8.1-1.src.rpm
rpm -U rpmdir/wxPython2.8-gtk2-*.rpm rpmdir/wxPython-common-*.rpm

Gentoo

emerge rpm
wget http://easynews.dl.sourceforge.net/wxpython/wxPython2.8-2.8.8.1-1.src.rpm
rpmbuild --rebuild --define 'pyver 2.5' wxPython2.8-2.8.8.1-1.src.rpm
rpm -U --nodeps rpmdir/wxPython2.8-gtk2-*.rpm rpmdir/wxPython-common-*.rpm

Debian

Debian stable is way behind the times, so you may find something appropriate in testing. Alternatively, the instructions below should work.

apt-get install alien
apt-get install libgtk2.0-dev freeglut3-dev python2.5-dev
wget http://easynews.dl.sourceforge.net/wxpython/wxPython2.8-2.8.8.1-1.src.rpm
rpmbuild --rebuild --define 'pyver 2.5' wxPython2.8-2.8.8.1-1.src.rpm
cd rpmdir
alien packagenames.rpm
dpkg -i whatever alien called them

Install pySerial

pySerial is used to interface with the serial port. You must use version 2.4. Grab it from pyserial.wiki.sourceforge.net/pySerial


Install PyWin32 (Windows only)

PyWin32 is used by pySerial to do the underlying nasty work of accessing the Windows API. Your must use Build 212. Grab it from sourceforge.net/projects/pywin32


Install APSW

APSW is the wrapper used for the SQLite database that stores some BitPim data. You must use APSW version 3.5.9-r2 with SQLite version 3.6.1. Grab it from code.google.com/p/apsw.


Get BitPim source code

Check out the BitPim code from Subversion. I recommend checking it out to a directory named c:\projects\bitpim or something similar on other platforms. The subversion section has pointers to various graphical and command line clients you can use.


Get paramiko (optional)

You need paramiko if you want to use BitFling. You must use version 1.7.4 (Desmond). You can get it from http://www.lag.net/paramiko/


Get pycrypto (optional)

You need pyCrypto if you want to use BitFling. You must use version 2.0.1. It can be downloaded from www.amk.ca/python/code/crypto.html


Build native modules

On Windows you don't have to build anything. On Linux and Mac you should build the USB module if you use an LG phone with a straight USB cable (ie not USB to serial). On all platforms the native C version of the string matcher is faster than the Python implementation. The simple way to build everything is:

$ python packaging/buildmodules.py

Note that you will need Swig on your path and libusb installed to build the USB module. To build the string matcher you need to have a C compiler in your path (MinGW on Windows - you only need MinGW itself not MSYS).

This is how to build them the manual way


Build usb library (optional - Linux & Mac only)
You need to build the USB library if you want direct USB support. Run the relevant build script in the native/usb directory. Note that you will need Swig installed (version 1.3.19 or above), as well as the header files and library (devel) parts of libusb, and a C compiler. (The relevant usb package is named libusb-dev on Debian, libusb-devel on Redhat and just plain libusb on Gentoo. You can also download it from libusb.sourceforge.net where you will also find the Mac version.).

Compile string matcher (optional)

The string matcher code uses the Jaro Winkler algorithm. There is both a C and Python implementation in the module. If you have a large phonebook then you will want the C version as it is much faster.

        windows> python setup.py build --compile=mingw32
        windows> copy build\lib.win32-2.3\jarow.pyd
        Mac/Linux# python setup.py build ; cp build/*/jarow.* .
        

Run it

python bp.py should run BitPim from a console.


Debugging and tweaking

There is a developer console (python interpreter with access to all the internals) builtin. Find the current config file (Edit > Settings will tell you the name) and add a key in the default section add:

console = 1

You can also add print statements to see what is going on. For whole program debugging and tweaking try the pythonwin or Idle IDEs that come with Python. If you are want to enter the Python debugger at a certain point of code, add the following line:

     import pdb; pdb.set_trace()

Note that the debugger won't behave well if you have the developer console turned on.

You can put it in an if statement or similar trigger. Once the tracepoint is hit, type up and you will be in the code and can step, print variables or anything else that takes your fancy. Type help for a list of commands.

The author actually uses xemacs with a few print statements every now and then.


Updating and patches

Ensure you do a Subversion update every now and then to pick up updates that other people have made to the code. If you would like to supply a patch, then do svn diff and capture the output.

Don't worry about your patch being perfect, or even working. We will happily adapt, rewrite or repurpose it. You will have done the hard work of figuring out something useful and broadly how to do it :-)

All patch submissions are considered to be under the BitPim (GPL) license. [Please check the LICENSE file in the source tree as there are some relaxations, for example allowing linking with OpenSSL]. Do not submit them if you do not agree with the full terms of the license. Your copyright is however retained, or you are free to sign over your copyright to the project.


What to work on

Usually your first step is adding or improving support for your phone. You can find documentation in the dev-doc directory.

If you would like to work on other things, then have a look at the todo list. Mail the bitpim-devel list if you intend to embark on any of those, or mention what areas you want to work on and ask for suggestions.

Get BitPim at SourceForge.net. Fast, secure and Free Open Source software downloads