Translate keysyms to ASCII
Jeff Haran
jharan at bytemobile.com
Thu Mar 29 13:42:19 EDT 2012
From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of Gabriel Duarte
Sent: Thursday, March 29, 2012 4:14 AM
To: kernelnewbies at kernelnewbies.org
Subject: Translate keysyms to ASCII
Hello people,
I working on a small proof of concept keylogger that works on kernel mode. It's parte of my studies of kernel development.
I'm using the struct "keyboard_notifier_param" to get the keys pressed on the keyboard(s) attached to the system.
At the end, I print the value, like this:
printk(KERN_DEBUG "KEY== %i", param->value);
According to the definition of the struct "keyboard_notifier_param" at http://lxr.free-electrons.com/source/include/linux/keyboard.h#L37, the field value is a "keycode, unicode value or keysym".
For example, when I press the key a, I get the value 30, but I would like tranlate it to the ASCII. I managed to create a translation table by myself, but I think there is another way more stylish to do this, or not? I googled a lot but could not find a consistent answer.
Any help is appreciated,
Gabriel.
--
Gabriel Duarte
Linux User #471185
France / Grenoble - Rhône Alpes
http://genericdev.wordpress.com/
The term I think you want to search for is "PC keyboard scan code". This link seems to cover it pretty well:
http://www.quadibloc.com/comp/scan.htm
Jeff Haran
More information about the Kernelnewbies
mailing list