Differences between revisions 15 and 16
Revision 15 as of 2009-08-27 10:23:08
Size: 12957
Editor: Timo Jyrinki
Comment:
Revision 16 as of 2009-08-27 11:37:16
Size: 14470
Editor: Timo Jyrinki
Comment: gps to here
Deletions are marked like this. Additions are marked like this.
Line 163: Line 163:
== Other === == Other ==
Line 185: Line 185:

=== Getting Time From GPS ===

<<Anchor(GPS)>>

If you want to synchronize the internal clock with GPS time you can use a script like
{{{
#!/usr/bin/env python
#
# 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.

{{{
#!/usr/bin/env ruby

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
}}}


Line 191: Line 242:
== Using the mouse and keyboard from your desktop on the OM device ==
=== Method 1: xsession export (works with a linux host) ===
=== Using the mouse and keyboard from your desktop on the OM device ===
==== Method 1: xsession export (works with a linux host) ====
Line 220: Line 271:
=== Method 2: synergy (works with a windows/linux host) === ==== Method 2: synergy (works with a windows/linux host) ====

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.

  • Option "?EmulateRightButton" "1"

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 <code>xserver-xglamo</code>. Use <code>libgtkstylus</code> 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

???

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 decding using less cpu cycles libvorbisidec should be used. But due to a Debian packaging bug (#506244) mplayer is currently not linked against it.

Since the mplayer maintainer is the sponsor of one of my Debian packages I asked him to fix this issue by adding "libvorbisidec-dev" to mplayers build dependencies. He said he will give it a try and if it works, the next mplayer version in main will support integer only vorbis decoding :) -- Sebastian Reichel (23.07.2009 03:07 CEST)

Network

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

  • By default, the AUX button is not configured to lock the screen. I changed this by going to Settings => Input => Keybindings. Highlight the first entry, click Modify Key, then press the AUX key. Set it to execute "Desktop Simple Lock". (by John Sullivan)

  • Additionally, you can remove the "Lock" entry from the system menu, which will lock you out without a chance to enter your keyboard. To do so, install libeet-bin, and run

    eet -d ~/.e/e/config/illume/e.cfg config /tmp/config
    Then edit the file /tmp/config and remove the part
      group "syscon.actions" list {
        group "E_Config_Syscon_Action" struct {
          value "action" string: "desklock";
          value "button" string: "button";
          value "icon" string: "system-lock-screen";
          value "is_main" int: 1;
        }
      }
    Now run
     eet -e ~/.e/e/config/illume/e.cfg config /tmp/config 0
    and restart e17.
  • To allow enlightenment to suspend via FSO, make this setting in /etc/enlightenment/sysactions.conf:

    action:   suspend   mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.Suspend
  • To make the keyboard automatically pop up when using a gtk application (including vala-terminal) or zhone, install matchbox-keyboard-im.

  • To make the power button available to X applications, and especially to bind it to an e17 action, save this file to /etc/hal/fdi/policy/powerbutton-evdev.fdi.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <deviceinfo version="0.2">
      <device>
        <match key="info.product" contains="PCF50633 PMU events">
          <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
                 string="Linux">
            <merge key="input.x11_driver" type="string">evdev</merge>
          </match>
        </match>
      </device>
    </deviceinfo>

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

  • Add 'quiet' to the kernel command line for a faster boot
  • If you need to use swap, adding vm.swappiness = 30 (or even lower values) to /etc/sysctl.conf may help in having a more responsive phone. What would be an optimal value?

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.

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 :)