{
DEFINE_IR_RAW_EVENT(rawir);
u8 sample;
+ bool event = false;
int i;
for (i = 0; i < fintek->pkts; i++) {
fit_dbg("Storing %s with duration %d",
rawir.pulse ? "pulse" : "space",
rawir.duration);
- ir_raw_event_store_with_filter(fintek->rdev, &rawir);
+ if (ir_raw_event_store_with_filter(fintek->rdev,
+ &rawir))
+ event = true;
break;
}
fintek->pkts = 0;
- fit_dbg("Calling ir_raw_event_handle");
- ir_raw_event_handle(fintek->rdev);
+ if (event) {
+ fit_dbg("Calling ir_raw_event_handle");
+ ir_raw_event_handle(fintek->rdev);
+ }
}
/* copy data from hardware rx register into driver buffer */
} else if (len >= 7) {
DEFINE_IR_RAW_EVENT(rawir);
unsigned i;
+ bool event = false;
init_ir_raw_event(&rawir);
RX_RESOLUTION;
}
- ir_raw_event_store_with_filter(ir->rc, &rawir);
+ if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+ event = true;
}
- ir_raw_event_handle(ir->rc);
+ if (event)
+ ir_raw_event_handle(ir->rc);
}
}
* This routine (which may be called from an interrupt context) works
* in similar manner to ir_raw_event_store_edge.
* This routine is intended for devices with limited internal buffer
- * It automerges samples of same type, and handles timeouts
+ * It automerges samples of same type, and handles timeouts. Returns non-zero
+ * if the event was added, and zero if the event was ignored due to idle
+ * processing.
*/
int ir_raw_event_store_with_filter(struct rc_dev *dev, struct ir_raw_event *ev)
{
dev->raw->this_ev.duration >= dev->timeout)
ir_raw_event_set_idle(dev, true);
- return 0;
+ return 1;
}
EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter);
static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
{
DEFINE_IR_RAW_EVENT(rawir);
+ bool event = false;
int i = 0;
/* skip meaningless 0xb1 0x60 header bytes on orig receiver */
rawir.pulse ? "pulse" : "space",
rawir.duration);
- ir_raw_event_store_with_filter(ir->rc, &rawir);
+ if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+ event = true;
break;
case CMD_DATA:
ir->rem--;
if (ir->parser_state != CMD_HEADER && !ir->rem)
ir->parser_state = CMD_HEADER;
}
- mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n");
- ir_raw_event_handle(ir->rc);
+ if (event) {
+ mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n");
+ ir_raw_event_handle(ir->rc);
+ }
}
static void mceusb_dev_recv(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);
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 */
}
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)