From 4167b06337ccdfe8987ec8c505f007740f6342bc Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Sat, 31 Jul 2010 11:59:20 -0300 Subject: [PATCH] --- yaml --- r: 208159 b: refs/heads/master c: 86ff071cad3e7e4c7469b3941bfced6fe9b04b5f h: refs/heads/master i: 208157: 2ea8935b867e3e9183b769a7814441bed486047b 208155: 6057cc839ba3c5cedbb2e21eb22389f69839825a 208151: f17c00870fce2527a949a9d204829d233ffd2359 208143: 2a25ed563f0d6a0a1dde89aa7a8d5c12fb996f05 208127: f2c2be7b7e7d553437153cce850ddb349304fb32 v: v3 --- [refs] | 2 +- trunk/drivers/media/IR/ir-core-priv.h | 2 ++ trunk/drivers/media/IR/ir-nec-decoder.c | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 20db49fad935..c610d3737f83 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e31f41278f0bed38ee16b55d09b49bed2f1b2085 +refs/heads/master: 86ff071cad3e7e4c7469b3941bfced6fe9b04b5f diff --git a/trunk/drivers/media/IR/ir-core-priv.h b/trunk/drivers/media/IR/ir-core-priv.h index 84c7a9a5cad4..502d477b391c 100644 --- a/trunk/drivers/media/IR/ir-core-priv.h +++ b/trunk/drivers/media/IR/ir-core-priv.h @@ -45,6 +45,8 @@ struct ir_raw_event_ctrl { int state; unsigned count; u32 bits; + bool is_nec_x; + bool necx_repeat; } nec; struct rc5_dec { int state; diff --git a/trunk/drivers/media/IR/ir-nec-decoder.c b/trunk/drivers/media/IR/ir-nec-decoder.c index 1c0cf0300d2d..d597421d6547 100644 --- a/trunk/drivers/media/IR/ir-nec-decoder.c +++ b/trunk/drivers/media/IR/ir-nec-decoder.c @@ -26,6 +26,7 @@ #define NEC_BIT_1_SPACE (3 * NEC_UNIT) #define NEC_TRAILER_PULSE (1 * NEC_UNIT) #define NEC_TRAILER_SPACE (10 * NEC_UNIT) /* even longer in reality */ +#define NECX_REPEAT_BITS 1 enum nec_state { STATE_INACTIVE, @@ -67,8 +68,12 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) if (!ev.pulse) break; - if (!eq_margin(ev.duration, NEC_HEADER_PULSE, NEC_UNIT / 2) && - !eq_margin(ev.duration, NECX_HEADER_PULSE, NEC_UNIT / 2)) + if (eq_margin(ev.duration, NEC_HEADER_PULSE, NEC_UNIT / 2)) { + data->is_nec_x = false; + data->necx_repeat = false; + } else if (eq_margin(ev.duration, NECX_HEADER_PULSE, NEC_UNIT / 2)) + data->is_nec_x = true; + else break; data->count = 0; @@ -105,6 +110,17 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) if (ev.pulse) break; + if (data->necx_repeat && data->count == NECX_REPEAT_BITS && + geq_margin(ev.duration, + NEC_TRAILER_SPACE, NEC_UNIT / 2)) { + IR_dprintk(1, "Repeat last key\n"); + ir_repeat(input_dev); + data->state = STATE_INACTIVE; + return 0; + + } else if (data->count > NECX_REPEAT_BITS) + data->necx_repeat = false; + data->bits <<= 1; if (eq_margin(ev.duration, NEC_BIT_1_SPACE, NEC_UNIT / 2)) data->bits |= 1; @@ -159,6 +175,9 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); } + if (data->is_nec_x) + data->necx_repeat = true; + ir_keydown(input_dev, scancode, 0); data->state = STATE_INACTIVE; return 0;