Michal Čihař - Blog Archives for Linux

Phone synchronisation, finally

One of long standing things on my todo list was to make synchronisation work from my cell phone (Sony-Ericsson K750i) to some PIM application on Linux side (as a GNOME user Evolution is the natural choice). I tried it several times but it never actually worked. Today I gave it yet another try and I finally succeeded on first attempt :-).

As a first step I just wanted to make a backup of all things. Gammu can do it quite well and it's the tool I trust for this purpose:

gammu backup /tmp/phonebook.vcf
gammu backup /tmp/calendar.vcs

Now it's time to play with OpenSync. We will use setup guide and SyncML guide as a starting point. As I had in past problems with both sides - both phone and Evolution failed with some random errors, I wanted to go step by step. So I started with setting up phone to files synchronisation:

msynctool --addgroup file2phone
msynctool --addmember file2phone file-sync
msynctool --addmember file2phone syncml-obex-client

Now we need to configure file storage, just tell it where it should store the data:

msynctool --configure file2phone 1

And change path in your editor to something like:

<?xml version="1.0"?>
<config>
  <!-- directory path for file-sync -->
  <path>/home/foo/phone-backup/</path>

  <!-- should care of subdirectories (TRUE or FALSE) -->
  <recursive>FALSE</recursive>
</config>

Now the more tricky part comes, we need to set up phone end:

msynctool --configure file2phone 2

Fortunately we can use example from the SyncML guide and just fill in Bluetooth address (you can get it using hcitool scan) and channel (sdptool browse 00:b0:0b:fa:ce:00):

<?xml version="1.0"?>
<config>
  <bluetooth_address>00:b0:0b:fa:ce:00</bluetooth_address>
  <bluetooth_channel>7</bluetooth_channel>
  <identifier>Sony Ericss</identifier>
  <version>1</version>
  <wbxml>1</wbxml>
  <username></username>
  <password></password>
  <type>2</type>
  <usestringtable>0</usestringtable>
  <onlyreplace>0</onlyreplace>
  <onlyLocaltime>0</onlyLocaltime>
  <recvLimit>0</recvLimit>
  <maxObjSize>0</maxObjSize>
  <contact_db>Contacts</contact_db>
  <calendar_db>Agenda</calendar_db>
  <note_db>Notes</note_db>
</config>

And now we should be able to synchronise whole phonebook from phone to selected directory:

msynctool --sync file2phone

Okay, this works, let's try more complicated thing - include Evolution in the chain. The steps are the same, config file for phone is the same, Evolution plugin has sane defaults you usually don't have to touch:

msynctool --addgroup phone2evo
msynctool --addmember phone2evo evo2-sync
msynctool --addmember phone2evo syncml-obex-client
msynctool --configure phone2evo 1
msynctool --configure phone2evo 2

But now comes the tricky thing - Sony-Ericsson phones usually have something broken around notes (or it is broken in OpenSync, I don't care, simply synchronisation fails without this step) and we have to avoid synchronisation of them. This can be done by changing filter file in group we've created above (usually in file ~/.opensync-0.22/group2/filter.conf):

<?xml version="1.0"?>
<filter>
  <note/>
</filter>

And finally we can start the synchronisation and it should work:

msynctool --sync phone2evo

You can also GUI multisync0.90 to do the configuration and start synchronisation, but it is not much different, you also still have to edit XML files.

Nvidia is bad, Intel is good?

Intel is always seen as good guy, who is writing open source drivers, releasing at least some specifications for hardware. Unfortunately it is not always the case. If you want to use their new embedded solution - Menlow CPU and Poulsbo chipset, they provide you lot of crap.

Basically what you get is a zip file containing several Microsoft Word documents, badly formatted text files (end of lines at each 80 chars), PDFs and some zip and tar archives. If you look to one of these archives, you will get binary graphical installer, which will install license, uninstallator and yet another set of tarballs. These tarballs finally contain binary and source packages you need to make graphics work on this platform. Maybe somebody did this to practise various ways of compressing and distributing things, but it is really amazing how many times you need to decompress several archives to actually get to the things you want.

Unfortunately at the end you will find out that libgl1-mesa-dri-psb binary (DRI driver for graphics) has no sources and Intel is not willing to give them to you. Bad luck if you have slightly different distribution than one of these which are supported (FC6, Midinux-build9, ubuntu-gutsy, ubuntu-hardy) and the provided binary simply crashes.

Network manager not working?

For a long time I had problems on my work computers with Network manager still thinking that it is not connected. And I was really lazy to debug it. But as more and more application take online/offline settings from it, this became more and more annoying.

After some googling I found out that the problem might be in /etc/network/interfaces file, which is parsed by Network manager. Some "complex" things might confuse it. Well in my case the complex thing was calling of some script in post-up. Commenting this out magically fixes everything. Moving script to /etc/network/if-up.d/ also is not a big problem, but why the hell the Network manager thing does not tell where the problem is?

HAL Sleep Quirks

HAL Sleep Quirks is definitely good site for people having problem with suspend/hibernation in Linux. However I would like to find there one very special quirk: how to stop Gnome Power Manager (or whoever is responsible for this) thing that my suspend failed! It works without problems (and worked since I have this notebook), but I always get the popup that it failed. I know I can disable the popup, but there must be way to force this beast understand that suspend works for me :-).

