/** * ir_jvc_decode() - Decode one JVC pulse or space * @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine
*/ staticint ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
{ struct jvc_dec *data = &dev->raw->jvc;
if (!is_timing_event(ev)) { if (ev.overflow)
data->state = STATE_INACTIVE; return 0;
}
if (!geq_margin(ev.duration, JVC_UNIT, JVC_UNIT / 2)) goto out;
dev_dbg(&dev->dev, "JVC decode started at state %d (%uus %s)\n",
data->state, ev.duration, TO_STR(ev.pulse));
again: switch (data->state) {
case STATE_INACTIVE: if (!ev.pulse) break;
if (!eq_margin(ev.duration, JVC_HEADER_PULSE, JVC_UNIT / 2)) break;
/** * ir_jvc_encode() - Encode a scancode as a stream of raw events * * @protocol: protocol to encode * @scancode: scancode to encode * @events: array of raw ir events to write into * @max: maximum size of @events * * Returns: The number of events written. * -ENOBUFS if there isn't enough space in the array to fit the * encoding. In this case all @max events will have been written.
*/ staticint ir_jvc_encode(enum rc_proto protocol, u32 scancode, struct ir_raw_event *events, unsignedint max)
{ struct ir_raw_event *e = events; int ret;
u32 raw = (bitrev8((scancode >> 8) & 0xff) << 8) |
(bitrev8((scancode >> 0) & 0xff) << 0);
ret = ir_raw_gen_pd(&e, max, &ir_jvc_timings, JVC_NBITS, raw); if (ret < 0) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.