Raw X11 Keycodes


chris_c

Member
Joined
Jun 25, 2010
Messages
393
Age
55
I'd just compiled the key map for the event system on my gles python module (plug plug :D )

When it occurred to me that its also useful info for people making custom keymaps

keycode xxx A a A a

in a file would make the key code xxx produce the A character, you'd use this file with xmodmap

Code:
These are untranslated raw key event codes as received from the
xlib event system

Shift, control and alt do not modify key values
The only key that does is the FN key, it generates no code on
its own it can only be detected when certain keys are also down

- = same value not modified by FN
x = no value (probably consumed before it gets to Xlib)


KEY           code with
LABEL   code    FN key

1       10    67
2       11    68
3       12    69
4       13    70
5       14    71
6       15    72
7       16    73
8       17    74
9       18    75
0       19    76
DEL     22    118

UP      111   -
LEFT    113   -
RIGHT   114   -
DOWN    116   -

ALT     64    -
CTRL    37    -
PAND    147   -

A BUT   110   -
Y BUT   112   -
B BUT   115   -
X BUT   117   -

Q       24    9
W       25    198
E       26    34
R       27    35
T       28    195
Y       29    193
U       30    x
I       31    x
O       32    95
P       33    96

SHIFT   50    66
A       38    48
S       39    197
D       40    82
F       41    86
G       42    21
H       43    49
J       44    191
K       45    196
L       46    132
ENTER   36    -

,       59    47
.       60    199
Z       52    61
X       53    222
C       54    51
V       55    194
B       56    192
N       57    200
M       58    201
SPACE   65    23

LSHLDR  62    -
RSHLDR  105   -
 
Thanks the keycode list is indeed handy.

For example using the info in those last 2 lines on the Deadbeef music player config file:

hotkeys.key1 62: prev
hotkeys.key2 105: next

the shoulder buttons can be used to go to the next or previous track while the Pandora is screen is closed down.
 
p007 said:
Thanks the keycode list is indeed handy.

For example using the info in those last 2 lines on the Deadbeef music player config file:

hotkeys.key1 62: prev
hotkeys.key2 105: next

the shoulder buttons can be used to go to the next or previous track while the Pandora is screen is closed down.

Are you speaking hypothetically? Because it doesnt actually work.
 
Last edited by a moderator:
@ Lobo

Sorry you're right, I had to convert the keycodes to the equivalent hex format.
That definitely works, I'm using it now

hotkeys.key1 0x3e: prev
hotkeys.key2 0x69: next
 
Ah ok. I was going nuts trying to figure out why it would work for you and not for me! :)

Still not out of the woods yet though: Left button works for prev but the Right button doesnt work for next(using your keymapping). Any ideas?
 
Hmmm, I typed the commands in partway through the deadbeef config file (alphabetical order).
If your right button command was added on the last line maybe there is a missing or excess EOF character?

Otherwise what happens if you run the X event display command, xev ?

(
With Wifi enabled at a terminal type:
sudo opkg install xev
xev
)

Does pressing the Right shoulder button then display a KeyPress event with keycode 105 (0x69 hex) ?
 
I actually used the GUI to add two random keys for next and prev, then opened up the config file and edited the new entries.

Tried what you said with xev but got an error and said it could not install.

Dont worry about it: I just mapped left shoulder to next and will go with that. I did verify that my right shoulder button is actually working for what its worth :)
 
Back
Top