Archive for December, 2009

Jaunty Keyboard Layout Settings

December 28th, 2009 subogero Comments off

As I’ve mentioned my laptop came with a Hungarian keyboard, which will be changed to a US version as soon as the part arrives (6 weeks). In the meantime I’m trying very hard to live with this one. I’ve learned to use the awkward Alt-Gr key to access trivial characters like backslash, tilde or square brackets.

But there are limits. The “qwertz” stuff. The swapped “z” and “y” keys. It’s an abomination. So I went to System/Preferences/Keyboard and I found an abundance of layout settings Windows users can’t even dream of. Of course there is a Hungarian “qwerty” layout. Many, actually. When you choose a layout you get an illustration of the entire keyboard. So it was not difficult to find variant “Hungary 102/qwerty/comma/Dead keys”.

However wonderful this nice GUI for keyboard settings is, it suffers from a general illness of Linux GUI programs. They are fantastic but, in the absence of enforced corporate QA, they never get finished. This one is not finished either. The “Apply System-wide” button has stopped working. So the login screen has been still using a “qwertz” layout.

Until now. But “Config Wizard” has solved it. All these GUIs are just smart config-file editors. But never as smart as a text editor. I guess that’s the main reason those GUIs are never finished. You develop them and, at 90% completness, you realise any text-editor is better.

Anyway, this is the location of the keyboard layout config files:



System-wide (login screen):


ASUS UL20A Brightness Buttons

December 24th, 2009 subogero 10 comments

As I’ve mentioned before, ubuntu 9.04 Jaunty has been running fine on my ASUS UL20A laptop. Except the screen brightness buttons, Fn-F5 (down) and Fn-F6 (up).

Fn-F5 was setting brightness to the darkest value while Fn-F6 to the second darkest one. I’ve managed to create a crufty workaround, detailed below. It’s all about hacking the configuration of acpid (the ACPI daemon).

Set Brightness Directly

There is a special file called /proc/acpi/video/VGA/LCDD/brightness which lists the available and the actual brightness values. Brightest is shown below.

szg@OG3:/proc/acpi/video/VGA/LCDD$ cat brightness
levels:  10 16 22 28 34 40 46 52 58 64 70 76 82 88
current: 88

Setting brightness is done by writing a number into this file, the example shows darkest possible.

echo 10 > /proc/acpi/video/VGA/LCDD/brightness

Explore What Events the Brightness Keys Generate

Start the program called “acpi_listen”, which will print power-management related events when they happen.

When hitting Fn-F5 (Brightness down):

video LCDD 00000087 00000000
hotkey ATKD 00000020 000000fc

When hitting Fn-F6 (Brightness up):

video LCDD 00000086 00000000
hotkey ATKD 00000011 00000106

So each hotkey generates two events. Now let’s see how these events are handled. (Hard to see, as by now the screen is very dark. Bugger.)

Configure How acpid Handles Events

The configuration of “acpid” is in the “/etc/acpi/events” directory. Each file here handles one event type, line “event=regexp” defines the event, where the regexp shall match something like above, while line “action=command” the callback.

Fn-F5 (down) video LCDD 00000087 00000000 is handled by file “video_brightnessdown”:

event=video.* 00000087

Fn-F5 (down) hotkey ATKD 00000020 00000000fc is handled by “asus-brightness-down”:

event=hotkey (ATKD|HOTK) 0000002[0123456789abcdef]

Fn-F6 (up) video LCDD 00000086 00000000 is handled by file “video_brightnessup”:

event=video.* 00000086

Fn-F6 (up) hotkey ATKD 00000011 0000000106 is handled by “asus-brightness-up”:

event=hotkey (ATKD|HOTK) 0000001[0123456789abcdef]

As you can see the callback scripts are in “/etc/acpi”.

Test the acpid Callback Scripts

Running all four callback scipts directly from the command line revealed they don’t work at all. Absolutely no effect on brightness. That’s why I now ignore their contents completely.

