Asleep from Day

August 29, 2008

Using Neo Free Runner as Daily Phone

Filed under: Openmoko — John @ 5:54 pm

NOTE: The illume info is outdated now. Just opkg install illume-theme-illume and modify /etc/enlightenment/default-profile to get the wrench and qwerty buttons.

I used the Om2008.8-update as the base image, then modify it for daily usage.

First of all I would like to use the illume default keyboard instead of the qtopia one because it gets a full-qwerty layout and it’s more suitable for terminal application. It also gives me access to illume configuration besides of the default ‘Settings’ application, which is not enough for advance usage. To do this, you need to switch to the testing repository.

  • backup the original /etc/opkg directory. cp -r /etc/opkg /etc/opkg.orig
  • replace all urls under /etc/opkg to the testing repository

Then remove all the illume related packages and install the new ones.

  • opkg list_installed | grep illume | awk ‘{print $1}’ | xargs opkg -force-depends remove
  • opkg update; opkg install illume-theme-asu; opkg install illume
  • opkg list_installed | grep libe | grep cvs | awk ‘{print $1}’ | xargs opkg install

Now delete the old configs and switch to the illume default profile.

  • rm -rf ~/.e
  • replace ‘asu’ by ‘illume’ in /etc/enlightenment/default_profile

Prevent the qtopia keyboard from showing up:

  • Add “export QTOPIA_NO_VIRTUAL_KEYBOARD=1″ into /etc/X11/Xsession.d/89qtopia

The second thing I did is to lower the volume of gsm handset. The original setting is so loud that everyone around me can hear the caller talking.

  • (call someone)
  • run alsamixer
  • scroll to the right end, lower the “Speaker” volume. You can do this while talking to test the value.
  • alsactl store -f /usr/share/openmoko/scenarios/gsmhandset.state
  • (hang up)

I also need Chinese font so I can read the sms messages.

  • (on host) scp <chinese_font.ttf> root@192.168.0.202:
  • mv ~/<chinese_font.ttf> /usr/share/fonts/truetype
  • vi /opt/Qtopia/etc/default/Trolltech/qpe.conf , find [Font], change FontFamily[] to the name of the ttf. (not the filename)

Change back to the default om2008.8 repository.

  • mv /etc/opkg /etc/opkg.testing
  • mv /etc/opkg.orig /etc/opkg

Reboot.

August 27, 2008

git clone –mirror

Filed under: scm — John @ 6:39 pm

It seems there will be a new option for git-clone, ‘–mirror’. The command line

$ git clone --mirror $URL

is now a short-hand for

$ git clone --bare $URL
$ (cd $(basename $URL) && git remote add --mirror origin $URL)

Refer to http://kerneltrap.org/mailarchive/git/2008/8/2/2793244 about this.

This is extremely useful if you need to check the contents of different branches in different directories at the same time. Each directory will be a local git clone -l -s, and git push will use –mirror as well by default.

August 20, 2008

bug in python-opengl + mesa

Filed under: C, OpenGL, python — John @ 6:52 pm

Since like forever, I have never succeed in executing python-opengl demos on debian lenny.  It always segfault during glutInitDisplayMode.  After some debugging, here is why.

One should be able to call glGetError at any time.  If there’s nothing wrong, it should just return something like GLNOERROR.  Any raw (native) function call in python-opengl, no matter it belongs to GL, GLU or GLUT, will always call glGetError right after each call to check for error.  I think this is wrong since functions like glutInitDisplayMode have NOTHING to do with glGetError.  With mesa 7.0.3-5 in my system, the call to glGetError without glInit will cause segfault.  I check the same thing on Ubuntu, which has an older version of mesa and python-opengl, and it does not happen.

python-opengl enabled error checking by default with OpenGL.ERROR_CHECKING, which is set to True in OpenGL/__init__.py.  This code snippet can disable it:

import OpenGL
OpenGL.ERROR_CHECKING = False
# import other stuffs such as OpenGL.GL, etc.

or you can just modify the __init__.py to disable it by default.

Given the current status of python-opengl and low level x protocol support in python, I think the best language to do 3D in FOSS world will still be pure simple C.

August 5, 2008

oprofile

Filed under: system — John @ 12:05 pm

First you have to enable oprofile in your kernel, i.e. you must have

CONFIG_PROFILING=y
CONFIG_OPROFILE=y

in your kernel config. Then you need userspace utilities to use it. I used oprofile 0.9.4. First of all you need to setup it with something like

opcontrol --init
opcontrol --no-vmlinux
opcontrol --callgraph=5

After that, here is the script I used to do profiling against a program:

john@buddha:~$ cat bin/profile
#!/bin/sh

which sudo && SUDO=sudo || SUDO=

${SUDO} opcontrol --shutdown
${SUDO} rm -rf /var/lib/oprofile/*
${SUDO} opcontrol --status
${SUDO} opcontrol --start-daemon
${SUDO} opcontrol --start
$@
${SUDO} opcontrol --stop
${SUDO} opcontrol --dump
${SUDO} opcontrol --shutdown

Use ‘profile <the name of your executable>’ to get the profile. Use ‘opreport’ to read the result. ‘opreport -l’ might be more meaningful. You can use ‘opreport <the name of your executable>’ to only get the result related to your program, but personally I prefer to check the whole system.

Blog at WordPress.com.