Locating the keyboard driver (and replacing it)

Peter Teoh htmldeveloper at gmail.com
Tue Jan 8 10:28:26 EST 2013


This article gave a very indepth coverage of the keyboard processing in
linux:

http://www.phrack.com/issues.html?issue=59&id=14&mode=txt

http://www.gadgetweb.de/programming/39-how-to-building-your-own-kernel-space-keylogger.html

Not sure about your architecture, but for my Lenovo laptop, when I do a
"cat /dev/input/by-path/platform-i8042-serio-0-event-kbd" and redirect to a
file, every single key input I entered is captured into the the file.

Therefore, looking into the kernel source, we can infer the files
drivers/input/serio/i8042.c are responsible for the keyboard processing.
Of course, this file is compiled into the kernel, not as a kernel module.
So if u want to make any changes, instead of recompile the kernel and
rebooting, one way to do dynamically is called "inline hooking" - look
elsewhere for this method.   It is explained in the following article:

http://www.phrack.com/issues.html?issue=59&id=14&mode=txt

but note the difference between the Phrack's interception and intercepting
the API inside the i8042.c:   when you do a
"cat  /dev/input/by-path/platform-i8042-serio-0-event-kbd" the keyboard
entry is always captured - irregardless of whichever windows/terminal you
are in.   But the Phrack's method is cleaner - it is intercepting at the
tty (eg drivers/tty/n_tty.c:receive_buf() inside the kernel source) level -
so if you switch over to another window, the input got switch away - it is
thus targetted to only that TTY.

And btw, USB keyboard's processing path is altogether different
again....another

http://www.lrr.in.tum.de/Par/arch/usb/download/usbdoc/usbdoc-1.32.pdf

and perhaps u can read here many good writeups:

http://stackoverflow.com/search?q=usb+keyboard+kernel


On Fri1, Dec 14, 2012 at 3:46 PM, manty kuma <mantykuma at gmail.com> wrote:

> Hi,11
>
> I have written a small module that toggles the capslock LED. To
> demonstrate it i want to replace the Existing keyboard module with mine. I
> tried lsmod|grep "key" without any success. also checked /proc/modules. I
> couldnot find any clue regarding the name of the module i need to
> uninstall. So, How can i remove the existing keyboard module and insert
> mine?
>
> Regards,
> Manty
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130108/8459a9b9/attachment.html 


More information about the Kernelnewbies mailing list