]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/media/IR/ir-keytable.c
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[net-next-2.6.git] / drivers / media / IR / ir-keytable.c
index 5ca36a42f01961a3fe95041e2d2ac2286e19ed82..9186b45132ed8d14d9274b6d32315a460a8ba471 100644 (file)
@@ -435,7 +435,7 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
  * This routine is used to signal that a key has been released on the
  * remote control. It reports a keyup input event via input_report_key().
  */
-static void ir_keyup(struct ir_input_dev *ir)
+void ir_keyup(struct ir_input_dev *ir)
 {
        if (!ir->keypressed)
                return;
@@ -445,6 +445,7 @@ static void ir_keyup(struct ir_input_dev *ir)
        input_sync(ir->input_dev);
        ir->keypressed = false;
 }
+EXPORT_SYMBOL_GPL(ir_keyup);
 
 /**
  * ir_timer_keyup() - generates a keyup event after a timeout
@@ -469,7 +470,7 @@ static void ir_timer_keyup(unsigned long cookie)
         * a keyup event might follow immediately after the keydown.
         */
        spin_lock_irqsave(&ir->keylock, flags);
-       if (time_is_after_eq_jiffies(ir->keyup_jiffies))
+       if (time_is_before_eq_jiffies(ir->keyup_jiffies))
                ir_keyup(ir);
        spin_unlock_irqrestore(&ir->keylock, flags);
 }
@@ -640,11 +641,22 @@ int __ir_input_register(struct input_dev *input_dev,
                                goto out_event;
                }
 
+       rc = ir_register_input(input_dev);
+       if (rc < 0)
+               goto out_event;
+
        IR_dprintk(1, "Registered input device on %s for %s remote%s.\n",
                   driver_name, rc_tab->name,
                   (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ?
                        " in raw mode" : "");
 
+       /*
+        * Default delay of 250ms is too short for some protocols, expecially
+        * since the timeout is currently set to 250ms. Increase it to 500ms,
+        * to avoid wrong repetition of the keycodes.
+        */
+       input_dev->rep[REP_DELAY] = 500;
+
        return 0;
 
 out_event: