Don’t work when you’re tired.

I did the following things in the past few days: fix a stupid typo that ruined everyone's build...
diff --git a/packages/opkg/ b/packages/opkg/
--- a/packages/opkg/
+++ b/packages/opkg/
@@ -23,8 +23,8 @@ echo "#!/bin/sh
 if ! test -f /etc/.configured; then
        opkg-cl configure
-" > $D$/{sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}
-chmod 0755 $D$/{sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}
+" > $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}
+chmod 0755 $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}
 test -f $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure && rm -f $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure

 update-alternatives --install ${bindir}/opkg opkg ${bindir}/opkg-cl 100

and, on my own computer, I wanted to do:
tar zxf openmoko-asu-image.tar.gz -C /mnt
but instead I did:
tar zxf openmoko-asu-image.tar.gz -C /
So I have to reinstall debian…

udev and allow-hotplug on ubuntu and debian

I finally got bothered enough to fix the /etc/network/interfaces problem on my Ubuntu notebook. The problem is that when my neo got connected, I want to do some automatic setup. On Debian lenny, it’s quite easy:

allow-hotplug usb0
iface usb0 inet static
        post-up iptables -t nat -A POSTROUTING -s -j MASQUERADE
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        pre-down echo 0 > /proc/sys/net/ipv4/ip_forward
        pre-down iptables -t nat -D POSTROUTING -s -j MASQUERADE

But on Ubuntu gutsy it doesn’t work. I have to replace “allow-hotplug” by “auto”. Even if I changed that, it will only work for the first time you plugged the device. That’s because of a bug listed here. The solution is to remove the DRIVER=”?*” in /etc/udev/rules.d/85-ifupdown.rules .

Now, finally, if works even after multiple plug/unplug. However, there is still one problem left: “auto usb0” basically means the system will try to bring up the device during booting. It works for “lo”, the local loopback network interface because it’s always there. But the usb0 won’t be there everytime we boot. That causes some error messages. My solution is to modify /etc/udev/rules.d/85-ifupdown.rules again, replace “auto” by “hotplug”, and use “allow-hotplug usb0” in my /etc/network/interfaces . The final 85-ifupdown.rules looks like this:

# This file causes network devices to be brought up or down as a result
# of hardware being added or removed, including that which isn't ordinarily
# removable.
# See udev(7) for syntax.

SUBSYSTEM=="net", GOTO="net_start"


# Bring devices up and down only if they're marked auto.
# Use start-stop-daemon so we don't wait on dhcp
ACTION=="add",          RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup -- --allow hotplug $env{INTERFACE}"

ACTION=="remove",       RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown -- --allow hotplug $env{INTERFACE}"


Some further digging shows the difference between debian lenny and ubuntu gutsy in the handling of the “interfaces” file. On Debian:

john@buddha:/etc/udev/rules.d$ grep net.agent *
80-drivers.rules:SUBSYSTEM=="net",                              RUN+="net.agent"

so it runs net.agent, a script under /lib/udev/ to bring up the interfaces. On Ubuntu, this is simply the job of the 85-ifupdown.rules above.

Using Neo Free Runner as Daily Phone

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@
  • 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