The test revealed something else as well: the broken function of both hotkeys comes from outside of this acpid-config mechanism. Probably the kernel. Which I won’t try to fix, I’ll just create a workaround.

The Fix

I linked the fixed callbacks to the second event for each hotkey, “hotkey ATKD 00000020″ (down) and “hotkey ATKD 00000011″ (up). Configured by “asus-brightness-down” and “asus-brightness-up”, respectively. I’ve removed the other two config files (video_brightnessdown/up) completely, which were handling the first event for each hotkey.

The new callback script for brightness down reads the actual value from a new config file (/etc/acpi/brightness), decrements it by 6, and stores it to the config file AND the “/proc/acpi/video/VGA/LCDD/brightness” file as well.

if [ ! -f /etc/acpi/brightness ]; then echo 88 > /etc/acpi/brightness; fi
BRIGHTNESS=`cat /etc/acpi/brightness`
if [ $BRIGHTNESS -gt 10 ]; then let BRIGHTNESS-=6; fi
echo $BRIGHTNESS > /etc/acpi/brightness
echo $BRIGHTNESS > /proc/acpi/video/VGA/LCDD/brightness

The new brighness up script is similar, just increments the value by 6.

if [ ! -f /etc/acpi/brightness ]; then echo 88 > /etc/acpi/brightness; fi
BRIGHTNESS=`cat /etc/acpi/brightness`
if [ $BRIGHTNESS -gt 10 ]; then let BRIGHTNESS+=6; fi
echo $BRIGHTNESS > /etc/acpi/brightness
echo $BRIGHTNESS > /proc/acpi/video/VGA/LCDD/brightness

