* Reading keys
@ 2010-05-10 16:01 Niko Rosvall
2010-05-10 16:55 ` Christoph Fritz
0 siblings, 1 reply; 4+ messages in thread
From: Niko Rosvall @ 2010-05-10 16:01 UTC (permalink / raw)
To: Linux input
Hi All,
I'm new to Linux kernel and actually subscribed to this list today.
So, i'm not even sure is this the right place to ask this, but:
I want to make a kernel module which detects a keypress and then
disables it. E.g someone presses F1 and my module would just "eat" it.
Any examples and/or hints where to start? Some nice, small peace of code
would be very very nice.
Thanks,
Niko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reading keys
2010-05-10 16:01 Reading keys Niko Rosvall
@ 2010-05-10 16:55 ` Christoph Fritz
2010-05-10 19:54 ` Niko Rosvall
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Fritz @ 2010-05-10 16:55 UTC (permalink / raw)
To: Niko Rosvall; +Cc: Linux input
On Mon, 2010-05-10 at 19:01 +0300, Niko Rosvall wrote:
> Hi All,
>
> I'm new to Linux kernel and actually subscribed to this list today.
> So, i'm not even sure is this the right place to ask this, but:
>
> I want to make a kernel module which detects a keypress and then
> disables it. E.g someone presses F1 and my module would just "eat" it.
Interesting usecase, is it for a kiosk? And why don't you disable the
keys in X or your application?
> Any examples and/or hints where to start? Some nice, small peace of code
> would be very very nice.
You could hack input_event() in drivers/input/input.c
Thanks,
Christoph
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reading keys
2010-05-10 16:55 ` Christoph Fritz
@ 2010-05-10 19:54 ` Niko Rosvall
2010-05-10 20:48 ` Dmitry Torokhov
0 siblings, 1 reply; 4+ messages in thread
From: Niko Rosvall @ 2010-05-10 19:54 UTC (permalink / raw)
To: Christoph Fritz; +Cc: Linux input
On Mon, 2010-05-10 at 18:55 +0200, Christoph Fritz wrote:
> On Mon, 2010-05-10 at 19:01 +0300, Niko Rosvall wrote:
> > Hi All,
> >
> > I'm new to Linux kernel and actually subscribed to this list today.
> > So, i'm not even sure is this the right place to ask this, but:
> >
> > I want to make a kernel module which detects a keypress and then
> > disables it. E.g someone presses F1 and my module would just "eat" it.
>
> Interesting usecase, is it for a kiosk? And why don't you disable the
> keys in X or your application?
>
> > Any examples and/or hints where to start? Some nice, small peace of code
> > would be very very nice.
>
> You could hack input_event() in drivers/input/input.c
>
> Thanks,
> Christoph
No, not for a kiosk or anything. Basically I'm just having fun here and
trying to do a module which would disable caps lock key completely.
Of course I can do that using xmodmap, but where's the fun then? ;)
I did modify input.c (didn't test it yet thought), but what I really
want is just a simple module so I can load and unload it when I want.
Cheers,
Niko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reading keys
2010-05-10 19:54 ` Niko Rosvall
@ 2010-05-10 20:48 ` Dmitry Torokhov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2010-05-10 20:48 UTC (permalink / raw)
To: Niko Rosvall; +Cc: Christoph Fritz, Linux input
On Mon, May 10, 2010 at 10:54:23PM +0300, Niko Rosvall wrote:
> On Mon, 2010-05-10 at 18:55 +0200, Christoph Fritz wrote:
> > On Mon, 2010-05-10 at 19:01 +0300, Niko Rosvall wrote:
> > > Hi All,
> > >
> > > I'm new to Linux kernel and actually subscribed to this list today.
> > > So, i'm not even sure is this the right place to ask this, but:
> > >
> > > I want to make a kernel module which detects a keypress and then
> > > disables it. E.g someone presses F1 and my module would just "eat" it.
> >
> > Interesting usecase, is it for a kiosk? And why don't you disable the
> > keys in X or your application?
> >
> > > Any examples and/or hints where to start? Some nice, small peace of code
> > > would be very very nice.
> >
> > You could hack input_event() in drivers/input/input.c
> >
> > Thanks,
> > Christoph
>
> No, not for a kiosk or anything. Basically I'm just having fun here and
> trying to do a module which would disable caps lock key completely.
>
> Of course I can do that using xmodmap, but where's the fun then? ;)
>
> I did modify input.c (didn't test it yet thought), but what I really
> want is just a simple module so I can load and unload it when I want.
>
You need to define "filter" input handler - one that implements filter()
instead of event(). This requires recent kernel though.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-10 20:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 16:01 Reading keys Niko Rosvall
2010-05-10 16:55 ` Christoph Fritz
2010-05-10 19:54 ` Niko Rosvall
2010-05-10 20:48 ` Dmitry Torokhov
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).