適合行動裝置的中文字型

Droid 在設計伊始就以行動裝置為目標,在 Android 上頗受好評。基於其上有些中文字型正在發展,其中之一為文泉譯的微米黑。事實上文泉譯原本的正黑體在 freerunner 上看起來就已經蠻不錯了。一時找不到數位相機,截張圖充數:

Advertisements

Don’t work when you’re tired.

I did the following things in the past few days:

opkg_svn.bb: fix a stupid typo that ruined everyone's build...
diff --git a/packages/opkg/opkg_svn.bb b/packages/opkg/opkg_svn.bb
--- a/packages/opkg/opkg_svn.bb
+++ b/packages/opkg/opkg_svn.bb
@@ -23,8 +23,8 @@ echo "#!/bin/sh
 if ! test -f /etc/.configured; then
        opkg-cl configure
 fi
-" > $D$/{sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure.sh
-chmod 0755 $D$/{sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure.sh
+" > $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure.sh
+chmod 0755 $D/${sysconfdir}/rcS.d/S${OPKG_INIT_POSITION}configure.sh
 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…
DON’T WORK WHEN YOU’RE TIRED!

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
        address 192.168.0.200
        netmask 255.255.255.0
        post-up iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -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 192.168.0.0/24 -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"
GOTO="net_end"

LABEL="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}"

LABEL="net_end"

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