Tips for Debian on the FreeRunner

Making the cursor invisible

Using matchbox

Matchbox has an option, use_cursor, that can be used to control whether to show the cursor. For the default setup, edit /usr/bin/zhone-session and change the matchbox command to matchbox-window-manager -use_titlebar no -use_cursor no

Using unclutter

Unclutter is a program that hides the cursor after a period of inactivity. To use unclutter, install it #apt-get install unclutter and choose Yes to the question Start unclutter automatically?. To change settings edit /etc/default/unclutter.

Changing the cursor

To make the cursor invisible create a file called empty.cursor with this content:

#define empty.cursor_width 16
#define empty.cursor_height 16
static unsigned char empty.cursor_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Now you can execute: xsetroot -cursor empty.cursor empty.cursor and the cursor will be invisible. To make this permanent you have to invent something ;) It must be executed after zhone has finished starting up.

Running X applications on your desktop in nested X server

Sometimes it is helpful to have a big screen, keyboard and mouse. You can run X applications in a nested X server window. On your desktop install the nested X server application Xephyr (better that Xnest) apt-get install xserver-xephyr Run a nested X server as display=:1 Xephyr :1 -ac -br -screen 480x640 -reset -terminate & Now you are able to run apps on your Neo which will display on your desktop PC. Make sure to set the display, for example if "mydesktop" is your desktop hostname DISPLAY=mydesktop:1 xfce4-session &

Running X applications directly on your desktop

The major advantage of this method is that it doesn't impose any size restrictions on the application, which makes it very helpful for applications which require a lot of screen space to work properly, eg. synaptic. Edit the file /etc/ssh/ssh_config. In section "Host *" uncomment the "?ForwardX11Trusted yes" entry. Restart dropbear by issuing the command "/etc/init.d/dropbear restart". Now log in to your neo with the following command: "ssh -Y root@freerunner", where freerunner is, as always, the IP Adress of your device. Now any X application you start on the neo will be displayed on the host screen. If you want an application to be displayed on the freerunner screen, use "DISPLAY=:0.0 application".

Simulating right click with stylus

With fbdev driver from xserver-xorg

The official Debian package of xserver-xorg-input-tslib (Version 0.0.5-4 and up) includes an easy way to right click with the stylus. To activate it add a new line to your xorg.conf in the ?InputDevice section.

You also have to change the device specification in your xorg.conf from ?TslibDevice to Device

-        Option          "TslibDevice"           "/dev/input/event1"
+        Option          "Device"                "/dev/input/event1"

In this way, to get a right click you can simply tap and hold the stylus and after a while a right click will occurs.

Warning: tslib patch is incompatible with xserver-xglamo. Use libgtkstylus instead (see below).

With Xglamo driver from xserver-xglamo

# apt-get install libgtkstylus # Insert this line at the beginning of ~/.xsession:export GTK_MODULES=libgtkstylus.so

With xserver-xorg-video-glamo driver from xf86-video-glamo

Same as above, ie. export GTK_MODULES=libgtkstylus.so

Multimedia

mplayer

mp3

For mp3 decoding using less cpu cycles, use -afm ffmpeg or add afm=ffmpeg into ~/.mplayer/config.

This will change the mp3 decoding codec to ffmpeg instead of using the x86 optimized mp3lib.

mp3lib is optimized for mmx/sse3/3dnow, which are cpu extensions of x86 processors. These don't exist on ARM. mp3lib also makes usage of floating point operations and the Freerunner's CPU doesn't have a FPU, so it is very slow. ffmpeg decodes using integers only, which is perfect in the Freerunner's case.

vorbis

For vorbis decoding use "-ac tremor", an integer only vorbis implementation.

Network & FSO stack

Using fso-usaged

Existing ousaged component has known problems. If you want to use the rewritten fso-usaged instead, install it first and change /etc/frameworkd.conf as follows: 1. Change disabled = 0 to = 1 under ousaged 2. Add the following lines, in this order:

[fsousage]
lowlevel_type = openmoko

[fsousage.lowlevel_openmoko]
[fsousage.dbus_service]

Interface performance

Wifi interface will survive packet flooding with only very few cpu usage. If you do the same via USB or Bluetooth your Freerunner will be unusable until you stop the packet flooding. Wifi interface is also the fastest of the 3 methods. So if you plan to transfer big files, you should use wifi if possible.

User Interface

Enlightenment adjustments

Power button menu

openmoko-panel-plugin shows a menu when the power button is pressed; however, frameworkd will also react to the button press and suspend the phone. If you prefer to have the menu, edit /etc/freesmartphone/oevents/rules.yaml and delete or comment out these lines:

-
    #
    # Suspend Handling
    #
    trigger: InputEvent()
    filters:
             - HasAttr(switch, "POWER")
             - HasAttr(event, "released")
             - HasAttr(duration, 0)
    actions: Suspend()

Other

Autosuspend when idle

If you want autosuspend when idle (i.e. only when a call is not going on), edit /etc/freesmartphone/oevents/rules.yaml and add the following lines:

-
    #
    # Autosuspend when idle
    #
    trigger: IdleState()
    filters:
             - HasAttr(status, "suspend")
             - Not(CallListContains("active"))
    actions: Suspend()

NB, this requires freesmartphone.org milestone5.5, check this thread for more information.

Getting Time From GPS

If you want to synchronize the internal clock with GPS time you can use a script like

#
# Set the gps time
# Be sure your GPS is active before to launch this script

