LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Intercept USB Keyboard Keycode Info (https://www.linuxquestions.org/questions/linux-newbie-8/intercept-usb-keyboard-keycode-info-4175420847/)

roboninja123 08-07-2012 11:09 AM

Intercept USB Keyboard Keycode Info
 
Hey there,

I am trying to intercept keycode information and print the last recieved keycode to an entry in the /proc file system. As of now, I have modified input.c and keyboard.c. Each time I have created a static variable that is to contain the last keycode. I then go into the keycode handling functions (input_fetch_keycode()/input_get_keycode() in input.c and getkeycode() in keyboard.c) and modify them to assign the keycode it is about to return to the static variable.

It seems that every time I try to do this, I get zeros for the output values, as if there is never a value assigned to the static variable in the first place. I am working under the assumption that everytime there is a key pressed on the USB keyboard, that one of these functions will be called, is that a correct assumption? Or are these drivers meant for a PS/2 keyboard and are never being called because I am using a USB keyboard? And if that is the case, what source file will I have to edit to obtain the keycode values?

frankbell 08-07-2012 08:50 PM

You might want to take a look at xev.


All times are GMT -5. The time now is 03:57 AM.