Editing from a Linux PC the phone book (contacts list) in an Android phone

A mobile phone stores contacts in the phone itself and/or on the SIM. Over the years, the phone book on my SIM became cluttered with duplicate entries, inconsistently-named contacts, and so on. I decided recently to tidy up the phone book, and looked for a way to do it from Linux.

Now, the last time I tidied up my phone book was back in 2003 when my SIM was in a Sony Ericsson T68i. These days I’m using the same SIM in an Android smartphone: the HTC Desire. Back then I used a shareware application called Mobile Navigator on a laptop running Windows XP. So, naturally, I thought it would be possible to do something similar from a PC running Linux.

An indirect method of editing a phone book in an Android phone is recommended in many Web forums. The advice is to synchronise the phone’s phone book with GMail on your PC, edit the contacts in GMail on the PC and then the contacts will be updated in the phone when the phone next synchronises with GMail. That is all very well, but I don’t want to import my phone contacts into GMail and thus have them stored in ‘The Cloud’, plus I don’t see why I should be forced to do that just to make it easier for me to tidy a phone book in my phone. So I set about searching for an application to do the job.

My search turned up three applications that appeared to enable a user to edit the phone book (phone and SIM):

1. Gammu (CLI) and Wammu (GUI front-end), FOSS with versions for both Linux and Windows.

2. MOBILedit!, a closed-source commercial product for Windows.

3. MyPhoneExplorer (Version 1.8.1), closed-source ‘donationware’ for Windows, recommended in various forums and that has been used with WINE in Linux. Not only does MyPhoneExplorer allow you to edit the phone book, it also provides a host of other features such as: viewing the phone’s call logs, messages, hardware status, files and applications; sending messages via the PC; etc. It’s a nifty application.

Web browsing told me that Gammu/Wammu does not yet work with the HTC Desire (see the bug report Don’t get any connection to HTC Desire via bluetooth in Wammu/Gammu). This is a pity, as Wammu and Gammu look well-designed, and Wammu has a professional feel to it.

The price for MOBILedit! is not extortionate but I wanted to find a cost-free solution if possible, and, more importantly, I could find no evidence on the Web of MOBILedit! having been used with WINE in Linux to edit the phone books in the HTC Desire.

The MyPhoneExplorer forums include a thread on using it with WINE, so MyPhoneExplorer looked like my only option (although it is a pity it is not FOSS). I installed MyPhoneExplorer with its own WINEPREFIX but, despite following the instructions in the MyPhoneExplorer forums, I was unable to get MyPhoneExplorer to connect to the HTC Desire via a USB cable in Linux. This may be because, despite what I have read on the android developers Web site (see Using Hardware Devices and OEM USB Drivers), as is the case with Windows it is necessary in Linux to install ADB USB drivers (the ADB drivers can be installed in Linux by installing the Android SDK). However, I was able to connect MyPhoneExplorer to my HTC Desire via WiFi at home (but not in a hotel, as connection depends on the router and internal network IP address space), and via Bluetooth (anywhere).

How to install MyPhoneExplorer in WINE

1. Use the Android Market to install MyPhoneExplorer Client on the phone.

2. Surf over to the MyPhoneExplorer Home Page and download MyPhoneExplorer_Setup_1.8.1.exe to ~/Desktop/

3. Open a Konsole/Terminal window and perform all the following steps in the same window.

4. Install MyPhoneExplorer on your PC under WINE:

