l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Nov 30 17:10

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] convert keycodes to characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] convert keycodes to characters


As an academic endeavour, I am writing a program that will make data regarding
keyboard usage (key frequency, etc). So far I've got a program that can read
keyboard events via /dev/input/event0, but that gets me as far as keycodes and
event types such as 'key release' or 'key press'. What I would like next is to
convert the codes into characters, so different keymaps don't create spurious
data. That is, if I press the key labeled 'd', I want the code 32 to be
converted to a 'd' if using qwerty, xor to a 'e' if using Dvorak (32 is the code
generated by the key labeled 'd', regardless if typing on the console or in X
and regardless of console keymap and X keymap). 

Ideally I could handle both console and X, but as I'm mainly in X the following
questions will suffice:

1. Can I programmatically figure out what the X keymap is?
2. Can I programmatically use the X keymap to convert keycodes to characters?

The corresponding questions re: the console would also be nifty. :)


p.s. I keep thinking it myself, so I assume some of you will think it: Yes, this
sounds like a keylogger. I promise, I'm not evil. 0:) 

Bryan Richter
UCDTT President
UC Davis Undergrad, Physics Dept.
A PGP signature is (probably) attached to this email. 

Attachment: signature.asc
Description: Digital signature

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.