Skip to content
Albert Casals edited this page Jan 7, 2015 · 7 revisions

Dev environment

  1. Make sure you install and start Kano DevBox
  2. Install kdesk using the icon on the desktop desktop
  3. Now you will be able to run and develop kdesk on Kano DevBox!
  4. Open a terminal and type kdesk &

Project details

How to build

Release

From the base directory you can invoke make to build a release version: $ make

Debug

Alternatively, if you prefer to work on further development you should build a debug version: $ make debug

The debug version will inline debug statements across all major operations to easily follow up the code. The debug statements are defined as inlined code, which means they are completely removed on release versions, hence compacting the binary and speeding up the work.

You can easily tell if you are running a debug build because the desktop icons will show a narrow black border. To build the Debian package just execute the following: $ debuild -us -uc

The binaries are self-contained in 2 files: kdesk and kdesk-eglsaver. Their runtime and build dependencies are defined in the file debian/control.

kdesk plays well under Kano OS, Debian-based systems and also on Intel. You can run it on top of a VNC session using Fluxbox or other window managers during testing/development.

Degugging tips

Locating a bug at run time can be quite tricky sometimes. You can tell Linux to save a core dump file for you to inspect the crash afterwards:

  1. edit /etc/sysctl.conf and add the line kernel.core_pattern = /tmp/core-%e-%p
  2. edit /etc/security/limits.conf and add the line * soft core unlimited

Reboot the system. You can easily test it with kill -s SEGV $(pidof kdesk). A dump file will be available under /tmp which you can inspect like this:

$ gdb /usr/bin/kdesk /tmp/core-my-pid

If you use kdesk-dbg instead, you will get a complete source code stacktrace with the bt full command.

Automation tests

When it comes to testing your desktop apps running through kdesk, there is one very useful tool that greatly simplifies the process and avoids having to do it manually. It is also a great choice to prepare interactive GUI sessions and play them back to the audience on a big screen.

Just follow these simple steps:

$ sudo apt-get install xnee

From an ssh session start a recording GUI session

 $ export DISPLAY=:0
 $ cnee --record --mouse --keyboard -o myplayback.xns

At this point all interaction on the desktop is being saved to the file. Once complete just hit Ctrl-C to stop recording. Below is an example to replay a session over and over, including a kdesk icon refresh request after each iteration:

#!/bin/bash

while :
do
        cnee --replay --mouse --keyboard -ns -sp 200 -f myplayback.xns
        sleep 3
        kdesk -r
        sleep 5
done

Screensaver

kdesk-eglsaver is kdesk openGL screen saver. The source files can be found here.

Build

Just type $ make

You will need to change the variable OPTDIR in the Makefile to point to your Raspberry /opt include files and libraries. Usually this is provided by the Raspbian package "raspberrypi-firmware".

Icon RAW format

Icons are in raw byte format, no encoding, for faster load times.

In order to convert the icons for the cube surfaces, they must be 128x128, 3bpp and no alpha channel. To obtain these raw formats use imagemagick and follow these simple steps:

$ convert source.png -resize 128x128! -alpha off clean.png
$ convert clean.png -size 128x128 -endian LSB -flip rgb:source.raw

This gives each bitmap a small size footprint of 45K Bytes.

The default build process will provide 3 sample Kano bitmaps embedded as C array structures, so the binary does not rely on external files and at the same time loads a bit faster.

Building your own screensaver

You can provide your own screensaver program. In such case please keep in mind the following rules to integrate nicely into kdesk:

  • Provide an initial wait delay of approximately 1 second for seamless user experience.
  • Periodically listen for user input events from keyboard/mouse (/dev/input is a good source)
  • Upon reception of user input, just terminate the program and kdesk will take over control
  • If you'd like kdesk to refresh the graphical desktop upon termination, set your return code to 0, any other value will not refresh the X screen.
Clone this wiki locally