$ cd
$ export WINEPREFIX=$HOME/.wine-myphoneexplorer
$ export WINEARCH="win32"
$ winecfg
$ wget "http://download.microsoft.com/download/5/a/d/5ad868a0-8ecd-4bb0-a882-fe53eb7ef348/VB6.0-KB290887-X86.exe"
$ wine VB6.0-KB290887-X86.exe
$ cd ./.wine-myphoneexplorer/drive_c/
$ cp $HOME/Desktop/MyPhoneExplorer_Setup_1.8.1.exe .
$ mv ${WINEPREFIX}/drive_c/windows/system32/oleaut32.dll ${WINEPREFIX}/drive_c/windows/system32/oleaut32-alt.dll
$ mv ${WINEPREFIX}/drive_c/windows/system32/olepro32.dll ${WINEPREFIX}/drive_c/windows/system32/olepro32-alt.dll
$ echo -e REGEDIT4\\n\\n[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]\\n\"asycfilt\"=\"native\"\\n\"comcat\"=\"native\"\\n\"msvbvm60\"=\"native\"\\n\"oleaut32\"=\"native\"\\n\"oleaut32\"=\"native\"\\n\"olepro32\"=\"native\"\\n\"stdole2.tlb\"=\"native\"\\n[HKEY_CURRENT_USER\\Software\\MyPhoneExplorer]\\n\"Language\"=\"English.lng\" > temp.reg
$ wine regedit temp.reg
$ wget http://www.kegel.com/wine/winetricks
$ chmod +x winetricks
$ ./winetricks # Install Visual Basic 6 SP6 (I had to do this as well as wine VB6.0-KB290887-X86.exe)
$ ./winetricks # Install msxml3
$ wine MyPhoneExplorer_Setup_1.8.1.exe # Install MyPhoneExplorer

(Make sure you select the WINEPREFIX first when using winetricks)

5. Edit your Desktop Environment’s menu to use the following command for launching MyPhoneExplorer:

env WINEPREFIX="/home/fitzcaraldo/.wine-myphoneexplorer" WINEARCH="win32" wine C:\\windows\\command\\start.exe /Unix /home/fitzcarraldo/.wine-myphoneexplorer/dosdevices/c:/users/Public/Start\ Menu/Programs/MyPhoneExplorer/MyPhoneExplorer.lnk

(Of course replace “fitzcarraldo” with your user name.)

How to connect via Bluetooth

1. Look up the phone’s Bluetooth MAC address in the phone itself, write it down and keep it to hand. (I use the MAC address 11:22:33:AA:BB:C1 in the examples below.)

2. Enable Blutooth on your PC and phone, make them both discoverable, and pair them.

3. Launch MyPhoneExplorer Client on the phone and wait a few seconds for it to load and run.

4. Now check which channel is used by MyPhoneExplorer Client (In the example below it is Channel 17):

$ sudo sdptool browse
Inquiring ...
Browsing 11:22:33:AA:BB:C1 ...
Service RecHandle: 0x10000
Service Class ID List:
"PnP Information" (0x1200)

Service Name: Headset Gateway
Service RecHandle: 0x10001
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100

Service Name: Handsfree Gateway
Service RecHandle: 0x10002
Service Class ID List:
"Handsfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0105

Service Name: Object Push
Service RecHandle: 0x10003
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100

Service RecHandle: 0x10004
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x100
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100

Service Name: BRCM Advanced Audio
Service RecHandle: 0x10005
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x102
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0102

Service Name: Phonebook Access PSE
Service RecHandle: 0x10006
Service Class ID List:
"Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
"OBEX" (0x0008)
Profile Descriptor List:
"Phonebook Access" (0x1130)
Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x10007
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX File Transfer" (0x1106)
Version: 0x0100

Service Name: MyPhoneExplorer
Service RecHandle: 0x10008
Service Class ID List:
UUID 128: 00001101-0000-1000-7000-00304b7f34de
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 17

5. Bind a virtual serial device to the phone (You can look up the phone’s Bluetooth MAC address in the phone itself to double check):

$ sudo rfcomm bind 1 11:22:33:AA:BB:C1 17

N.B. If you have been tinkering already with binding, and the virtual device /dev/rfcomm1 is therefore already bound, you will get an error message saying “Can’t create device: Address already in use”. You can release the virtual device by using the command:

$ sudo rfcomm release /dev/rfcomm1

6. Create a symbolic link for the virtual serial link:

$ export WINEPREFIX=$HOME/.wine-myphoneexplorer
$ sudo ln -is /dev/rfcomm1 ${WINEPREFIX}/dosdevices/com2
$ sudo chmod 777 ${WINEPREFIX}/dosdevices/com2 # you may not need to do this, as the permissions may already be 777.

