[ltp] Re: Fn+F5 woes again - solved

Bjørn Mork linux-thinkpad@linux-thinkpad.org
Wed, 18 Nov 2009 13:28:22 +0100


Yves-Alexis Perez <corsac@debian.org> writes:

> Ok, after looking at
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=555050 it seems that
> now you have to do the remapping in udev instead of hal.
>
> Which means:
> - do the job again;
> - no more xml, yeah!;
> - can't put stuff in /etc to override /lib, you have to do that in /lib,
> which sucks
>
> Basically, I edited /lib/udev/keymaps/module-lenovo, replaced 0x04 wlan
> by 0x04 bluetooth, added 0x05 wlan and saved. Then you have to modprobe
> -r thinkpad-acpi and modprobe thinkpad-acpi and it seems to work fine her=
e.

You can still do this in /etc.  There just aren't any default hooks, so
you'll have to create your own.

What I did was copy the parts I needed from
/lib/udev/rules.d/95-keymap.rules to
/etc/udev/rules.d/99-late-local.rules

and change them like this (notice the /etc/udev/keymaps path):

 # this part is taken from /lib/udev/rules.d/95-keymap.rules
 ACTION!="add", GOTO="keyboard_end"
 SUBSYSTEM!="input", GOTO="keyboard_end"
 KERNEL!="event*", GOTO="keyboard_end"
 
 ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}"
 ENV{DMI_VENDOR}=="", GOTO="keyboard_end"
 
 ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name /etc/udev/keymaps/module-lenovo"
 
 LABEL="keyboard_end"



This makes udev first load the default /lib/udev/keymaps/module-lenovo
and then my modified /etc/udev/keymaps/module-lenovo, enabling me to put
only my local changes into the latter:

 bjorn@nemi:~$ cat /etc/udev/keymaps/module-lenovo 
 # local overrides
 0x4 bluetooth # Fn+F5


Note that udev process the rule files in lexical order independent of
which directory they are found, ref udev(7).  This makes it easy to do
local overrides.

Another useful udev feature is that duplicate file names are ignored,
and /etc/udev has precedence over /lib/udev in case of ducplicates.
I.e., you could copy /lib/udev/rules.d/95-keymap.rules to 
/etc/udev/rules.d/95-keymap.rules and modify it there.


I do believe the change from hal to udev(-extras) is the way to go.,
hopefully getting rid of hal without copying all the bloat - please help
the udev maintainers with that!  But the transition could be handled
more seemlessly.  It should be possible to provide udev/keymaps hooks in
/etc and write a migration script, attempting to keep any local hal
configurations.

But that's easy to say.  One could also ask why I don't just provide a
patch...



Bjørn