Nokia770 as Plutohome Orbiter

IN PROGRESS …

Introduction

Plutohome – open source home automation system allows to use many devices as Orbiters which give homeowners
possibility to control devices in the home. Plutohome team uses Windows-based WebDav as Orbiters but they are
too expensive. We decided to try Nokia 770 – Linux-based Internet tablet as substitute of WebDav. It’s
compact, high-end and it’s … Linux device. Pluto doesn’t contain a built Orbiter for Linux devices (except onScreen
Media Director’s Orbiters). However, there is an sources for SDL (Simple DirectMedia Layer) Orbiter and Nokia supports
SDL.

Setup Development Environment

To develop applications for Nokia 770 we should setup Maemo SDK. Maemo SDK needs scratchbox
a cross-compilation toolkit for embedded Linux application. There are two ways to install them. The first one is
described step by step in the Maemo SDK Tutorial. But it’s completelly manual installation. The second way is
to download Maemo Development Platform installer and run it:

./installer -S

It asks a couple questions and makes installation and configuration automatically. Only configuration Xephyr will be done manually as it’s described in Maemo SDK Tutorial. There is a one trick on the Fedora Linux. Note that you have to install following packages:

  • shareutils
  • gcc
  • libc6-dev

Before start scractbox you have to run cat 0 > /proc/sys/kernel/vsdo under root if this file contains 1.
Also, I couldn’t configure Xephyr to run in the scratchbox. I run it outside the scratchbox:

#!/bin/sh -e
prefix=/scratchbox/users/${LOGNAME}/targets/SDK_PC/usr
export LD_LIBRARY_PATH=${prefix}/lib; export LD_LIBRARY_PATH
exec ${prefix}/bin/Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac

To test the Orbiter on Nokia 770 emulator you heed a second PC (the first is Pluto Core or Hybrid). It might be good to run Maemo SDK and Plutohome under VMware as on two separate computers. Maemo team recommends to use Debian or Ubuntu. I built Pluto Orbiter under Fedora Core 4 but I couldn’t run it. I Installed VMWare Player, downloaded Ubuntu Browser Appliance Virtual Machine, run it and setup Maemo SDK as it’s described above. Then I started already installed Plutohome Virtual Machine and I could run the Orbiter from Nokia 770 emulator.

Building Nokia 770 Orbiter

Prerequest packages:

  • libsdl-ttf2.0-dev
  • libsdl-image1.2-dev
  • libsdl-gfx1.2-dev
  • libsdl1.2-dev
  • libgle3-dev
  • libsdl-sge-dev
  • libxmu-dev
  • libhid-dev
  • libmysqlclient12-dev
  • libhttpfetcher-dev

Note: if you get an error:
/bin/ld: cannot find -lGLU
check directory /usr/X11R6/lib and make a symlink on libGLU.so.1:
ln -s /usr/X11R6/lib/libGLU.so.1 /usr/X11R6/lib/libGLU.so

To build the Orbiter we should get a plutohome sources and put them in the some scratchbox directory:

svn co http://svn.plutohome.com/pluto/trunk/src plutohome

Before building export variable SNR_CPPFLAGS:
export SNR_CPPFLAGS="-DDEBUG"

Go to directory PlutoUtils and type:
make

Go to directory SerializeClass, modify SerializeClass.h by adding this row
#define MAEMO_NOKIA770 1
and type
make

Go to directory DCE and type
make

Go to directory SDL_Helpers and type:
make

Go to directory Orbiter make following changes:

  • disable xrecording by commenting few lines of code from src/Orbiter/Linux/OrbiterLinux.cpp where m_pRecordHandler appears;
  • re-enable SDL event loop by commenting EventLoop from OrbiterRenderer_Linux (this will enable event processing from its base – OrbiterRenderer – which handles mouse events);
  • comment GrabKeyboard and GrabPoints methods from OrbiterLinux.cpp
  • comment any usage of m_pWinListManager from OrbiterLinux.cpp and OrbiterLinux_Renderer.cpp
  • add this line into OrbiterLinux.h:
    #define MAEMO_NOKIA770 1

and type:
make && make bin

Now the directory lib contains all needed Plutohome libraries and bin – binary SDL Orbiter. To optimize the size of Orbiter we can remove all debug information from it. The command strip do it work perfectly:
strip bin/Orbiter
strip lib/*

Initially the size of the Orbiter was 26596K and the summary size of Pluto libraries was 10224K. After stripping the Orbiter size is 2008K and libraries – 20864K. There is a really big difference especially for device with limited memory.

Using

Now we are ready to run our Orbiter. To do that first add Pluto libraries into LD_LYBRARY_PATH:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
and simple type:
./Orbiter -r <router IP address> -d <device ID>

The SDL Orbiter on the Nokia770 emulator looks like this:

plutohome-nokia770-orbiter
(click to enlarge)

Download

Plutohome SDL Orbiter – binary (792K)

2 thoughts on “Nokia770 as Plutohome Orbiter”

  1. Pingback: Smart Home Blog

Leave a Reply

Your email address will not be published. Required fields are marked *