linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Modifying keycodes or scancodes of keyboard devices
@ 2012-09-11 15:21 Mathias Laurenz Baumann
  2012-09-12 20:49 ` Bruno Prémont
  0 siblings, 1 reply; 2+ messages in thread
From: Mathias Laurenz Baumann @ 2012-09-11 15:21 UTC (permalink / raw)
  To: linux-input

Hello,

I want to write a kernel module that hooks in somewhere between the  
keyboard driver and whatever
uses the resulting key events (e.g. evdev or xkb).

My goal is to modify the keycodes or scancodes (whatever works best and is  
least amount of work)
reported to the next function in the input processing chain, with the  
intended result of
modifying the keyboard layout.

I could of course just use xkb and create a custom mapping, but my  
experience with those is that
many applications have trouble with some mappings. One example is the  
neo-layout[1] which provides
alternative mappings for the arrow keys or the navigation keys like pos1,  
end, return and the
numblock, only activated when a certain modifier is active (e.g. AltGr).  
Many programs have trouble
when those alternatives are used.

My idea is to do that mapping on a level deeper than xkb can provide, thus  
avoiding those problems and faking
a keyboard that has that layout in hardware, at least from the point of  
view of xkb.

I have no experience with kernel hacking, but I did some reading and..  
well here is my idea:

There are the functions input_set_keycode[0] and input_get_keycode which  
sound like they do what I want to do.
So I figured, I write a simple kernel module that just calls these  
functions with the mappings I want to do.

Trouble is, they also want a pointer to the device that this concerns.
That is of course a reasonable thing to require for that function, just  
that I have no idea where to get that from.

I couldn't find any function that would return me a list of the input  
devices.

I also saw input_grab_* and input_inject_* which sounds like it could also  
be used for my purpose .. but input_set_keycode seemed more reasonable ....

So my questions are:
* Is this approach feasible? Would it work?
* If yes, where to I get the struct input_dev* device, or a list of them,  
from?
* If no, what approach do you suggest?

     --Marenz


[0]  
http://kernel.org/doc/htmldocs/device-drivers/API-input-set-keycode.html
[1] http://neo-layout.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-12 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 15:21 Modifying keycodes or scancodes of keyboard devices Mathias Laurenz Baumann
2012-09-12 20:49 ` Bruno Prémont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).