Change the debounce logic so that it is not used at all unless the
debounce parameter has been set. This makes for a much "snappier" remote
for most users as there is no timeout to wait for (the debounce logic has
a 350ms timer for the next repeat, but with the RC5 protocol, one event
per ~110ms is possible)

Signed-off-by: David Härdeman <[EMAIL PROTECTED]>


Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget-ci.c      2006-10-02 
20:28:19.000000000 +0200
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c   2006-10-02 
20:29:07.000000000 +0200
@@ -152,27 +152,32 @@
        if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && 
budget_ci->ir.rc5_device != device)
                return;
 
-       /* Are we still waiting for a keyup event while this is a new key? */
-       if ((ir_key != dev->repeat_key || toggle != prev_toggle) && 
del_timer(&dev->timer))
-               ir_input_nokey(dev, &budget_ci->ir.state);
-
-       prev_toggle = toggle;
-
        /* Ignore repeated key sequences if requested */
-       if (ir_key == dev->repeat_key && bounces > 0 && 
timer_pending(&dev->timer)) {
+       if (toggle == prev_toggle && ir_key == dev->repeat_key &&
+           bounces > 0 && timer_pending(&dev->timer)) {
+               if (ir_debug)
+                       printk("budget_ci: debounce logic ignored IR 
command\n");
                bounces--;
                return;
        }
+       prev_toggle = toggle;
 
-       /* New keypress? */
-       if (!timer_pending(&dev->timer))
-               bounces = debounce;
+       /* Are we still waiting for a keyup event? */
+       if (del_timer(&dev->timer))
+               ir_input_nokey(dev, &budget_ci->ir.state);
 
-       /* Prepare a keyup event sometime in the future */
-       mod_timer(&dev->timer, jiffies + msecs_to_jiffies(IR_REPEAT_TIMEOUT));
+       /* Generate keypress */
+       if (ir_debug)
+               printk("budget_ci: generating keypress 0x%02x\n", ir_key);
+       ir_input_keydown(dev, &budget_ci->ir.state, ir_key, (ir_key & (command 
<< 8)));
 
-       /* Generate a new or repeated keypress */
-       ir_input_keydown(dev, &budget_ci->ir.state, ir_key, ((device << 8) | 
command));
+       /* Do we want to delay the keyup event? */
+       if (debounce) {
+               bounces = debounce;
+               mod_timer(&dev->timer, jiffies + 
msecs_to_jiffies(IR_REPEAT_TIMEOUT));
+       } else {
+               ir_input_nokey(dev, &budget_ci->ir.state);
+       }
 }
 
 static int msp430_ir_init(struct budget_ci *budget_ci)
@@ -244,11 +249,9 @@
                break;
        }
 
-       /* initialise the key-up timeout handler */
+       /* initialise the key-up debounce timeout handler */
        input_dev->timer.function = msp430_ir_keyup;
        input_dev->timer.data = (unsigned long) &budget_ci->ir;
-       input_dev->rep[REP_DELAY] = 1;
-       input_dev->rep[REP_PERIOD] = 1;
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
        error = input_register_device(input_dev);

--
David Härdeman


_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Reply via email to