7. Launch MyPhoneExplorer (e.g. in KDE this would be: Kickoff > Applications > Wine> Programs > MyPhoneExplorer > MyPhoneExplorer), then press F2 (or select File > Settings).

8. Select ‘Connection’ in the left pane and then select ‘Phone type’ to be ‘SonyEricsson phone with modeminterface’. Tick ‘Stable connection (some features are deactivated)’.

9. Select ‘Connection’ in the left pane and then select ‘Phone type’ to be ‘Phone with Google Android-OS’.

10. Select ‘Connection’ in the left pane and then select ‘Connect via…’ to be ‘Bluetooth’ and enter “COM2″ (upper case, and without the quotes) and click on ‘OK’.

11. Press F1 (or select File > Connect) and your PC should be able to connect to the phone and synchronise with your phone’s phone book (Extras > Start Multi-sync), thus enabling you to edit the contents and re-synchronise to update the phone book in the phone.

Script to make subsequent connections via Bluetooth easier

Note that the channel used by MyPhoneExplorer Client will change the next time you want to connect, so there is no point editing /etc/bluetooth/rfcomm.conf (the Linux configuration file in which you would normally specify the channel). Therefore, to make life a little easier, I wrote a simple Bash script to automate as much as possible the process of reconnecting via Bluetooth in future. If you want to do the same, use your favourite text editor and save the following script with the file name myphoneexplorer.sh:

echo -n "Please switch on Bluetooth via System Tray icon, make Bluetooth discoverable then press ENTER: "
echo -n "Please enable Bluetooth on the phone, make it discoverable then press ENTER: "
export WINEPREFIX="/home/fitzcarraldo/.wine-myphoneexplorer"
export WINEARCH="win32"
echo "Checking current rfcomm status..."
sudo rfcomm -a
echo "Trying to release rfcomm1 in case it is in use (no message means rfcomm1 is released and is now OK to use,"
echo "and the message Cannot release device: No such device also means rfcomm1 is OK to use)..."
sudo rfcomm release /dev/rfcomm1
echo -n "Now please launch MyPhoneExplorer Client on the phone, wait a few seconds then press ENTER: "
echo "Find channel of MyPhoneExplorer Client:"
sudo sdptool browse
echo -n "Enter the channel number: "
sudo rfcomm bind 1 11:22:33:AA:BB:C1 $RESPONSE
echo "Checking current rfcomm status..."
sudo rfcomm -a
echo "If all is OK then please launch MyPhoneExplorer from Kickoff > Applications > Wine > Programs > MyPhoneExplorer"
echo "and press F1 to connect to the phone."

(Of course replace “fitzcarraldo” with your user name, and replace “11:22:33:AA:BB:C1″ with the Bluetooth MAC address of your phone.)

Then make the script executable:

$ chmod +x myphoneexplorer.sh

The next time you want to use MyPhoneExplorer, open a Konsole/Terminal, execute the script:

$ sh myphoneexplorer.sh

and follow the instructions it displays in the Konsole/Terminal window.

How to connect via WiFi

Connecting MyPhoneExplorer to the phone via WiFi is easier than via Bluetooth. Note that WiFi connection will not work with a public WiFi network, just a home WiFi network.

1. Enable WiFi on your PC and phone.

2. Launch MyPhoneExplorer Client on the phone and wait a few seconds for it to load and run.

3. Launch MyPhoneExplorer (e.g. in KDE this would be: Kickoff > Applications > Wine> Programs > MyPhoneExplorer > MyPhoneExplorer), then press F2 (or select File > Settings).

4. Select ‘Connection’ in the left pane and then select ‘Phone type’ to be ‘SonyEricsson phone with modeminterface’. Tick ‘Stable connection (some features are deactivated)’.

5. Select ‘Connection’ in the left pane and then select ‘Phone type’ to be ‘Phone with Google Android-OS’.

6. Select ‘Connection’ in the left pane and then select ‘Connect via…’ to be ‘WiFi’ and click on ‘OK’.

7. Press F1 (or select File > Connect) and your PC should be able to connect to the phone and synchronise with your phone’s phone book (Extras > Start Multi-sync), thus enabling you to edit the contents and re-synchronise to update the phone book in the phone.

Useful references

The MyPhoneExplorer forums are oriented to Windows as it is a Windows application, but there is a thread for Linux users: HowTo: Use MyPhoneExplorer under GNU/Linux (English Version)

The thread for Windows users of MyPhoneExplorer may also be of some use: Howto and FAQ: Use Android Phones with MyPhoneExplorer

Limitations in WINE

The only limitation I have found using MyPhoneExplorer 1.8.1 in WINE is that it crashes if I try to cut and paste when editing a phone book entry. Additionally, some people have reported that the buttons on the button bar do not work when you are connected to the phone; they usually do work for me (apparently it depends on whether you have installed msxml3) but sometimes don’t. In any case, if they don’t then you can use the pull-down menus from the menu bar instead.

Other than that, MyPhoneExplorer works well in WINE and enables me to edit the phone book in my Android phone without involving Big Brother! It’s a nice application.

Firewall rules if using WiFi

If you’re using MyPhoneExplorer to connect with the phone via WiFi instead of Bluetooth, and your PC has a firewall enabled, according to a post on 7 June 2011 in the MyPhoneExplorer forums you have to configure the firewall with the following rules:

TCP port 80 (outgoing) – Check for update
TCP port 5210 (outgoing) – Communication with client
UDP port 5211 (outgoing) – Communication with client
UDP port 5212 (inbound) – Broadcast from the client

Below I list the rules I implemented in Uncomplicated Firewall:

# ufw status
Status: active

To              Action          From
--              ------          ----
Anywhere        ALLOW           5212/udp

80/tcp          ALLOW OUT       Anywhere
5210/tcp        ALLOW OUT       Anywhere
5211/udp        ALLOW OUT       Anywhere

Alternatively you could just disable the firewall on your PC while you’re using MyPhoneExplorer with your phone, which I do anyway when I’m at home as my home network is protected by the firewall in my router.

EDIT (October 25, 2012): Now there is another way of editing an Android phone’s contacts list from Linux: AirDroid. And you don’t need to mess around with WINE to use it. For details see my post AirDroid, a handy Android app for managing your phone from Linux.

About these ads

About Fitzcarraldo
A Linux user with an interest in all things technical.

