# disable certain keyboard events

## skunk

hi!

sice a very long time i'm having an issue with dpms on a crappy msi laptop: the display backlight turns off just for a very short time then it turns back on.

it turns out it's caused by some keyboard events trigged when the backlight turns off, so when i execute:

```
xset dpms force off
```

 i get the following key events:

```
# showkey

kb mode was RAW

[ if you are trying this under X, it might not work

since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...

keycode 224 press

keycode 224 release

keycode 225 press

keycode 225 release
```

is there a way to disable these key events completely?

thank you.

----------

## lost+found

I recently made my keyboards multimedia keys working, but you could remap any key. I found this wiki very useful:

http://en.gentoo-wiki.com/wiki/Multimedia_Keys

----------

## skunk

i don't need to remap these keys, what i need is to get rid of any key event trigged by the turn off of the display backlight...

thank you anyway.

----------

## Logicien

Do not confuse the keymap in virtuals characters terminals including the console and the keymap under X. Both are independant. xset is an Xorg command and showkey is a command who allow to see kernel keymap who is the one who is used in the console.

I you want to disable a key under X, use the command xev to see what is the keycode of that key and create an ~/.Xmodmap file if not with the corresponding line

```
keycode  xx =
```

where xx is the keycode number. Than do

```
xmodmap ~/.Xmodmap
```

to apply .Xmodmap to the Xorg keymap. You can load .Xmodmap at X startup.

For the kernel keymap, use the showkey command to see the corresponding keycode of a key. Create a file named for example personal.map and write a line

```
keycode xx =
```

where xx is the keycode number. Than use the command

```
loadkeys -u /path/to/personal.map
```

to apply the keycode value to the kernel keymap. The -u option is for Unicode keyboard mode. That can be done at boot time.

Note that some keys are only detected by the BIOS and are impossible to remap or disable by Linux and Xorg. Some others need to have their scancode associate to a keycode in the kernel side to be remapped or disabled. Without a keycode associate to the scancode of a key no character can be associate to that key in the kernel and the key is not detected by Xorg.

----------

## skunk

thank you paul, x keycodes are 101 and 212, unfotunately disabling them doesn't work with xmodmap nor with loadkeys with the kernel keycodes.

the only workaround i found is to disable the keybord, turn backlight off and enable the keyboard again:

```
xinput set-prop 7 "Device Enabled" 0; xset dpms force off; xinput set-prop 7 "Device Enabled" 1
```

any idea how to integrate this into the display power management?

----------

## lost+found

Does syslog show anything? ACPI events are logged there normally. The acpi events trigger predefined actions. If you haven't made these settings yourself, then it's a package like laptop-mode-tools handling these events. Are there any events/scripts under /etc/acpi except "default"?

----------

## skunk

 *lost+found wrote:*   

> Does syslog show anything?

 

no

 *Quote:*   

> ACPI events are logged there normally. The acpi events trigger predefined actions. If you haven't made these settings yourself, then it's a package like laptop-mode-tools handling these events. Are there any events/scripts under /etc/acpi except "default"?

 

acpi configuration was not touched and laptop-mode-tools was never installed.

anyway, this morning the hard disk has died, so i've decided to finally replace this 5 years old crap with a new laptop   :Wink: 

----------

