[linux-dvb] Problem with keys repeated

Greg 'groggy' Lehey grog at lemis.com
Wed Mar 7 02:05:52 CET 2007


On Tuesday,  6 March 2007 at 12:20:39 +0000, Dom H wrote:
> I've updated my machine and now my Logitech remote is giving me multiple
> events on a single keypress. I use the Logitech learning remote as a
> relacement for the original (which works fine) Card is a Hauppauge Win-TV
> Nova-T which I believe uses the budget-ci driver, I've heard this has been
> changed recently and this may be the problem? I've tried booting with a
> previous kernel but this doesn't work either as I assumed it was the built
> in driver changing that was causing the problem. Confused.

This (and many other reports of similar behaviour) looks like the
problem that I had with my DVICO remote control.  It suffers from
premature repeat: it's almost impossible to press a button without
creating at least one or two repeat events.

I've worked around this issue in LIRC with the following code in
daemons/hw_hiddev.c.  This is part of a patch which makes it work
under FreeBSD; the complete patch is available via
http://www.freebsd.org/cgi/pds.cgi?ports/comms/lirc

 	/*
 	 * This stuff is probably dvico specific.
 	 * I don't have any other hid devices to test...
 	 */
-	if (event.hid == 0x10046) {
-		repeat_flag = (main_code & dvico_repeat_mask);
+	if (pre_code == 0x10046) {
+                if (main_code & dvico_repeat_mask) /* repeated press */
+                	repeat_count++;                /* count them */
+                else
+                	repeat_count = 0;              /* reset */
+                repeat_flag = repeat_count > 2; /* real repeat flag */
 		main_code = (main_code & ~dvico_repeat_mask);
-		return decode_all(remotes);
+                        /*
+                         * Skip this if we're working around the premature
+                         * repeat.
+                         */
+                        if (repeat_flag || (repeat_count == 0))
+                        {
+				char *foo;
+
+                        	foo = decode_all(remotes);
+                                /*
+                                 * XXX Experimental code.  Chop off the first 12
+                                 * bytes of the hex code, which FreeBSD does not
+                                 * provide, and which I suspect nobody cares
+                                 * about.
+                                 *
+                                 * For some reason, we can get NULL back here,
+                                 * so we need to check for that before returning
+                                 * address 0xc.
+                                 */
+                                if (foo)
+                                  foo = &foo [12];     /* chop off the leading chars. */
+                                return foo;
+                        }
+                        else
+                        	return 0;                    /* no data */

Clearly the important line is:

+                repeat_flag = repeat_count > 2; /* real repeat flag */

Depending on the sensitivity of your remote control, you may need some
other value of 2.

Greg
--
Finger grog at lemis.com for PGP public key.
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20070307/aa13e996/attachment.pgp


More information about the linux-dvb mailing list