Skip to contentSkip to conversation

Reading keys

DISCUSSION Niko Rosvall 3 participants 4 messages May 10, 2010 HID

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 7 lines · Niko Rosvall

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?

Quoted 2 lines

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

#2 lore raw
Quoted 12 lines · Christoph Fritz
Quoted 7 lines · Niko Rosvall

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?

Quoted 7 lines
Quoted 2 lines

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

#3 lore raw
Quoted 21 lines · Niko Rosvall
Quoted 12 lines · Christoph Fritz
Quoted 7 lines · Niko Rosvall

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?

Quoted 7 lines
Quoted 2 lines

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

Quoted 8 lines

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.

Signature · 1 line
Dmitry