Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
keycode mapping
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
mathfeel
l33t
l33t


Joined: 03 Aug 2004
Posts: 700

PostPosted: Fri Oct 08, 2010 3:08 am    Post subject: keycode mapping Reply with quote

My laptop, a tablet PC, comes with four special buttons at the bottom of the screen to rotate the screen. They are not recognized in the 'us' keymap. So I need to to add them using 'setkeycodes' to /etc/conf.d/local.start
Code:
setkeycodes 66 130 &> /dev/null
setkeycodes 67 131 &> /dev/null # screen rotation key
setkeycodes 68 132 &> /dev/null
setkeycodes 6c 133 &> /dev/null

This results in
Code:
Plain scancodes xx (hex) versus keycodes (dec)
for 1-83 (0x01-0x53) scancode equals keycode

 0x50:   80  81  82  83  99   0  86  87
 0x58:   88 117   0   0  95 183 184 185
 0x60:    0   0   0   0   0   0 130 131
 0x68:  132   0   0   0 133   0   0   0
 0x70:   93   0   0  89   0   0  85  91
 0x78:   90  92   0  94   0 124 121   0


Checking back in X with xev, I got:
Code:
KeyPress event, serial 26, synthetic NO, window 0x3a00001,
    root 0xad, subw 0x0, time 2270304, (518,505), root:(519,525),
    state 0x10, keycode 139 (keysym 0xff65, Undo), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x3a00001,
    root 0xad, subw 0x0, time 2270605, (518,505), root:(519,525),
    state 0x10, keycode 139 (keysym 0xff65, Undo), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False


Two questions: 1. how come X recognize the keycode as 139, different than that one I set 131?
2. how do I avoid a keycode of already recognized keysym like "Undo". I don't want the "undo" key in my multimedia keyboard to be also binded to a screen rotation script.

Regards,,
_________________
-----------------------------------------------------------
"In heaven all the interesting people are missing"
-- Friedrich Nietzsche
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Fri Oct 08, 2010 5:45 am    Post subject: Reply with quote

Hi,
by default the keycodes bind to the keys in the kernel keymap table are not the same as in X. It's not important because it's not the same table. You have differents drivers for inputs devices in the kernel and in X. A scancode must be bind to a keycode in the kernel for the key being seen in X and make X able to bind a keycode to that key. If the keysym associate to a keycode in X is not what you want, you have to change it by hand using the xmodmap command. This is what I experienced.
_________________
Paul
Back to top
View user's profile Send private message
mathfeel
l33t
l33t


Joined: 03 Aug 2004
Posts: 700

PostPosted: Fri Oct 08, 2010 6:29 am    Post subject: Reply with quote

Logicien wrote:
Hi,
by default the keycodes bind to the keys in the kernel keymap table are not the same as in X. It's not important because it's not the same table. You have differents drivers for inputs devices in the kernel and in X. A scancode must be bind to a keycode in the kernel for the key being seen in X and make X able to bind a keycode to that key. If the keysym associate to a keycode in X is not what you want, you have to change it by hand using the xmodmap command. This is what I experienced.


Thanks. I experimented with it a little bit, there seems to be a rule that when I change the console keycode, the corresponding X keycode also changes such that X_keycode = console_keycode + 7...not sure how that happens...

anyway, now that I got xev to recognize these new keys, I am wondering what keysym's I should map them to. I wanted to see what are available, but I can't find the file /usr/share/X11/XKeysymDB.

Where did it go?
_________________
-----------------------------------------------------------
"In heaven all the interesting people are missing"
-- Friedrich Nietzsche
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum