Monthly Archives: May 2010

N900, Erminig and Google Calendar – the battle for the battery

The latest N900 update (PR1.2) is already history – some are happy (like me) others are completely devastated. I, like many others, decided to make full reset of the device, as was abusing it allot. This meant that the new firmware together with the latest eMMC contents was reflashed. After that I’ve started fresh to reconfigure my device, and following the KISS approach, I wanted to restore only the apps that I really use. Having that in mind there was one thing that really bugged me – MfE. It was used only to sync my Google Calendars through nyevasync and in order to be always in sync I had to enable autoconnect WiFi – that way the calendar was able to sync on the given interval of time. But staying always online drains the battery allot. Maybe this is the biggest power drain source together with the 3G connectivity. Clearly a solution that connects-syncs-disconnects would be greatly appreciated. Below you’ll find the way I did it.

The first thing I’ve needed was an alternative to MfE  – I don’t like the sync-only-one calendar with google and the fact that I have a Exchange Mail account that just sits in my Modest configuration. As always the maemo community helped and thanks, thanks, thanks to lorelei from – I was able to use Erminig for that purpose. The application in the current stage is quite feature complete IMHO. It offers syncing in both directions for local calendars to/from Google calendars and supports *multiple* calendars. The other great thing about Erminig is that you can sync from command line 🙂 which opens the path to quite simple script implementing the connect-sync-disconnect philosophy. The script itself is quite simple. It respects the situations in which the WiFi was already active – it drops the connection only when it was initiated from the script itself:


# Autor: Todor Tsankov (2010)
# 2010-05-28 - initial release


# check for existing wifi connectivity
if [ "$(/sbin/route | awk '/au/ {print $1}')" == "default" ]; then
  for i in $(seq 1 $RETRIES); do
    # try to connect to any known wifi dbus-send --system --type=method_call /com/nokia/icd string:"[ANY]" uint32:0
    sleep 20
    if [ "$(/sbin/route | awk '/au/ {print $1}')" == "default" ]; then

if [ "$CONNECTED" == "true" ]; then
  # sync erminig if having connectivity
  /usr/bin/erminig -a

  # sync MfE
  # dbus-send --print-reply --type=method_call --session /com/nokia/asdbus

  sleep 5

  # drop the wifi connection if it was initiated by this script (saves battery)
  if [ "$DROPCONN" == "true" ]; then dbus-send --system /com/nokia/icd_ui boolean:true

All that is left now is to save that script somewhere and invoke it in certain interval of time – how you’ll do it – it’s up to you. You can invoke it manually through X-terminal and tools like “Desktop Command Widget” or automate it with tools like Alarmed and fcron.

MfE comment: As you can see the MfE can be forced to sync from command line also, so if you prefer it, but still would like to minimize your wifi usage and optimize battery life – just comment erminig sync line and uncomment the MfE one.

Warning: the script is it’s infancy and although it makes some state checks it may misbehave.

Tagged , ,