2005-01-05 17:04:18

by Meelis Roos

[permalink] [raw]
Subject: 2.6.9+ keyboard LED problem


The input changes in 2.6.9 made keyboard LED setting unreliable. 2.6.8
is OK, 2.6.9, 2.6.10 and todays BK are buggy.

The problem is that setting the LEDs now interferes with keyboard and
ps/2 mouse input and makes the kernel lose key press and key release
events.

Short demonstation:
#!/bin/sh
while :; do xset led 3; xset -led 3; sleep 0.01; done

This script works from X but the same effect can be seen on the console
using setleds. The problem was found with ledcontrol package but is
easyly reproduced with the script above.

Key press and release events are lost, mouse movement is lost or
movement is converted into clicks or mouse loses sync (by dmesg info).
There are also messages like
atkbd.c: Unknown key released (translated set 2, code 0xe0 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e060 <keycode>' to make it known.
in dmesg.

Don't try the script without the sleep command unless you have a network
connection to log in and kill the script ;)

--
Meelis Roos ([email protected])


2005-01-05 18:28:42

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

On Wednesday 05 January 2005 12:04 pm, Meelis Roos wrote:
>
> The input changes in 2.6.9 made keyboard LED setting unreliable. 2.6.8
> is OK, 2.6.9, 2.6.10 and todays BK are buggy.
>
> The problem is that setting the LEDs now interferes with keyboard and
> ps/2 mouse input and makes the kernel lose key press and key release
> events.
>
> Short demonstation:
> #!/bin/sh
> while :; do xset led 3; xset -led 3; sleep 0.01; done
>
> This script works from X but the same effect can be seen on the console
> using setleds. The problem was found with ledcontrol package but is
> easyly reproduced with the script above.
>
> Key press and release events are lost, mouse movement is lost or
> movement is converted into clicks or mouse loses sync (by dmesg info).
> There are also messages like
> atkbd.c: Unknown key released (translated set 2, code 0xe0 on isa0060/serio0).
> atkbd.c: Use 'setkeycodes e060 <keycode>' to make it known.
> in dmesg.
>
> Don't try the script without the sleep command unless you have a network
> connection to log in and kill the script ;)
>

Seems to work fine here. The led is blinking rapidly but I can type just
fine and touchpad works as well.

What kind of box do you have? UP/SMP, Preempt?

--
Dmitry

2005-01-05 18:38:53

by Meelis Roos

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

> Seems to work fine here. The led is blinking rapidly but I can type just
> fine and touchpad works as well.
>
> What kind of box do you have? UP/SMP, Preempt?

UP, Celeron 900 on i815. Happens on 2 identical computers, one preempt,
one not preempt. PS/2 keyboard and mouse on one, only PS/2 keyboard on
the other (and USB mouse that is probably unimportant).

--
Meelis Roos

2005-01-05 19:04:26

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

On Wed, 5 Jan 2005 20:38:34 +0200 (EET), Meelis Roos <[email protected]> wrote:
> > Seems to work fine here. The led is blinking rapidly but I can type just
> > fine and touchpad works as well.
> >
> > What kind of box do you have? UP/SMP, Preempt?
>
> UP, Celeron 900 on i815. Happens on 2 identical computers, one preempt,
> one not preempt. PS/2 keyboard and mouse on one, only PS/2 keyboard on
> the other (and USB mouse that is probably unimportant).
>

The big input update went in with 2.6.9-rc2-bk4.Could you try booting
-bk3 and -bk4 to verify that those changes are to blame?

--
Dmitry

2005-01-06 00:12:08

by Ville Hallik

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

In article <[email protected]> you wrote:
> On Wed, 5 Jan 2005 20:38:34 +0200 (EET), Meelis Roos <[email protected]> wrote:
>> > Seems to work fine here. The led is blinking rapidly but I can type just
>> > fine and touchpad works as well.
>> >
>> > What kind of box do you have? UP/SMP, Preempt?
>>
>> UP, Celeron 900 on i815. Happens on 2 identical computers, one preempt,
>> one not preempt. PS/2 keyboard and mouse on one, only PS/2 keyboard on
>> the other (and USB mouse that is probably unimportant).
>>

> The big input update went in with 2.6.9-rc2-bk4.Could you try booting
> -bk3 and -bk4 to verify that those changes are to blame?

No, this bug appears with 2.6.9-rc2-bk3. I'm afraid that introduction of
atkbd_schedule_command() & related stuff into atkbd.c is to blame.

--

Ville Hallik

2005-01-06 06:44:09

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

On Wednesday 05 January 2005 07:12 pm, Ville Hallik wrote:
> In article <[email protected]> you wrote:
> > On Wed, 5 Jan 2005 20:38:34 +0200 (EET), Meelis Roos <[email protected]> wrote:
> >> > Seems to work fine here. The led is blinking rapidly but I can type just
> >> > fine and touchpad works as well.
> >> >
> >> > What kind of box do you have? UP/SMP, Preempt?
> >>
> >> UP, Celeron 900 on i815. Happens on 2 identical computers, one preempt,
> >> one not preempt. PS/2 keyboard and mouse on one, only PS/2 keyboard on
> >> the other (and USB mouse that is probably unimportant).
> >>
>
> > The big input update went in with 2.6.9-rc2-bk4.Could you try booting
> > -bk3 and -bk4 to verify that those changes are to blame?
>
> No, this bug appears with 2.6.9-rc2-bk3. I'm afraid that introduction of
> atkbd_schedule_command() & related stuff into atkbd.c is to blame.
>

Actually it is ACK processing hardening that is very useful at setup stage
but is getting in our way once keyboard is initialized and commands are
intermixed with good data.

Could you please try the patch below? It is just a quick hack, just to prove
the idea. If it works for you I will prepare the proper fix later.

--
Dmitry

===== drivers/input/serio/libps2.c 1.2 vs edited =====
--- 1.2/drivers/input/serio/libps2.c 2004-10-20 03:13:08 -05:00
+++ edited/drivers/input/serio/libps2.c 2005-01-06 01:20:11 -05:00
@@ -250,7 +250,7 @@
}
/* Fall through */
default:
- return 1;
+ return 0;
}

if (!ps2dev->nak && ps2dev->cmdcnt)

2005-01-06 08:30:29

by Meelis Roos

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

> Could you please try the patch below? It is just a quick hack, just to prove
> the idea. If it works for you I will prepare the proper fix later.

Seems to cure it, cannot find any problems in 100+ keypresses.

--
Meelis Roos

2005-01-06 14:50:23

by Ville Hallik

[permalink] [raw]
Subject: Re: 2.6.9+ keyboard LED problem

In article <[email protected]> you wrote:

> Actually it is ACK processing hardening that is very useful at setup stage
> but is getting in our way once keyboard is initialized and commands are
> intermixed with good data.

> Could you please try the patch below? It is just a quick hack, just to prove
> the idea. If it works for you I will prepare the proper fix later.

> --
> Dmitry

> ===== drivers/input/serio/libps2.c 1.2 vs edited =====
> --- 1.2/drivers/input/serio/libps2.c 2004-10-20 03:13:08 -05:00
> +++ edited/drivers/input/serio/libps2.c 2005-01-06 01:20:11 -05:00
> @@ -250,7 +250,7 @@
> }
> /* Fall through */
> default:
> - return 1;
> + return 0;
> }
>
> if (!ps2dev->nak && ps2dev->cmdcnt)

This quick hack works for me too. Thanks!

However, it is still easy to make PS/2 keyboard and mouse completely
unusable with the following "sleepless" shell script (but it probably does
not qualify as DoS because access to PS/2 keyboard is limited to local user
only):

while : ; do xset led 3 ; xset -led 3 ; done

Even after killing this over network login, both keyboard and mouse are
still unresponsive for about 10..20 seconds. It was not that fatal with 2.6.8.

--

Ville Hallik