diff options
author | David Hardeman <david@hardeman.nu> | 2006-12-02 21:16:06 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 09:05:19 -0200 |
commit | 59236d46dab429646b023026ac92d9e8c732c18a (patch) | |
tree | 30bf82ef313be3e807474f50d688572512804209 | |
parent | b5471a27b48801507c5bd0eadd83730230515016 (diff) |
V4L/DVB (4882): budget-ci IR: make debounce logic conditional
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 Hardeman <david@hardeman.nu>
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 2a3707c8794..83a1c5f44a0 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -159,27 +159,32 @@ static void msp430_ir_interrupt(unsigned long data) 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 void msp430_ir_debounce(unsigned long data) @@ -297,11 +302,9 @@ static int msp430_ir_init(struct budget_ci *budget_ci) 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; error = input_register_device(input_dev); if (error) { |