Debugging not working USB automounting in GNOME

Some day, this thing stopped to work for me. I was not aware of doing anything what could break it, even any related package was not updated. Time went on and I still did not find time to learn how to debug this udev/hal/dbus/gnome-volume-manager machinery.

Today, after some googling I found short debugging guide on Ubuntu wiki, which quickly revealed me that "volume.ignore set to true on /org/freedesktop/Hal/devices/volume_uuid_4717_5407, not mounting". Well I didn't configure anything to be ignored, so let's dig deeper in this.

As I had no idea where this thing could be set, I again started to google and /etc/hal and /usr/share/hal seem to be the right place where to start grep. Nothing related in /etc, but too much entries in /usr. However most of them were selective for some special USB disks or partitions. But there was one which did this unconditionally - it was file /usr/share/hal/fdi/policy/gparted-disable-automount.fdi, what crap from gparted. Now I remember that I used this for formatting and partitioning something on USB and after doing all job, it crashed. So it left this piece of HAL hack inside /usr/share/hal and it was cause of anything not mounting.

Seems to be worth of reporting as a bug... Wait a moment, it's already known and some patch for it exists. Hopefully we will see this soon in unstable.

I like when things just work

Recently, after switching to open source drivers for my Nvidia card in notebook, I get possibility to have working suspend to disk (well suspend was always working, but the resume of screen was the problem). In same time, I enabled suspend to disk, when battery is getting really low in Gnome power management preferences. This night it saved me file system troubles - I let the notebook to do some calculations and forgot to connect it to power. So it ran few hours till the battery was down and then it just hibernated. When I noticed this on morning, I could just plug the power and the calculation can continue. Thanks to everybody who made this work.

Sound-Juicer and MP3

I always wondered why there is no possiblity to create MP3 from Sound-Juicer. I expected it is some patent issue, but I have all lame stuff installed and expect things in GNOME to just work.

Unfortunately this is not the case, but Google works always and Jacob Emcken wrote down his configuration, so setup was quite easy. Thanks!

Hiding configuration

I know that GNOME is trying to hide as much configuration as possible, but Epiphany today suprised me. I started to use is as default browser some time ago, but now I needed to print something for first time. Everything in my system is configured to use A4 paper, so I didn't expect any problem with this configuration.

Unforutanety Epiphany has separate configuration under separate menu item. I don't know why it is separated from print dialog, maybe to confuse users. Also I have no idea why it has default size Letter. Anyway you can set paper size under Print Setup...

This is really great step for usability.

phpMyAdmin demo back online

After few days of outage, demo server is back running. To avoid possible problems, I now run it under separate vserver. This should limit any impacts of demo server to rest of services running on this host as it provides much better separation than chroot used before.

There still might be some issues with new setup, please tell me about them.

Optimise your code

Especiall if there is chance it will be used on something like OpenWRT. Yesterday I installed Munin on my OpenWRT router. Now I can see that sometimes statistics drop to zero, because it didn't manage to catch them.

I looked for most CPU hungry plugins and those are df_inode and processes. I rememeber that I already had to rewrite df_inode, because it was damn slow, so I only used that version (it should be also somewhere in their tracker, but I can not find it right now).

The processes plugin was also quite easy to optimise, compare old and new code:

 # time find /proc -type d | grep [0-9]$ | tr -d "/proc/" | grep ^[0-9]*$ | wc -l
 real    0m 0.77s
 user    0m 0.28s
 sys     0m 0.39s

 # time ls -d /proc/[1-9]* | wc -l
 real    0m 0.06s
 user    0m 0.04s
 sys     0m 0.00s