The final touch: the callback script for AC/battery events ( also writes the config file to guarantee we always start changing the brightness from the actual value.

for x in /proc/acpi/ac_adapter/*; do
  grep -q off-line $x/state

  if [ $? = 0 ] && [ x$1 != xstop ]; then    
    for SCRIPT in /etc/acpi/battery.d/*.sh; do
    . $SCRIPT
    echo 52 > /etc/acpi/brightness
    echo 52 > /proc/acpi/video/VGA/LCDD/brightness
    for SCRIPT in /etc/acpi/ac.d/*.sh; do
    . $SCRIPT
    echo 88 > /etc/acpi/brightness
    echo 88 > /proc/acpi/video/VGA/LCDD/brightness

Now, when hitting the brightness hotkeys, the screen switches to the darkest setting for a moment, but then it works. Perfect. Nearly.

Why Karmic Koala Sucks 3

December 19th, 2009 subogero Comments off

Movies. Or at least one of them to be precise. I have an avi file which is played like a breeze in Jaunty, but it crashes Mplayer in Karmic immediately.

Scanners. There is no more “scanner” group, so you have to manually sudo chmod 666 the scanner device before using. Otherwise the driver simply does not detect the device. And this is a Canon scanner, where a Linux driver is kindly supplied from the factory.

On the positive side, the bloke with the scanner problem is the same colleague who nearly gave up last time. He did not. He managed to install Karmic eventually. But he will replace it with Jaunty.

There is an ever increasing ubuntu user group at the office, and the general consensus is that Karmic is to be avoided. I apologise again for the rude title, but if you’re not a kernel wizard, avoid Karmic. It is probably very nice, but one thing it is not: Linux for human beings.

Categories: Uncategorized Tags: ,

Ubuntu 9.04 Jaunty on Asus UL20A

December 11th, 2009 subogero 7 comments

I’ve just purchased an ASUS UL20A-2X022V notebook. Or netbook. I don’t know. It’s actually the best of both worlds. On one hand, it has a small 12″ display, weighs in at 1.5 kg, has no CD/DVD drive, and runs 5 to 7 hours on battery. On the other hand, its small display’s resolution is 1366×768, it has a Core 2 Duo ULV SU7300 processor, 3 GB RAM, a 320 GB hard disk and a fully functional keyboard with all the special keys on the right side.

A short summary of how the different hardware components work with ubuntu:

Component                    Status  Notes
Intel Core2 Duo ULV SU7300   OK
12.1" WXGA LED display       OK      resolution autodetected
Intel GMA 4500MHD graphics   OK
3 GB RAM DDR2 800 MHz        OK
HD 320 GB 5400rpm SATA       OK      install with manual partitioning
battery Li-ion 5600 mAh      OK
power management             OK      battery life 5-6 hours
ethernet Atheros 8131        OK      see below
WLAN Atheros 9285 802.11bgn  OK      see below
Bluetooth                    OK
Sound AC'97 16bit            OK      Audacious mp3, speaker or headphone
Synaptics touchpad           OK      scrolling OK too, see below
webcam                       OK      see below
card reader                  OK
Linux kernel                 2.6.28-17

It came with Windows 7 Home Premium, which is a joke. A huge monster of an OS with the functionality of Google Chrome OS: it has a web browser.

First thing was to install ubuntu 9.04 Jaunty Jackalope. As the laptop has no CD drive I had to create a bootable Ubuntu 9.04 LiveUSB on my other ubuntu-box. The tool to use is usb-creator, which uses the iso image of the ubuntu LiveCD.

I installed ubuntu with manual partitioning. I shrank the Win7 partition from 80GB to 50GB (automounted to /windows), added a 2GB ext3 swap partition, a 50GB ext3 root partition and the rest as a /home partition. The boot menu was added, and even Win7 ran fine after a chkdisk.

The network cards were not detected upon installation. Neither LAN, nor WLAN. So there I was with no connectivity, reading with a sad irony all those posts about fixing this with apt-get xxx-backports and the likes.

I ended up downloading compat-wireless-2.6.30.tar.bz2 on another box to a USB stick, and then unpacking and compiling it on the laptop. I realised too late these kernel modules were for a newer kernel. Nevertheless I did “make install”, I did “make unload” and I did “insmod ath9k.ko”. It did not work due to incompatible kernel versions. I sadly rebooted to Windows, but later gave it another try. Miraculously, all network cards worked like a breeze! Don’t ask me why…

Touchpad: everything works, but it’s hard to feel where is the scrolling area. And the left button is too hard.

Keyboard (Hungarian): OK, but it will be swapped for a US layout, whose Hungarian is worse, but speaks better Code.

Webcam: I installed the UCview package to record videos with it. Skype works too.

I downloaded all the updates, then SynapticPackageManaged Rhytmbox/Evolution out, Audacious/Thunderbird in, I installed basic development stuff, and last but not least git-cloned and compiled the newest Midnight-Commander master with utf8-support.

One more thing: it is very very quiet. Summary? Bloody marvelleous!

Linux On Laptops

Categories: Uncategorized Tags: , ,

Why Karmic Koala Sucks 2

December 9th, 2009 subogero Comments off

A friend of mine in the office, who was a bit fed up with Windows’ slowness and vulnerability at home, tried to install Ubuntu Karmic Koala last night.

It took him some time to overcome a Raid-connected PATA hard-disk first. But finally Karmic was installed. It just did not boot. It took ages to show the boot menu (if at all) and, after selecting Linux, the best performance was continuous reboot.

The new superfast Grub2  bootloader is apparently to blame. The goal was to create a faster bootloader. The results?

  • If you update from Jaunty, Karmic admits a full bootloader update is too risky, so you get some kind of hybrid, which is half a minute slower
  • If you make a fresh Karmic installation, it just does not work

Apparently, many people in the office are having these problems. Is there anybody out there  who is happy with Karmic?

Sadly, the conclusion of my colleague is that “this is NOT the beginning of a beautiful friendship” with free software. They will stick with Windows. However hard I tried to convince him to have a go with Jaunty.

Categories: Uncategorized Tags: ,