// SPDX-License-Identifier: GPL-2.0-or-later /* * Loopback driver for rc-core, * * Copyright (c) 2010 David Härdeman <david@hardeman.nu> * * This driver receives TX data and passes it back as RX data, * which is useful for (scripted) debugging of rc-core without * having to use actual hardware.
*/
for (i = 0; i < count; i++) {
rawir.pulse = i % 2 ? false : true;
rawir.duration = txbuf[i];
/* simulate overflow if ridiculously long pulse was sent */ if (rawir.pulse && rawir.duration > MS_TO_US(50))
ir_raw_event_overflow(dev); else
ir_raw_event_store_with_filter(dev, &rawir);
}
/* Fake a silence long enough to cause us to go idle */
rawir.pulse = false;
rawir.duration = dev->timeout;
ir_raw_event_store_with_filter(dev, &rawir);
staticint loop_set_wakeup_filter(struct rc_dev *dev, struct rc_scancode_filter *sc)
{ staticconstunsignedint max = 512; struct ir_raw_event *raw; int ret; int i;
/* fine to disable filter */ if (!sc->mask) return 0;
/* encode the specified filter and loop it back */
raw = kmalloc_array(max, sizeof(*raw), GFP_KERNEL); if (!raw) return -ENOMEM;
ret = ir_raw_encode_scancode(dev->wakeup_protocol, sc->data, raw, max); /* still loop back the partial raw IR even if it's incomplete */ if (ret == -ENOBUFS)
ret = max; if (ret >= 0) { /* do the loopback */ for (i = 0; i < ret; ++i)
ir_raw_event_store(dev, &raw[i]);
ir_raw_event_handle(dev);
ret = 0;
}
kfree(raw);
return ret;
}
staticint __init loop_init(void)
{ struct rc_dev *rc; int ret;
rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) return -ENOMEM;
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.