How to use keyboard-force-release on 13.10

Asked by SKOM on 2013-10-21

Hello,
I'm running Ubuntu 13.10 (new installation) on a Lenovo Z370.
The notebook has special keys for the volume.
If I press one of these Buttons the keyboard and mouse doesn't work correctly any more.
Till 13.04 the solution of the Problem was to add the following line into /lib/udev/rules.d/95-keyboard-force-release.rules :

------
ENV{DMI_VENDOR}==”LENOVO”, ATTR{[dmi/id]product_name}==”IdeaPad Z370″, RUN+=”keyboard-force-release.sh $devpath common-volume-keys”
------
http://ubuntuforums.org/showthread.php?t=1999543

Now is Ubuntu using hwdb to configure the rules. So I think I have to add the options to the file /lib/udev/hwdb.d/60-keyboard.hwdb to get the keys to work again, but I don't know how.

Thanks for your help!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu udev Edit question
Assignee:
No assignee Edit question
Solved by:
SKOM
Solved:
2013-10-27
Last query:
2013-10-27
Last reply:
2013-10-21

If you run:

xev

And press the keys, do they generate events?

Thanks

SKOM (somekindofmonster) said : #2

Here are my outputs:

Mute:
FocusOut event, serial 37, synthetic NO, window 0x3800001, mode NotifyGrab, detail NotifyAncestor

Volume down:
FocusOut event, serial 40, synthetic NO, window 0x3e00001, mode NotifyGrab, detail NotifyAncestor

Volume up:
FocusOut event, serial 37, synthetic NO, window 0x2800001, mode NotifyGrab, detail NotifyAncestor

The number behind serial and window changed at the second try.
After each time pressing the button i had to restart the computer because i can't do anything.
The Event with the mode NotifyUngrab did not launch.

Stefan Hante (stefan-hante) said : #3

I have the same problem on a fresh 13.10 install on a Lenovo ThinkPad Edge E320.
My outputs of xev:

Mute:
KeyPress event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4356777, (393,255), root:(393,279),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4356788, (393,255), root:(393,279),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Volume Down:
KeyPress event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4420997, (334,339), root:(334,363),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4421100, (334,339), root:(334,363),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Volume Up:
KeyPress event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4477555, (413,215), root:(413,239),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4400001,
    root 0x90, subw 0x0, time 4477641, (413,215), root:(413,239),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

I didn't have to reboot my computer between pressing the Hotkeys…

SKOM (somekindofmonster) said : #4

I thik this is another Problem, because at your Notebook the KeyRelease is working.
But can you type or click anything after using one of these keys?

Stefan Hante (stefan-hante) said : #5

Yes, you are right my problem is different, because mouse and keyboard work correctly after using the hotkeys. (I guess I should've read the whole description after you pointed me to this site ;p)

But I think these problems might be related, because you are experiencing the same things as I (hotkeys not working). The difference is that you also have issues that are (are they?) known to be related to your specific laptop.

SKOM (somekindofmonster) said : #6

Hello,
I did some more Tests with xev.
This time i first pressed the multimedia key for volume up with this output:

-----
FocusOut event, serial 40, synthetic NO, window 0x3a00001,
    mode NotifyGrab, detail NotifyAncestor
-----

Now the Keyboard was blocked But if I press the key combination "Fn+arrow right" (Volume up) the following event comes up:

-----
FocusIn event, serial 40, synthetic NO, window 0x3a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys: 4294967212 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-----

And after this event the keyboard is working again.
If I'm pressing only the Volume up key combination there is the following output:

-----
FocusOut event, serial 40, synthetic NO, window 0x3a00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-----

At Volume Down the same output
So I think there is the NotyfyUngrab missing at the Multimedia key.
In Ubuntu 13.04 adding the following line into /lib/udev/rules.d/95-keyboard-force-release.rules has solved the problem:

------
ENV{DMI_VENDOR}==”LENOVO”, ATTR{[dmi/id]product_name}==”IdeaPad Z370″, RUN+=”keyboard-force-release.sh $devpath common-volume-keys”
------

How can I add an equivalent rule in ubuntu 13.10?

SKOM (somekindofmonster) said : #7

Hi,
I found a solution here (http://ubuntuforums.org/showthread.php?t=2182387&p=12829216#post12829216):

Go to /lib/udev/hwdb.d/60-keyboard.hwdb in the Lenovo section and add the following lines:

-----
# IdeaPad Z370
keyboard:dmi:bvn*:bvr*:svnLENOVO*:pn*IdeaPad*Z370*:pvr*
 KEYBOARD_KEY_a0=!mute
 KEYBOARD_KEY_ae=!volumedown
 KEYBOARD_KEY_b0=!volumeup
-----

After saving update the udev hwdb by executing

-----
sudo udevadm hwdb --update
-----

After a reboot the volume keys worked again as supposed

SKOM (somekindofmonster) said : #8

A better solution is to create the File /etc/udev/hwdb.d/61-lenovo-z370.hwdb with

-----
# IdeaPad Z370
keyboard:dmi:bvn*:bvr*:svnLENOVO*:pn*IdeaPad*Z370*:pvr*
 KEYBOARD_KEY_a0=!mute
 KEYBOARD_KEY_ae=!volumedown
 KEYBOARD_KEY_b0=!volumeup
-----

After saving update the udev hwdb by executing

-----
sudo udevadm hwdb --update
-----

After a reboot the volume keys worked again as supposed and will not be overwritten by an update.