diff options
Diffstat (limited to 'drivers/media/rc/ttusbir.c')
-rw-r--r-- | drivers/media/rc/ttusbir.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index 71f03acabac8..1aee57fd2f32 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -121,8 +121,9 @@ static void ttusbir_bulk_complete(struct urb *urb) */ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) { + struct ir_raw_event rawir; unsigned i, v, b; - DEFINE_IR_RAW_EVENT(rawir); + bool event = false; init_ir_raw_event(&rawir); @@ -132,12 +133,14 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) case 0xfe: rawir.pulse = false; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; case 0: rawir.pulse = true; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; default: /* one edge per byte */ @@ -150,16 +153,20 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) } rawir.duration = NS_PER_BIT * (8 - b); - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; rawir.pulse = !rawir.pulse; rawir.duration = NS_PER_BIT * b; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; } } - ir_raw_event_handle(tt->rc); + /* don't wakeup when there's nothing to do */ + if (event) + ir_raw_event_handle(tt->rc); } static void ttusbir_urb_complete(struct urb *urb) |