You are not logged in.

#1 2012-01-29 16:24:48

mpz
Member
Registered: 2010-10-14
Posts: 54

Alianware M18X key mapping

I'm wondering if anyone was able to successfully map extra function keys that M18X provides. I tried everything suggested in https://wiki.archlinux.org/index.php/Ex … board_Keys but since showkey does not return a code that means kernel does not recognize them. Are there any kernel patches one could apply (I prefer not to re-compile the kernel)?

Thanks

Offline

#2 2012-03-12 22:10:26

johni
Member
Registered: 2012-02-03
Posts: 102

Re: Alianware M18X key mapping

I have an alienware M17Xr3, and most of the special keys worked out of the box (volume up/down/mute/wifi), with the exception of a couple of them one was the DVD eject button didn't work.

Most of what I did is discussed on the wiki page you mentioned, but let me show you exactly what I did to get the eject button to work.

First, while in X, I pressed the eject key.  Then I ran dmesg, and found this at the bottom:

[31586.873297] atkbd serio0: Unknown key released (translated set 2, code 0x89 on isa0060/serio0).
[31586.873306] atkbd serio0: Use 'setkeycodes e009 <keycode>' to make it known.

So, the scancode for eject is 0x89.    I then looked in my keyboard map to find an unused keycode.
In my case the keyboard map is /usr/share/kbd/keymaps/i386/qwerty/us.map.gz since I am on a US keyboard. It may be different for you if in a different locale.  Since it is compressed, use "zless" to view it. I see keycode 100 is not mentioned in the file, so I will assign eject to keycode 100

So I ran this on the console (not in an x terminal):

setkeycodes 0x89 100

Now to make the key useful, I need to assign it to something in XOrg.  To see what XOrg thinks the new key scan code is, run xev, and press the eject button.  I got this:

KeyRelease event, serial 41, synthetic NO, window 0x5000001,
    root 0x15d, subw 0x0, time 31946854, (5,696), root:(1747,717),
    state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

So, XOrg sees the keycode as 108.   Now to map it to a know XOrg key (XF86Eject).  To do this, you will use xmodmap.
I made a ~/.xmodmap file with the following:

keycode 108 = XF86Eject

Then run "xmodmap ~/.xmodmap".   Now if I run xev again it will show the key by name to be XF86Eject:

KeyPress event, serial 41, synthetic NO, window 0x5000001,
    root 0x15d, subw 0x0, time 32064647, (-57,611), root:(1685,632),
    state 0x0, keycode 108 (keysym 0x1008ff2c, XF86Eject), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

The final piece is to make the eject button run the command "eject /dev/sr0".  In KDE I just go into the Shortcuts & Gestures settings, and add a new input action, with command, and assign XF86Eject to run "eject /dev/sr0".


To make this permanent add the "setkeycodes" command from earlier to /etc/rc.local
And, in the kde autostart, directory, add a script that runs "xmodmap ~/.xmodmap".


I hope this helps.

Offline

Board footer

Powered by FluxBB