import dbus
import subprocess
import time

proxy = dbus.SystemBus().get_object('org.freesmartphone.frameworkd', '/org/freedesktop/Gypsy') # bus name, object name
interface = dbus.Interface(proxy, 'org.freedesktop.Gypsy.Time');
subprocess.call(['date',time.strftime( '%m%d%H%M%Y.%S', time.localtime(interface.GetTime()))])

If you want to synchronize the internal clock with GPS time and use the program gpsd, you can use this script, also you can use it on another computer to synchronize the time. This script synchronize the hardware clock too. Use it like: "program.rb host port" or change the ARGV[0] and ARGV[1] vars.

require 'socket'

if ARGV.size == 0
        ARGV[0]="localhost"
        ARGV[1]="2947"
end

                @gpsserver = TCPSocket.open(ARGV[0],ARGV[1])
                sleep(0.1)
                @gpsserver.puts "r"
                result = ""
                while result[0,6] != "$GPZDA"
                        result = @gpsserver.gets
                end
                if result[7,1] != ","
                        # Software clock
                        system("date -u #{result[20,2]}#{result[17,2]}#{result[7,2]}#{result[9,2]}#{result[23,4]}")
                        # Hardware clock
                        system("hwclock --set --date=\"#{result[23,4]}-#{result[20,2]}-#{result[17,2]} #{result[7,2]}:#{result[9,2]}:#{result[11,2]}\"")
                end
                @gpsserver.close

Remote logging

The phone can be configured to send all log information via UDP to another computer. Remote logging allows the FreeRunner to log events without using up flash memory, and allows to have a log also in case of microSD failures.

Instructions can be found here.

Use a USB keyboard

  1. apt-get install xserver-xorg-input-evdev
  2. Add this (or similar) to /etc/X11/xorg.conf

 Section "InputDevice"
         Identifier      "Generic Keyboard"
         Driver          "evdev"
         Option          "CoreKeyboard"
         Option          "Device"        "/dev/input/event5"
         Option          "XkbRules"      "xorg"
         Option          "XkbModel"      "pc104"
         Option          "XkbLayout"     "fi"
 EndSection
  1. modprobe ohci-hcd
  2. switch to host mode (http://wiki.openmoko.org/wiki/USB_host)

Some also find that a plain

 Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc104"
        Option          "XkbLayout"     "us"
 EndSection

works fine.

Using the mouse and keyboard from your desktop on the OM device

Method 1: xsession export (works with a linux host)

If you are running Linux (or a similar xorg capable operating system) on your Desktop, you can export your xsession to the openmoko device and use your mouse and keyboard on the Neo screen. A little program called x2x makes it even possible to do this simultaneously on the fly. When activated you just move your mouse to the edge of your monitor and then the mouse cursor continues on the screen of your openmoko device. If you select a window on the OM, the input of your keyboard is automatically entered in that window. You can even use the clipboard to copy data from tour desktop to OM and in the reverse direction.

Configure your desktop computer to export your xsession: On your desktop (with root permissions): Make sure that sshd is installed and in /etc/ssh/sshd_config you have set ?X11Forwarding yes

In K/Ubuntu sshd is in the package openssh-server.

On your OM device install x2x (with root permissions):

apt-get install xauth x2x

Now open a new X terminal on your desktop computer. You MUST be the same user that is running the xsession on your desktop (i.e. do not su to root or another user in your x terminal!). Use the same username that is running an xsession on your OM device. Assuming that you have a usb networking connection to OM (with standard configuration) on the user prompt of your desktop type: user@desktop:~$ ssh -X openmoko@192.168.0.202 "/usr/bin/x2x -east -to :0.0" Hit return and enter your password. The xterm window will be unresponsive after that, but keep it open until you disconnect your OM device.

Now move your mouse cursor across the right edge of your monitor. It should enter the screen of your OM device from the left. Of course you can also use -west, -north or -south, depending on your preference where you place your OM.

If computer says: sh: /usr/X11R6/bin/xauth: No such file or directory X11 connection rejected because of wrong authentication. x2x - error: can not open display localhost:11.0

It means you haven't installed xauth on your OM. So on your OM (with root permissions) apt-get install xauth

Method 2: synergy (works with a windows/linux host)

With this method you can have the following functionality: * Mouse moves from screen edge to the next screen * Keyboard types on the focused window * Clipboard is transferred as well * Connect as many computers and screens you wish * Connect windows computers too

All devices/computers in question should be able to install [http://synergy2.sourceforge.net synergy]. Windows computers can use an installer exe. Debian devices have a package ready to be used.

apt-get install synergy quicksynergy

quick synergy will appear in your XFCE programs menu (Accessories->?QuickSynergy). Run it, switch to the "Use" tab, enter the IP address of the computer with the mouse and keyboard you wish to use, and press Execute.

In the windows host, (or linux) run the synergy after installation, and configure it to share its keyboard and mouse(server), configuration is fairly simple, you add all the hostnames of the devices/computers that ever would be joined to the "screens" list, and create 2 links for each connection.

If your desktop's hostname is homepc, and the device's is debian_gta02, and i place the device to the left of the desktop, the links would look like this:

homepc is right of debian_gta02
debian_gta02 is left of homepc

Now move back to the main screen, and press Start.

That should be it, in windows you should have an icon with a yellow lightning in it when synergy is connected and working. Synergy supports connection of more then one screen so one could set up a full lab with only one keyboard and mouse :)