Ubuntu – Several ACPI event keys have the same ID

14.04acpifunction keyskernelkeyboard

Ubuntu 14.04 LTS

Kernel: 3.19.0-37-generic

INTRO

When I start acpi_listen on my system I can test several LaptopSpecialKeys. The brightness buttons work perfectly fine for example:

video/brightnessdown BRTDN 00000087 00000000
video/brightnessup BRTUP 00000086 00000000

The desired function is working.

PROBLEM

If I test some other keys, they either have no acpi event triggered at all (acpi_listen does nothing) or several keys are mapped to the same code like the three volume keys:

button/volumeup VOLUP 00000080 00000000 K
button/volumedown VOLDN 00000080 00000000 K
button/mute MUTE 00000080 00000000 K

The result of the volume keys being mapped to the same code is that the volume up, down and mute actions are all behaving very weird. E.g. if I press volume up function key the volume up event is triggered infinitely repeating.

And the weirdest thing of all:

How does the acpi event distinguish between those three keys, recognizing that each has its own funcionality (VOLUP, VOLDN, MUTE), altough all three keys have the same code 0x80?

QUESTION

Do you have any idea on how to handle such problems with acpi events? Is it a problem of the kernel, not recognizing specific notebook drivers? Or are there solutions on the user level that might repair this broken functionality of LaptopSpecialKeys?

Best Answer

Actually they are very distinguishable, your script will receive the whole line as argument. Example:

button/volumeup VOLUP 00000080 00000000 K

You got 5 arguments and you are free how to process them.

Maybe the easiest way:

event=button/*
action=/etc/acpi/yourscript.sh %e

Then in your script used the 3rd argument $3 that will either VOLUP, VOLDN or MUTE, plus some other buttons (power,...) .

See:

Related Question