Don't set keymap if already set

Henrique de Moraes Holschuh hmh at hmh.eng.br
Fri Jun 8 06:59:58 PDT 2007


On Fri, 08 Jun 2007, Richard Hughes wrote:
> Henrique (thinkpad_acpi maintainer) wanted to make sure we were not
> setting scancode->keycode mappings for keys that had already been
> assigned. We could assign the keys in the kernel driver using dmi

As in: if the event block (stuff beween EV_SYN) does not have a EV_KEY
KEY_UNKNOWN, you are not to use the EV_MSC MSC_SCAN scancode.

> mapping or in userspace by already using setkeycodes in hotkey-setup.

And process any KEY_UNKNOWN using the scan code, yes.

> The attached (untested) patch fixes this, but also has the side effect
> of not letting the use change the fdi file mappings while testing
> without rebooting or reloading the thinkpad_acpi module.

How so? 

> +		evdev_set_keycode (fd, scancode, keycode);

Ah, I see. You are not translating KEY_UNKNOWN by scancode, you are
*remapping* it.  Which IMO is even better :p  but it does have the drawback
you described.

What we really need is a reset-keymap IOCTL, and we need it for security
reasons too.  That would fix most of our problems, even if I still think it
is not the multi-user way to go about it (but it is good enough, if
keyboards are to be programmable only by CAP_SYSADMIN).

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


More information about the hal mailing list