Commit 2c594ffa authored by Jarod Wilson's avatar Jarod Wilson Committed by Mauro Carvalho Chehab

[media] redrat3: cap duration in the right place

Trying to cap duration before multiplying it was obviously wrong.

CC: Chris Dodge <chris@redrat.co.uk>
CC: Andrew Vincer <andrew.vincer@redrat.co.uk>
CC: Stephen Cox <scox_nz@yahoo.com>
Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 68b2a69d
...@@ -496,9 +496,6 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) ...@@ -496,9 +496,6 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3)
u16 val = len_vals[data_vals[i]]; u16 val = len_vals[data_vals[i]];
single_len = redrat3_len_to_us((u32)be16_to_cpu(val)); single_len = redrat3_len_to_us((u32)be16_to_cpu(val));
/* cap the value to IR_MAX_DURATION */
single_len &= IR_MAX_DURATION;
/* we should always get pulse/space/pulse/space samples */ /* we should always get pulse/space/pulse/space samples */
if (i % 2) if (i % 2)
rawir.pulse = false; rawir.pulse = false;
...@@ -506,6 +503,9 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) ...@@ -506,6 +503,9 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3)
rawir.pulse = true; rawir.pulse = true;
rawir.duration = US_TO_NS(single_len); rawir.duration = US_TO_NS(single_len);
/* cap the value to IR_MAX_DURATION */
rawir.duration &= IR_MAX_DURATION;
rr3_dbg(dev, "storing %s with duration %d (i: %d)\n", rr3_dbg(dev, "storing %s with duration %d (i: %d)\n",
rawir.pulse ? "pulse" : "space", rawir.duration, i); rawir.pulse ? "pulse" : "space", rawir.duration, i);
ir_raw_event_store_with_filter(rr3->rc, &rawir); ir_raw_event_store_with_filter(rr3->rc, &rawir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment