Skip to contentSkip to conversation

INPUT: keyboard_tasklet - don't touch LED's of already grabed device

PATCH Aivils Stoss 3 participants 4 messages Sep 6, 2005 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

Hi, Vojtech!

Recent kernels allow exclusive usage of input device when input device is grabed. keyboard_tasklet does not check device state and switch LED's of all keyboards. However grabed device may be use another LED steering code.

This patch forbid keyboard_tasklet switch LED's of grabed devices.

Aivils Stoss

drivers/char/keyboard.c~ 2005-09-06 10:09:35.000000000 +0300 renamed from drivers/char/keyboard.c 2005-08-29 02:41:01.000000000 +0300 +2 -0
@@ -895,16 +895,18 @@ static inline unsigned char getleds(void
 
 static void kbd_bh(unsigned long dummy)
 {
        struct list_head * node;
        unsigned char leds = getleds();
 
        if (leds != ledstate) {
                list_for_each(node,&kbd_handler.h_list) {
+                       if (handle->dev->grab)
+                               continue;
                        struct input_handle * handle = to_handle_h(node);
                        input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
                        input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
                        input_event(handle->dev, EV_LED, LED_CAPSL,   !!(leds & 0x04));
                        input_sync(handle->dev);
                }
        }
 
#1 lore raw
Quoted 10 lines · --- Aivils Stoss

Hi, Vojtech!

Recent kernels allow exclusive usage of input device when
input device is grabed. keyboard_tasklet does not check
device state and switch LED's of all keyboards. However
grabed device may be use another LED steering code.

Quoted 4 lines

This patch forbid keyboard_tasklet switch LED's of grabed devices.

Aivils Stoss

While trying this with 2.6.12 it gets a compilation error. Not when you move the added statements after the structure declaration.

Is that me heading for them thar hills?

Hugo

<snip patch>

______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

#2 lore raw
Quoted 17 lines · Hugo Vanwoerkom
Quoted 13 lines · --- Aivils Stoss

Hi, Vojtech!

Recent kernels allow exclusive usage of input device when
input device is grabed. keyboard_tasklet does not check
device state and switch LED's of all keyboards. However
grabed device may be use another LED steering code.

This patch forbid keyboard_tasklet switch LED's of grabed devices.

Quoted 8 lines
Quoted 1 line

Aivils Stoss

While trying this with 2.6.12 it gets a compilation error. Not when you move the added statements after the structure declaration.

Is that me heading for them thar hills?

The patch probably wasn't tested. ;)

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#3 lore raw
Quoted 17 lines · Vojtech Pavlik
Quoted 16 lines · Hugo Vanwoerkom
Quoted 14 lines · --- Aivils Stoss

Hi, Vojtech!

Recent kernels allow exclusive usage of input device when
input device is grabed. keyboard_tasklet does not check
device state and switch LED's of all keyboards. However
grabed device may be use another LED steering code.

This patch forbid keyboard_tasklet switch LED's of grabed devices.

Aivils Stoss

Quoted 7 lines
Quoted 5 lines

While trying this with 2.6.12 it gets a compilation error. Not when you move the added statements after the structure declaration.

Is that me heading for them thar hills?

The patch probably wasn't tested. ;)

How a soul who hates kernel compilation can test a patch? Runtime modifcation:
http://www.ltn.lv/~aivils/files/hijackled-2.6.11-12mdk.tar.bz2

Aivils

drivers/char/keyboard.c~ 2005-09-06 15:32:28.000000000 +0300 renamed from drivers/char/keyboard.c 2005-08-29 02:41:01.000000000 +0300 +2 -0
@@ -896,16 +896,18 @@ static inline unsigned char getleds(void
 static void kbd_bh(unsigned long dummy)
 {
        struct list_head * node;
        unsigned char leds = getleds();
 
        if (leds != ledstate) {
                list_for_each(node,&kbd_handler.h_list) {
                        struct input_handle * handle = to_handle_h(node);
+                       if (handle->dev->grab)
+                               continue;
                        input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
                        input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
                        input_event(handle->dev, EV_LED, LED_CAPSL,   !!(leds & 0x04));
                        input_sync(handle->dev);
                }
        }
 
        ledstate = leds;