Finding A Full List Of Keycodes For Pandora


Esn

(:";
Joined
Mar 5, 2003
Messages
3,239
Location
Toronto, Canada
Website
esn.newgrounds.com
Where can I see a full list of which keycodes control which keys on the Pandora? Now that we can easily create custom keyboard layouts, this is rather vital information to know.

I've tracked down a few instructions for mapping Pandora's action keys to different functions, and they seem to contain contradictory information, unless the ABXYLR buttons have several different keycodes assigned to them at the same time...

First of all, there are the assignments in the .pndXmodmap file, which you can see here. It has:
Code:
keycode  83 = Home quotedbl Home quotedbl
keycode  87 = Prior Multi_key Prior Multi_key
keycode  88 = End XF86_Switch_VT_2 End XF86_Switch_VT_2
keycode  89 = Next XF86_Switch_VT_1 Next XF86_Switch_VT_1
Because Home/End/PgUp/PgDown are assigned to ABXY, that would mean that A=83, B=88, X=89, Y=87.

Then there are the codes that pepone has here, which I've confirmed when mapping DOSBox keys here:
A=278, B=279, X=281, Y=280, L=303, R=305

zx-81 over here has yet another version:
A=110, X=117, B=115

And urjaman says that L and R are actually 62 and 105.

Adding it all up, we seem to have:

A = 83,110,278
B = 88,115,279
X = 89,117,281
Y = 87,280
L = 62,303
R = 105,305
 
Last edited by a moderator:
I think the tools you are searching for are "xmodmap" and "xev"

This should print a full listing of keycodes:
Code:
xmodmap -pk

This should print a list of modifier keys
Code:
xmodmap -pm

Also check out:
Code:
xmodmap --help


However the list you get with "-pk" shows ALL 255 definitions that in theory are possible. Your assumption is wrong, that the A-button of the Pandora is 83 because it executes the "Home"-function. If you continue to read the output, then you will noticed that a different keycode is assigned to "Home" too: keycode 110. And that's actually the keycode that the A-button sends when it's pressed.

What you need is the command "xev". It will show you information on a button you pressed. If i remember correctly, then "xev" is not installed by default, but in the angstrom-repo that comes with the pandora and thus is easy to be installed. Something like (as root):

Code:
opkg install xev

run it, a window will pop up, which needs to be focused to monitor keypresses and mouse-movements/-buttons. Press the A-button and you will see that it produces keycode 110.

Btw: the backspace-key (most upper-right key) of the Pandora behaves a bit strange. I'm not sure why, but i noticed that when trying to get shift+backspace working (Delete). So far you can only do a Delete-command by pressing CTRL+ALT+Backspace. For some reason pressing shift together with the backspace-key does not behave like its assigned in the xmodmap list. The second column of .pndXmodmap is what shift+Backspace should be producing and that clearly is "Delete".

I plan to investigate in the xorg-keyboard-layout, but so far i was missing the command "setxkbmap". It's not even in the Angstrom-repo, which i find a bit strange. Anyway: Your link to that pnd helps me there. =) Thanks
 
btw the keycodes that dosbox and gngeo use are not the xorg-codes but some programm-internal ones. It's the same with Vice (C64-emulator) and other programms. These can be SDL-keycodes or some own format, but AFAIK they completely ignore (?) the xorg-configuration.
 
Angstrom won't allow me to install xev, even if I start the command with "sudo". I'd try it in Stuckie's Lenny Debian extend, but xev isn't in the Debian repo. Interesting that 110 is the "real" keycode of A. Then what is .pndXmodmap bothering for with keycode 83? Why not 110 instead? Is it just a mistake?

Interesting thing about the "program-internal" codes as well, since it seems like a lot of programs use them. Wonder what they are, exactly...
 
Every key on a keyboard has a unique physical keycode. Every key also has a not-necessarily unique virtual keycode.
You've got two CTRL keys on your keyboard, they both have different physical keycodes allowing you to identify both, but they also have the same virtual keycode which means "ctrl". Part of the keyboard driver's job is to map the physical keys into known virtual keys. The Pandora's keyboard driver maps 'A', which has physical keycode of 110, to 83, which is virtual keycode for 'home'. But even after it is said to be the 'home' button, X doesn't necessarily know what to do with it. .pndXmodmap tells X that keycode 83 (ie, the home key) has the home function.
SDL reads the physical keycodes and maps them to its own internally consistent set of virtual keys. 'A' was given 278, it looks like.
As another example of physical vs virtual, consider the numberpad on the right side of your keyboard (assuming you have one). They all have their own physical keycodes, and regardless of whether num-lock is on or off, you can always read the same physical keycode, but depending on the state of num-lock, the virtual keycodes will either be for the numbers (and will be the same virtual keycode as the numbers across the top row) or arrows (and will be the same as the other set of arrows).
Most programs just use the virtual keycodes.
 
Back
Top