Tuesday, May 1, 2012

Linux 3.4 on the Alix 2d3

After proper support for the ALIX LEDs got into mainline in 3.3, the ALIX GPIO button support found its way into 3.4. Hoooray! So now it's finally possible to have GPIO + LEDs + button, with vanilla upstream and done the proper way. For this I enabled the input subsystem in the config. So, you should see the button as /dev/input/event0. It generates an EV_KEY with code KEY_RESTART. You can test that with evtest. (Debian package evtest, or get the sources from git://anongit.freedesktop.org/git/evtest.)
Here is the 3.4.0-rc5 config. So far 3.4 is only RC.
If you prefer a more stable version, here is a 3.3.4 config. This config also comes with the input subsystem and polled GPIO enabled, but the GPIO button patch is not included in 3.3. If you want it, apply the patch on top of 3.3.
As always, use these as a working starting point, but you certainly want to fine-tune these to your setup.

Tuesday, April 3, 2012

Adding support for more characters in Android

Just a short summary of http://www.mydigitallife.info/how-to-install-and-add-hebrew-arabic-and-unsupported-language-fonts-to-android-phone/.

For ICS the coverage is better, IIRC, so this issue is hopefully getting less topical with time. But if you run Android 2.3 (Gingerbread) on your phone, then you might find this useful.

If you happen to want to display characters that are not covered by the default android font, there seems to be an easy way around. That is - if it's only the font coverage that's the issue. I have no idea to what extent does Android support more complex writing systems, like Devanagari.

The trick works by replacing /system/fonts/DroidSansFallback.ttf by some other font. It seems that DejaVu Sans is be favoured. If you're on Debian or Ubuntu you probably have it installed already (package ttf-dejavu) in /usr/share/fonts/truetype/ttf-dejavu/ (use DejaVuSans.ttf). If not you can always grab it from the project's sourceforge page.

Oh, and you need root. <rant>But why wouldn't the user have root acces to his/her device, right? After all they bought it and own it. At least they might think so...</rant>

So, a bit condensed and cleaned up instructions (for adb):
  1. remount /system read-write: adb shell mount /system -o remount,rw
  2. copy the font file to /system/fonts on the target: adb push $PATH_TO/DejaVuSans.ttf /system/fonts (obviously, replace $PATH_TO with wherever your DejavuSans.ttf is on your PC)
  3. backup original DroidSansFallback.ttf: adb shell mv /system/fonts/DroidSansFallback.ttf /system/fonts/DroidSansFallback.ttf.original
  4. symlink your new font to DroidSansFallback.ttf: adb shell ln -s DejaVuSans.ttf /system/fonts/DroidSansFallback.ttf
  5. restart you phone

Note to self: if the Droid font as supplied on the ICS has wider -- and sufficient for whatever one wants to display -- coverage, it might be better to just use that

Thursday, January 19, 2012

Using NetworkManager from the command line

As much as Network Manager can be annoying at times, it's often quite useful, especially if your network configuration is not fixed.

But what if you can't boot into X for whatever reason, or if for some reason you can't start nm-applet or equivalent? If you leave network setup to NetworkManager, you have no network now. This also means no way to google for help. :-)
You can find many guides telling you to just configure the network yourself. If it's a wired network this is quite easy (with DHCP just dhclient eth0 would often just do the right thing). But for wireless networks this gets more complicated. So you might be advised to use iwconfig (for open or WEP networks), or wpa_supplicant (for all).

But if you already have the network configured in NetworkManager (and the NetworkManager service is running, or you manage to start it), I suggest you just use that. There's a command line utility to interact with the NetworkManager, called nmcli.

Here are the basic usecases you might need:

nmcli con list
lists all the configured networks NetworkManager knows about; notice the columns NAME and UUID.

To bring up a connection use either:
nmcli con up id NAME
yes, I also find it a bit confusing - but you really are supposed to put a value from the name column after the id :-), e.g. nmcli con up id MyNetwork
nmcli con up uuid UUID
you normally don't need to use this

To bring a connection down use down instead of up.

For more details see man nmcli, and nmcli --help.

Tuesday, January 17, 2012

Linux 3.2.1 on ALIX 2d3

It's that time of the year again... Here is a linux 3.2.1 config file for ALIX 2. It's a basic config. It includes upport for the integrated Ethernet, USB, GPIO and watchdog. Also included is WiFi stack + an Atheros card, but you probably want to change this to suit your needs. Compared to the 3.0 version, this has working LEDs thanks to the new platform driver by Ed Wildgoose. The button should be accessible via raw gpio, but not via the evdev interface. Hopefully the platform driver will be extended to cover this, but this requires an GPIO evdev driver first.