Messages in this thread | | | Date | Wed, 6 Jul 2005 22:25:06 -0700 (PDT) | From | Dmitry Torokhov <> | Subject | Re: overriding keyboard driver in a module |
| |
Genadz Batsyan <gbatyan@gmx.net> wrote: > I'm writing a little tool to allow intercepting keyboard events and > substituting them with other events / swallowing events / emitting > additional > events on a low level before normal processing by kernel. > http://kbd-mangler.sourceforge.net/ > > Currently to have precedense over the keyboard driver I'm using a patch > against drivers/input/keyboard/atkbd.c > > Well, I guess, patching kernel is unthinkable for most linux users, so I > thought, maybe there is a way to do it without the kernel patch. > Is it possible to write a kernel module to intercept keyboard events > and have precedense over the kernel driver? >
You can try opening corresponding event device (/dev/input/eventX), grabbing it so nobody except for your process would get any events from the corresponding keyboard (EVIOCGRAB ioctl), and then read events, mangle them and inject them back into kernel through uinput driver.
As an additional plus it should work for any keyboard (or rather any input device), not only PS/2 keyboard.
-- Dmitry - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |