diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2010-07-31 11:59:18 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 23:42:59 -0300 |
commit | 39b2c0687b238d8bce19d5e8c0c8dc4e7fe50ed4 (patch) | |
tree | f2309da376fbb73480bfb7407156f41682cb80e3 /drivers/media | |
parent | 0d2cb1de8e81ffc06df67853be5ead3556d3a6b5 (diff) | |
download | op-kernel-dev-39b2c0687b238d8bce19d5e8c0c8dc4e7fe50ed4.zip op-kernel-dev-39b2c0687b238d8bce19d5e8c0c8dc4e7fe50ed4.tar.gz |
V4L/DVB: IR: JVC: make repeat work
Currently, jvc decoder will attempt misdetect next press as a repeat
of last keypress, therefore second keypress isn't detected.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/IR/ir-jvc-decoder.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/media/IR/ir-jvc-decoder.c b/drivers/media/IR/ir-jvc-decoder.c index 8894d8b..77a89c4 100644 --- a/drivers/media/IR/ir-jvc-decoder.c +++ b/drivers/media/IR/ir-jvc-decoder.c @@ -32,6 +32,7 @@ enum jvc_state { STATE_BIT_SPACE, STATE_TRAILER_PULSE, STATE_TRAILER_SPACE, + STATE_CHECK_REPEAT, }; /** @@ -60,6 +61,7 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev) IR_dprintk(2, "JVC decode started at state %d (%uus %s)\n", data->state, TO_US(ev.duration), TO_STR(ev.pulse)); +again: switch (data->state) { case STATE_INACTIVE: @@ -149,8 +151,18 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev) } data->count = 0; - data->state = STATE_BIT_PULSE; + data->state = STATE_CHECK_REPEAT; return 0; + + case STATE_CHECK_REPEAT: + if (!ev.pulse) + break; + + if (eq_margin(ev.duration, JVC_HEADER_PULSE, JVC_UNIT / 2)) + data->state = STATE_INACTIVE; + else + data->state = STATE_BIT_PULSE; + goto again; } out: |