Bightness laptop keys regression in gutsy (bug 145337)

Luka Renko lure at
Sun Dec 2 08:45:20 GMT 2007

Posting this to kubuntu-devel@, so that other people can participate. 

On Thursday 29 November 2007 12:51:17 you wrote:
> I'm no KDE expert but if you can tell me which KDE files should be looked
> at I would be glad to help sort the Brightness keys problem of Bug 145337.
> This is a serious bug for many laptop users because we can't recover from
> suspend when using KDE. Everything works fine in Gnome though. So it could
> be just a matter of copying a few lines from Gnome into KDE.

Yes, the test packages I have prepared for thsi bug [1] did not work, which 
was a suprise for me, as other keys (for example battery key on my HP 
laptop), works by using more or less the same method. Test binaries for gutsy 
are in my PPA [2] and source of the changes is here [3], but as already 
confirmed by several people, they do NOT work. As I do not have appropriate 
HW to test, it is a bit hard to debug this further.

Why regression in gutsy: because brightness keys were handled completely in 
the kernel before, but with gutsy kernel this have changed. Proper fix was 
done for gnome-power-manager (just before gutsy release), but not for 

How do we handle laptop keys in Kubuntu:

1. Linux kernel ensures proper keycode assignment for all laptops

2. Kubuntu maps known keycodes to xkeysym
This is done by Xsession script [4], which uses mappings defined in xmodmap 
file [5].

3. kmilo sets KGlobalAccel actions for xkeysym
Some actions are performed by kmilo (lock screen, eject CD...), while others 
are communicated to other processes via dcop.

In the case of brightness keys, we have added the mappings and changed kmilo 
to call appropriate dcop calls (as confirmed in bug [1]), but this does did 
not work. 

What can go wrong here:

1. Kernel does not generate the keycode
Not the case, as "xev" command shows keypress and keycode.

2. Mapping to xkeysym does not work
Not the case, as "xev" shows appropriate xkeysym after mapping

3. kmilo KGlobalAccel does not catch xkeysym action
Very hard to debug, but we could test different mappings just to check if 
there are some limitations on which xkeysym work. 

4. kmilo dcop call to guidance-power-manager does not get through
dcop calls work when tested, but it may be that they cannot be delivered for 
some reason. Probability is low, as similar dcop work on my laptop for 
battery key (just different xkeysym and dcop call).

In order to debug this furher, I would first focus on point 3. I will write 
some debugging ideas on separate e-mail.


[4] /etc/X11/Xsession.d/80ubuntu-xmodmap
[5] /usr/share/apps/kxkb/ubuntu.xmodmap

More information about the kubuntu-devel mailing list