The patch number 9612 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
Fix key repetition with HVR-950 IR


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/em28xx/em28xx-input.c |   23 ++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff -r 8782d5c6570c -r c57f10c4ca78 
linux/drivers/media/video/em28xx/em28xx-input.c
--- a/linux/drivers/media/video/em28xx/em28xx-input.c   Wed Nov 12 15:05:46 
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-input.c   Wed Nov 12 19:46:01 
2008 -0200
@@ -68,6 +68,7 @@ struct em28xx_IR {
        u32 mask_keycode;
        u32 mask_keydown;
        u32 mask_keyup;
+       u32 mask_repeat;
 
        int  (*get_key)(struct em28xx_IR *);
 };
@@ -171,15 +172,17 @@ static int default_polling_getkey(struct
 {
        struct em28xx *dev = ir->dev;
        int rc;
-       u32 msg;
-
-       /* Read key toggle, brand, and key code */
+       u8 msg[4] = { 0, 0, 0, 0 };
+
+       /* Read key toggle, brand, and key code
+          on registers 0x45, 0x46 and 0x47
+        */
        rc = dev->em28xx_read_reg_req_len(dev, 0, EM28XX_R45_IR,
-                                         (u8 *)&msg, sizeof(msg));
+                                         msg, sizeof(msg));
        if (rc < 0)
                return rc;
 
-       return (int)(msg & 0x7fffffffl);
+       return (int)(le32_to_cpu(*(u32 *)msg));
 }
 
 /**********************************************************
@@ -198,6 +201,7 @@ static void em28xx_ir_handle_key(struct 
 
        if (gpio == ir->last_gpio)
                return;
+
        ir->last_gpio = gpio;
 
        /* extract data */
@@ -220,6 +224,14 @@ static void em28xx_ir_handle_key(struct 
                        ir_input_keydown(ir->input, &ir->ir, data, data);
                else
                        ir_input_nokey(ir->input, &ir->ir);
+       } else if (ir->mask_repeat) {
+               int count = ir->mask_repeat & gpio;
+
+               /* Avoid keyboard bouncing */
+               if ((count == 1) || (count >= 5)) {
+                       ir_input_keydown(ir->input, &ir->ir, data, data);
+                       ir_input_nokey(ir->input, &ir->ir);
+               }
        } else {
                /* can't distinguish keydown/up :-/ */
                ir_input_keydown(ir->input, &ir->ir, data, data);
@@ -292,6 +304,7 @@ int em28xx_ir_init(struct em28xx *dev)
                ir_type          = IR_TYPE_OTHER;
                ir_codes         = ir_codes_hauppauge_new;
                ir->mask_keycode = 0x007f0000;
+               ir->mask_repeat  = 0x0000007f;
                break;
        }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/c57f10c4ca787a28b8b28a243d547fa78c11588f

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to