diff options
author | David Hardeman <david@hardeman.nu> | 2006-12-02 18:16:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:05:19 -0500 |
commit | 59236d46dab429646b023026ac92d9e8c732c18a (patch) | |
tree | 30bf82ef313be3e807474f50d688572512804209 /drivers/media/dvb | |
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>
Diffstat (limited to 'drivers/media/dvb')
-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 2a3707c87942..83a1c5f44a0a 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) | |||
159 | if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && budget_ci->ir.rc5_device != device) | 159 | if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && budget_ci->ir.rc5_device != device) |
160 | return; | 160 | return; |
161 | 161 | ||
162 | /* Are we still waiting for a keyup event while this is a new key? */ | ||
163 | if ((ir_key != dev->repeat_key || toggle != prev_toggle) && del_timer(&dev->timer)) | ||
164 | ir_input_nokey(dev, &budget_ci->ir.state); | ||
165 | |||
166 | prev_toggle = toggle; | ||
167 | |||
168 | /* Ignore repeated key sequences if requested */ | 162 | /* Ignore repeated key sequences if requested */ |
169 | if (ir_key == dev->repeat_key && bounces > 0 && timer_pending(&dev->timer)) { | 163 | if (toggle == prev_toggle && ir_key == dev->repeat_key && |
164 | bounces > 0 && timer_pending(&dev->timer)) { | ||
165 | if (ir_debug) | ||
166 | printk("budget_ci: debounce logic ignored IR command\n"); | ||
170 | bounces--; | 167 | bounces--; |
171 | return; | 168 | return; |
172 | } | 169 | } |
170 | prev_toggle = toggle; | ||
173 | 171 | ||
174 | /* New keypress? */ | 172 | /* Are we still waiting for a keyup event? */ |
175 | if (!timer_pending(&dev->timer)) | 173 | if (del_timer(&dev->timer)) |
176 | bounces = debounce; | 174 | ir_input_nokey(dev, &budget_ci->ir.state); |
177 | 175 | ||
178 | /* Prepare a keyup event sometime in the future */ | 176 | /* Generate keypress */ |
179 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(IR_REPEAT_TIMEOUT)); | 177 | if (ir_debug) |
178 | printk("budget_ci: generating keypress 0x%02x\n", ir_key); | ||
179 | ir_input_keydown(dev, &budget_ci->ir.state, ir_key, (ir_key & (command << 8))); | ||
180 | 180 | ||
181 | /* Generate a new or repeated keypress */ | 181 | /* Do we want to delay the keyup event? */ |
182 | ir_input_keydown(dev, &budget_ci->ir.state, ir_key, ((device << 8) | command)); | 182 | if (debounce) { |
183 | bounces = debounce; | ||
184 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(IR_REPEAT_TIMEOUT)); | ||
185 | } else { | ||
186 | ir_input_nokey(dev, &budget_ci->ir.state); | ||
187 | } | ||
183 | } | 188 | } |
184 | 189 | ||
185 | static void msp430_ir_debounce(unsigned long data) | 190 | static void msp430_ir_debounce(unsigned long data) |
@@ -297,11 +302,9 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
297 | break; | 302 | break; |
298 | } | 303 | } |
299 | 304 | ||
300 | /* initialise the key-up timeout handler */ | 305 | /* initialise the key-up debounce timeout handler */ |
301 | input_dev->timer.function = msp430_ir_keyup; | 306 | input_dev->timer.function = msp430_ir_keyup; |
302 | input_dev->timer.data = (unsigned long) &budget_ci->ir; | 307 | input_dev->timer.data = (unsigned long) &budget_ci->ir; |
303 | input_dev->rep[REP_DELAY] = 1; | ||
304 | input_dev->rep[REP_PERIOD] = 1; | ||
305 | 308 | ||
306 | error = input_register_device(input_dev); | 309 | error = input_register_device(input_dev); |
307 | if (error) { | 310 | if (error) { |