Re: [patch] Re: "Internet Keyboard" support for Linux

Ryan Lortie (desertangel@globalserve.net)
Fri, 10 Dec 1999 22:24:47 +0000


> But you want to do that even on non-internet keybaords! For example
> mouse emulation on keyboard is easy that way.
>
> I called it keylink, but it never got to standart distribution. (There
> should be hooks to actually call it, add them yourself.)

Your code looks alot like the other side of my code (i.e. the module - I havn't
posted it because it is irrelivant)

The only thing I want is _that hook in the kernel_. Just a generic interface
to allow contributed modules to hook into the keyboard controller and get told
what all the keypresses are, deciding if they want to process them or if they
should go to the normal controller.

This interface would allow the implimentation of mouse emulation, "internet
keyboard" support, and even provide an interface for the SysRQ keys.

As for mouse keys, I like that idea. Assuming this hook was in the kernel, it
would be very easy to impliment mouse keys. You could even write your module
to emulate a common mouse protocol and simply attach gpm or X to it.

Furthermore, the hook is just a pointer, set to 0 by default. If no keyboard
addons are loaded, then the pointer remains 0 and doesn't get called by the
handle_scancode routine.

However, if an addon is present, it would set this hook to point to its own
scancode handling function (setting of the pointer would naturally be done in
init_module, and setting it back to 0 would be done in module_release). The
handler would then receive all scancodes and decide which ones it wanted to
process and which ones to allow the normal handler to handle.

(note, the following suggestions are against 2.2.13, not a 2.3.x)
At the top of keyboard.c, we add:
static int (* keyboard_addon)( unsigned char scancode, int down ) = 0;
EXPORT_SYMBOL(keyboard_addon);

and in the handle_scancode routine (near the very top, just after the variable
declarations):
if( keyboard_addon )
if( keyboard_addon( scancode, down ) )
return;

If the keyboard_addon symbol has been set to a non-0, then the handler is
called. If the handler returns non-zero, then it has handled the scancode and
handle_scancode can return. If the handler returns 0, then handle_scancode
proceeds normally.

This is a very generic interface that could be used for many things, several of
which I am personally interested in implimenting.

Ryan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/