17 Responses to Editing from a Linux PC the phone book (contacts list) in an Android phone

  1. Nico says:

    I strictly followed your instructions and even have the same mobile phone (HTC Desire). MyPhoneExplorer now works in wine, but it cannot connect to my phone via WiFi. When I try F1 I get an error message “Connection could not be established. The IP address of the mobile phone could not be identified” (Roughly translated from German).

    Before I read your instructions, I tried this one: http://www.fjsoft.at/forum/viewtopic.php?t=7617&postdays=0&postorder=asc&start=0

    With the same result: MPE works, but cannot connect to the phone.

    I am quite new to Linux, and would be happy to hear any suggestions

    • Fitzcarraldo says:

      I get that message if I forget to enable WiFi on the phone or to launch MyPhoneExplorer Client on the phone, so do you have WiFi enabled and the client running on the phone? The other thing to make sure you have done is ticked the ‘Stable connection’ box on the Sony Ericsson page, and finally make sure your firewall on your PC and your firewall in your router are not blocking the traffic.

  2. Nico says:

    Thanks for your reply. I did all that: Both the computer and the phone are connected via the same wireless network. Wifi is definitely on (I can browse the internet on both devices). I run the MPE on the phone and the computer simultaneously (It reports “waiting for connection” on the phone), and the I ticked the “stable connection” box on the Sony Ericsson, and the Wifi on the Android page. I don’t know of any firewalls that could block the traffic.

    • Fitzcarraldo says:


      Can you ping the phone from the command line on your Linux machine? You should be able to find out its IP address in your home network’s internal IP address range by using your router’s configuration interface (it’s usually accessed via a Web browser).

      You don’t have USB debugging enabled on the phone do you? I wonder if that might cause the problem. It’s under menu > Settings > Applications > Development if I recall correctly. Untick that if it’s ticked.

      Have you had a look in MyPhoneExplorer’s log file to see if there are any other messages that might throw some light on your problem? There is a button on the settings page that you can click to display the log file contents.

      The only other thing I can think of suggesting at the moment would be for you to configure your router to allocate a static IP address for the phone within the address range of your home network. Try that. Also, one of the fields on the MyPhoneExplorer settings page allows you to specify a static IP address for the phone, so you could enter the phone’s IP address there.

      By the way, have you tried connecting via Bluetooth? Does that work?

    • Fitzcarraldo says:

      Another thought: Are you using Ubuntu? If you are, isn’t UFW (Uncomplicated Firewall) enabled by default in Ubuntu? You can disable it by using the following command in a Terminal window: sudo ufw disable

      EDIT: Apparently UFW is disabled by default in Ubuntu (see https://wiki.ubuntu.com/SecurityTeam/FAQ#UFW)

      • Nico says:

        Yeah!! I use Fedora 15 and disabled the firewall. Now it connects!! Thanks a lot!
        I still didn’t manage to sync with Thunderbird & Lightning, though. I have installed them in wine and Linux, but when I try to sync the address book or calender, I get an error message and MPE even crashes, when I press the “advanced” button under settings – synchronization – thunderbird. In Thunderbird-Wine I replaced the abook.mab storage.sdb, and local.sqlite with symbolic links to the files in Thunderbird-Linux. However, Thunderbird-Wine shows neither my contacts nor calendar, that I have in Thunderbird-Linux. Could you help me with this?

      • Fitzcarraldo says:

        You’re welcome.

        Regarding syncing with Thunderbird & Lightning, I haven’t tried it myself so cannot advise you, but you could try the steps given in the thread MyPhoneExplorer and Thunderbird under Linux in the MyPhoneExplorer forums (scroll down the first post to the section “Sync MyPhoneExplorer with Thunderbird and Lightning “).

  3. Chris says:


    thank you for the instructions. They worked fine for me (using Ubuntu 12.04, Wine 1.4, winetricks 20120308, and MyPhoneExplorer 1.8.4; connecting via WiFi).

    In this setup, you can even skip a few steps. In case anyone is using the same setup, I am posting the shortened version of the instructions:

    $ export WINEPREFIX=$HOME/.wine-myphoneexplorer
    $ export WINEARCH=”win32″

    $ echo “REGEDIT4

    \”Language\”=\”English.lng\”” | wine regedit -

    $ mv ${WINEPREFIX}/drive_c/windows/system32/oleaut32.dll ${WINEPREFIX}/drive_c/windows/system32/oleaut32-alt.dll
    $ mv ${WINEPREFIX}/drive_c/windows/system32/olepro32.dll ${WINEPREFIX}/drive_c/windows/system32/olepro32-alt.dll

    $ winetricks vb6run msxml3

    $ winetricks msxml3

    $ wine $HOME/.resources/MyPhoneExplorer/MyPhoneExplorer_Setup_1.8.4.exe

    You’ll get a bunch of error messages during the process, but apparently they can all be ignored safely (one of them even has to be confirmed by clicking OK). After the first winetricks call, the program will ask you to download a file and store it in a specific location. Once you have done that, you need to call it again as shown above. The last command actually created a link on the desktop (~/Desktop/MyPhoneExplorer) for me that already contained the correct WINEPREFIX. In case you want to use a different language in MyPhoneExplorer you might have to adjust the corresponding line in the echo command.

    I definitely recommend MyPhoneExplorer and thank you again for making these instructions available to everyone.


  4. Pingback: AirDroid, a handy Android app for managing your phone from Linux « Fitzcarraldo's Blog

  5. Paul Jillins says:

    I’m getting a run-time error 339 on the splash screen.

    Component ‘vbaIml6.ocx’ or one of its dependencies not correctly registered: a file is missing or invalid.

    Your help would be much appreciated.

  6. Paul Jillins says:

    Thanks that worked 1.8.3 loads, can’t sync yet though.

  7. Raoul Duke says:

    Thanks a lot to you and to Chris. MPE was one of the few apps I really missed after moving to Linux. And running it under Wine is much more practical than having a whole XP virtual machine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 43 other followers

%d bloggers like this: