ATi Remote key repeat

Message ID 200607022107.55781@orion.escape-edv.de
State New
Headers

Commit Message

Oliver Endriss July 2, 2006, 7:07 p.m. UTC
  Chris Jones wrote:
> Hi
> 
> On Wed, 2006-06-28 at 01:28 +0200, Oliver Endriss wrote:
> > Please try the evtest tool from the dvb-apps package and
> > post its output for a short key press and for a long one.
> 
> Here is the output. I pressed the play button in both cases:
> 
> cmsj@tenshu:~$ evtest /dev/input/event4
> Input driver version is 1.0.0
> Input device ID: bus 0x3 vendor 0xbc7 product 0x4 version 0x100
> Input device name: "X10 Wireless Technology Inc USB Receiver"
> Supported events:
>   Event type 0 (Reset)
>     Event code 0 (Reset)
>     Event code 1 (Key)
>     Event code 2 (Relative)
> ...
> Testing ... (interrupt to exit)
> Event: time 1151653959.792243, type 1 (Key), code 207 (?), value 1
> Event: time 1151653959.792246, type 1 (Key), code 207 (?), value 0
> Event: time 1151653959.792248, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653959.880230, type 1 (Key), code 207 (?), value 1
> Event: time 1151653959.880233, type 1 (Key), code 207 (?), value 0
> Event: time 1151653959.880235, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653959.928229, type 1 (Key), code 207 (?), value 1
> Event: time 1151653959.928232, type 1 (Key), code 207 (?), value 0
> Event: time 1151653959.928234, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653959.976214, type 1 (Key), code 207 (?), value 1
> Event: time 1151653959.976218, type 1 (Key), code 207 (?), value 0
> Event: time 1151653959.976220, type 0 (Reset), code 0 (Reset), value 0

> Event: time 1151653964.559472, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.559476, type 1 (Key), code 207 (?), value 0
> Event: time 1151653964.559478, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653964.607473, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.607477, type 1 (Key), code 207 (?), value 0
> Event: time 1151653964.607479, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653964.743449, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.743453, type 1 (Key), code 207 (?), value 0
> Event: time 1151653964.743455, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653964.791438, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.791443, type 1 (Key), code 207 (?), value 0
> Event: time 1151653964.791445, type 0 (Reset), code 0 (Reset), value 0
> ...
> Event: time 1151653965.991242, type 1 (Key), code 207 (?), value 1
> Event: time 1151653965.991246, type 1 (Key), code 207 (?), value 0
> Event: time 1151653965.991248, type 0 (Reset), code 0 (Reset), value 0
> Event: time 1151653966.039234, type 1 (Key), code 207 (?), value 1
> Event: time 1151653966.039237, type 1 (Key), code 207 (?), value 0
> Event: time 1151653966.039239, type 0 (Reset), code 0 (Reset), value 0

This driver is terribly broken! Key repeat does not work correctly.
A correct driver would send for a single short press:

> Event: time 1151653964.791438, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.791443, type 1 (Key), code 207 (?), value 0

For a long press:

> Event: time 1151653964.559472, type 1 (Key), code 207 (?), value 1
> Event: time 1151653964.607473, type 1 (Key), code 207 (?), value 2
> ...
> Event: time 1151653964.743449, type 1 (Key), code 207 (?), value 2
> Event: time 1151653964.743453, type 1 (Key), code 207 (?), value 0

I omitted Reset events, as I don't know what they are used for.
Reset events seem to be ok. The keyboard driver generates them, too.

There is a bug in the remote plugin. It misinterprets Reset as a key
release. Reset should be ignored. Please try the attached patch.

Oliver
  

Comments

Chris Jones July 2, 2006, 10:26 p.m. UTC | #1
Hi

On Sun, 2006-07-02 at 21:07 +0200, Oliver Endriss wrote:
> This driver is terribly broken! Key repeat does not work correctly.
> A correct driver would send for a single short press:

Should I report this upstream to the kernel?

> There is a bug in the remote plugin. It misinterprets Reset as a key
> release. Reset should be ignored. Please try the attached patch.

I applied it, rebuilt the remote module and restarted vdr, but it
doesn't seem to have made a huge difference, but is that just because
the kernel is spewing way too many events?

Cheers,
  
Marko Mäkelä July 3, 2006, 6:03 a.m. UTC | #2
On Sun, Jul 02, 2006 at 11:26:22PM +0100, Chris Jones wrote:
> On Sun, 2006-07-02 at 21:07 +0200, Oliver Endriss wrote:
> > This driver is terribly broken! Key repeat does not work correctly.
> > A correct driver would send for a single short press:
> 
> Should I report this upstream to the kernel?

Yes.

> > There is a bug in the remote plugin. It misinterprets Reset as a key
> > release. Reset should be ignored. Please try the attached patch.
> 
> I applied it, rebuilt the remote module and restarted vdr, but it
> doesn't seem to have made a huge difference, but is that just because
> the kernel is spewing way too many events?

The patch would only make a difference if the kernel didn't send any
bogus release events.  The patch was necessary for the cx88 remote,
because otherwise the remote plugin would convert each repeat event
to a new key press event.

	Marko
  

Patch

Common subdirectories: remote-0.3.7/misc and remote-0.3.8/misc
diff -pu remote-0.3.7/remote.c remote-0.3.8/remote.c
--- remote-0.3.7/remote.c	Sat Apr 29 21:22:01 2006
+++ remote-0.3.8/remote.c	Sun May 14 18:43:01 2006
@@ -419,7 +419,10 @@  uint64 cRemoteDevInput::getKey(void)
     int n;
     uint64 code;
 
-    n = read(fh, &ev, sizeof ev);
+    do
+        n = read(fh, &ev, sizeof ev);
+    while (n == sizeof ev && ev.type != 1);
+
     if (n == sizeof ev)
     {
         if (ev.value)