[PATCH 6/6] ir-kbd-i2c: fix get_key_knc1()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- return valid key code when button is hold
- debug: print key code only when a button is pressed

Tested with device "Terratec Cinergy 200 USB" (em28xx).

Signed-off-by: Frank Schäfer <fschaefer.oss@xxxxxxxxxxxxxx>
---
 drivers/media/i2c/ir-kbd-i2c.c |   15 +++++----------
 1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-)

diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index 08ae067..2984b7d 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -184,18 +184,13 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 		return -EIO;
 	}
 
-	/* it seems that 0xFE indicates that a button is still hold
-	   down, while 0xff indicates that no button is hold
-	   down. 0xfe sequences are sometimes interrupted by 0xFF */
-
-	dprintk(2,"key %02x\n", b);
-
-	if (b == 0xff)
+	if (b == 0xff) /* no button */
 		return 0;
 
-	if (b == 0xfe)
-		/* keep old data */
-		return 1;
+	if (b == 0xfe) /* button is still hold */
+		b = ir->rc->last_scancode; /* keep old data */
+
+	dprintk(2,"key %02x\n", b);
 
 	*ir_key = b;
 	*ir_raw = b;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux