26 #ifdef HAVE_KERNEL_LIRC_H
27 #include <linux/lirc.h>
29 #include "media/lirc.h"
32 #include "lirc/driver.h"
33 #include "lirc/lirc_log.h"
34 #include "lirc/receive.h"
35 #include "lirc/ir_remote.h"
47 lirc_t data[RBUF_SIZE];
56 struct timeval last_signal_time;
65 static struct rbuf rec_buffer;
66 static int update_mode = 0;
74 int (*lircd_waitfordata)(uint32_t timeout) = NULL;
77 static lirc_t readdata(lirc_t timeout)
82 rec_buffer.at_eof = data &
LIRC_EOF ? 1 : 0;
83 if (rec_buffer.at_eof)
89 static lirc_t lirc_t_max(lirc_t a, lirc_t b)
94 static void set_pending_pulse(lirc_t deltap)
97 rec_buffer.pendingp = deltap;
100 static void set_pending_space(lirc_t deltas)
103 rec_buffer.pendings = deltas;
107 static void log_input(lirc_t data)
109 fprintf(rec_buffer.input_log,
"%s %u\n",
110 data & PULSE_BIT ?
"pulse" :
"space", data & PULSE_MASK);
111 fflush(rec_buffer.input_log);
115 static lirc_t get_next_rec_buffer_internal(lirc_t maxusec)
117 if (rec_buffer.rptr < rec_buffer.wptr) {
118 log_trace2(
"<%c%lu", rec_buffer.data[rec_buffer.rptr] & PULSE_BIT ?
'p' :
's', (uint32_t)
119 rec_buffer.data[rec_buffer.rptr] & (PULSE_MASK));
120 rec_buffer.sum += rec_buffer.data[rec_buffer.rptr] & (PULSE_MASK);
121 return rec_buffer.data[rec_buffer.rptr++];
123 if (rec_buffer.wptr < RBUF_SIZE) {
125 unsigned long elapsed = 0;
127 if (timerisset(&rec_buffer.last_signal_time)) {
128 struct timeval current;
130 gettimeofday(¤t, NULL);
131 elapsed = time_elapsed(&rec_buffer.last_signal_time, ¤t);
133 if (elapsed < maxusec)
134 data = readdata(maxusec - elapsed);
143 if (LIRC_IS_TIMEOUT(data)) {
144 log_trace(
"timeout received: %lu", (uint32_t)LIRC_VALUE(data));
145 if (LIRC_VALUE(data) < maxusec)
146 return get_next_rec_buffer_internal(maxusec - LIRC_VALUE(data));
150 rec_buffer.data[rec_buffer.wptr] = data;
151 if (rec_buffer.input_log != NULL)
153 if (rec_buffer.data[rec_buffer.wptr] == 0)
155 rec_buffer.sum += rec_buffer.data[rec_buffer.rptr]
159 log_trace2(
"+%c%lu", rec_buffer.data[rec_buffer.rptr - 1] & PULSE_BIT ?
'p' :
's', (uint32_t)
160 rec_buffer.data[rec_buffer.rptr - 1]
162 return rec_buffer.data[rec_buffer.rptr - 1];
164 rec_buffer.too_long = 1;
171 lircd_waitfordata = func;
178 struct pollfd pfd = {
181 if (lircd_waitfordata != NULL)
182 return lircd_waitfordata(maxusec);
187 ret = curl_poll(&pfd, 1, (maxusec > 0) ? (maxusec / 1000) : -1);
188 if (maxusec > 0 && ret == 0)
190 }
while (ret == -1 && errno == EINTR);
197 if (pfd.revents & POLLIN)
206 if (rec_buffer.input_log != NULL)
207 fclose(rec_buffer.input_log);
208 rec_buffer.input_log = f;
212 static lirc_t get_next_rec_buffer(lirc_t maxusec)
214 return get_next_rec_buffer_internal(receive_timeout(maxusec));
219 memset(&rec_buffer, 0,
sizeof(rec_buffer));
225 rec_buffer.too_long = 0;
226 set_pending_pulse(0);
227 set_pending_space(0);
229 rec_buffer.at_eof = 0;
241 timerclear(&rec_buffer.last_signal_time);
251 log_error(
"reading in mode LIRC_MODE_LIRCCODE failed");
254 for (i = 0, rec_buffer.decoded = 0; i < count; i++)
255 rec_buffer.decoded = (rec_buffer.decoded << CHAR_BIT) + ((
ir_code)buffer[i]);
259 move = rec_buffer.wptr - rec_buffer.rptr;
260 if (move > 0 && rec_buffer.rptr > 0) {
261 memmove(&rec_buffer.data[0], &rec_buffer.data[rec_buffer.rptr],
262 sizeof(rec_buffer.data[0]) * move);
263 rec_buffer.wptr -= rec_buffer.rptr;
268 log_trace2(
"c%lu", (uint32_t)data & (PULSE_MASK));
270 rec_buffer.data[rec_buffer.wptr] = data;
276 rec_buffer.is_biphase = 0;
281 static void unget_rec_buffer(
int count)
284 if (count == 1 || count == 2) {
285 rec_buffer.rptr -= count;
286 rec_buffer.sum -= rec_buffer.data[rec_buffer.rptr] & (PULSE_MASK);
288 rec_buffer.sum -= rec_buffer.data[rec_buffer.rptr + 1]
293 static void unget_rec_buffer_delta(lirc_t delta)
296 rec_buffer.sum -= delta & (PULSE_MASK);
297 rec_buffer.data[rec_buffer.rptr] = delta;
300 static lirc_t get_next_pulse(lirc_t maxusec)
304 data = get_next_rec_buffer(maxusec);
307 if (!is_pulse(data)) {
311 return data & (PULSE_MASK);
314 static lirc_t get_next_space(lirc_t maxusec)
318 data = get_next_rec_buffer(maxusec);
321 if (!is_space(data)) {
328 static int sync_pending_pulse(
struct ir_remote* remote)
330 if (rec_buffer.pendingp > 0) {
333 deltap = get_next_pulse(rec_buffer.pendingp);
336 if (!expect(remote, deltap, rec_buffer.pendingp))
338 set_pending_pulse(0);
343 static int sync_pending_space(
struct ir_remote* remote)
345 if (rec_buffer.pendings > 0) {
348 deltas = get_next_space(rec_buffer.pendings);
351 if (!expect(remote, deltas, rec_buffer.pendings))
353 set_pending_space(0);
358 static int expectpulse(
struct ir_remote* remote,
int exdelta)
364 if (!sync_pending_space(remote))
367 deltap = get_next_pulse(rec_buffer.pendingp + exdelta);
370 if (rec_buffer.pendingp > 0) {
371 if (rec_buffer.pendingp > deltap)
373 retval = expect(remote, deltap - rec_buffer.pendingp, exdelta);
376 set_pending_pulse(0);
378 retval = expect(remote, deltap, exdelta);
383 static int expectspace(
struct ir_remote* remote,
int exdelta)
389 if (!sync_pending_pulse(remote))
392 deltas = get_next_space(rec_buffer.pendings + exdelta);
395 if (rec_buffer.pendings > 0) {
396 if (rec_buffer.pendings > deltas)
398 retval = expect(remote, deltas - rec_buffer.pendings, exdelta);
401 set_pending_space(0);
403 retval = expect(remote, deltas, exdelta);
408 static int expectone(
struct ir_remote* remote,
int bit)
410 if (is_biphase(remote)) {
411 int all_bits = bit_count(remote);
414 mask = ((
ir_code)1) << (all_bits - 1 - bit);
416 if (remote->
sone > 0 && !expectspace(remote, 2 * remote->
sone)) {
420 set_pending_pulse(2 * remote->pone);
422 if (remote->
sone > 0 && !expectspace(remote, remote->
sone)) {
426 set_pending_pulse(remote->pone);
428 }
else if (is_space_first(remote)) {
429 if (remote->
sone > 0 && !expectspace(remote, remote->
sone)) {
433 if (remote->pone > 0 && !expectpulse(remote, remote->pone)) {
438 if (remote->pone > 0 && !expectpulse(remote, remote->pone)) {
443 if (remote->
sone > 0 && !expectspace(remote, remote->
sone)) {
448 set_pending_space(remote->
sone);
454 static int expectzero(
struct ir_remote* remote,
int bit)
456 if (is_biphase(remote)) {
457 int all_bits = bit_count(remote);
460 mask = ((
ir_code)1) << (all_bits - 1 - bit);
462 if (!expectpulse(remote, 2 * remote->pzero)) {
466 set_pending_space(2 * remote->
szero);
468 if (!expectpulse(remote, remote->pzero)) {
472 set_pending_space(remote->
szero);
474 }
else if (is_space_first(remote)) {
475 if (remote->
szero > 0 && !expectspace(remote, remote->
szero)) {
479 if (remote->pzero > 0 && !expectpulse(remote, remote->pzero)) {
484 if (!expectpulse(remote, remote->pzero)) {
489 if (!expectspace(remote, remote->
szero)) {
494 set_pending_space(remote->
szero);
500 static lirc_t sync_rec_buffer(
struct ir_remote* remote)
503 lirc_t deltas, deltap;
506 deltas = get_next_space(1000000);
512 deltap = get_next_pulse(1000000);
515 deltas = get_next_space(1000000);
519 if (count > REC_SYNC)
523 if (has_toggle_mask(remote)) {
525 remote->toggle_mask_state = 0;
534 static int get_header(
struct ir_remote* remote)
536 if (is_rcmm(remote)) {
537 lirc_t deltap, deltas, sum;
539 deltap = get_next_pulse(remote->phead);
544 deltas = get_next_space(remote->
shead);
549 sum = deltap + deltas;
550 if (expect(remote, sum, remote->phead + remote->
shead))
554 }
else if (is_bo(remote)) {
555 if (expectpulse(remote, remote->pone) && expectspace(remote, remote->
sone)
556 && expectpulse(remote, remote->pone) && expectspace(remote, remote->
sone)
557 && expectpulse(remote, remote->phead) && expectspace(remote, remote->
shead))
561 if (remote->
shead == 0) {
562 if (!sync_pending_space(remote))
564 set_pending_pulse(remote->phead);
567 if (!expectpulse(remote, remote->phead)) {
576 deltas = get_next_space(remote->
shead);
578 if (expect(remote, remote->
shead, deltas))
585 set_pending_space(remote->
shead);
589 static int get_foot(
struct ir_remote* remote)
591 if (!expectspace(remote, remote->
sfoot))
593 if (!expectpulse(remote, remote->pfoot))
598 static int get_lead(
struct ir_remote* remote)
600 if (remote->
plead == 0)
602 if (!sync_pending_space(remote))
604 set_pending_pulse(remote->
plead);
608 static int get_trail(
struct ir_remote* remote)
611 if (!expectpulse(remote, remote->
ptrail))
613 if (rec_buffer.pendingp > 0)
614 if (!sync_pending_pulse(remote))
619 static int get_gap(
struct ir_remote* remote, lirc_t gap)
624 data = get_next_rec_buffer(gap - gap * remote->
eps / 100);
627 if (!is_space(data)) {
632 if (!expect_at_least(remote, data, gap)) {
639 static int get_repeat(
struct ir_remote* remote)
641 if (!get_lead(remote))
643 if (is_biphase(remote)) {
644 if (!expectspace(remote, remote->
srepeat))
646 if (!expectpulse(remote, remote->prepeat))
649 if (!expectpulse(remote, remote->prepeat))
651 set_pending_space(remote->
srepeat);
653 if (!get_trail(remote))
657 is_const(remote) ? (min_gap(remote) >
659 min_gap(remote) - rec_buffer.sum : 0) :
660 (has_repeat_gap(remote) ? remote->
repeat_gap : min_gap(remote))
673 if (is_rcmm(remote)) {
674 lirc_t deltap, deltas, sum;
676 if (bits % 2 || done % 2) {
680 if (!sync_pending_space(remote))
682 for (i = 0; i < bits; i += 2) {
684 deltap = get_next_pulse(remote->pzero + remote->pone + remote->ptwo + remote->pthree);
686 if (deltap == 0 || deltas == 0) {
687 log_error(
"failed on bit %d", done + i + 1);
690 sum = deltap + deltas;
692 if (expect(remote, sum, remote->pzero + remote->
szero)) {
695 }
else if (expect(remote, sum, remote->pone + remote->
sone)) {
698 }
else if (expect(remote, sum, remote->ptwo + remote->
stwo)) {
701 }
else if (expect(remote, sum, remote->pthree + remote->
sthree)) {
705 log_trace1(
"no match for %d+%d=%d", deltap, deltas, sum);
710 }
else if (is_grundig(remote)) {
711 lirc_t deltap, deltas, sum;
712 int state, laststate;
714 if (bits % 2 || done % 2) {
718 if (!sync_pending_pulse(remote))
720 for (laststate = state = -1, i = 0; i < bits; ) {
722 deltap = get_next_pulse(remote->pzero + remote->pone + remote->ptwo + remote->pthree);
723 if (deltas == 0 || deltap == 0) {
724 log_error(
"failed on bit %d", done + i + 1);
727 sum = deltas + deltap;
728 log_trace2(
"grundig: sum %ld", (uint32_t)sum);
729 if (expect(remote, sum, remote->
szero + remote->pzero)) {
732 }
else if (expect(remote, sum, remote->
sone + remote->pone)) {
735 }
else if (expect(remote, sum, remote->
stwo + remote->ptwo)) {
738 }
else if (expect(remote, sum, remote->
sthree + remote->pthree)) {
742 log_trace1(
"no match for %d+%d=%d", deltas, deltap, sum);
750 }
else if (laststate == 2 && state == 0) {
755 }
else if (laststate == 1 && state == 1) {
760 }
else if (laststate == 0 && state == 2) {
765 }
else if (laststate == -1) {
768 log_error(
"invalid state %d:%d", laststate, state);
774 }
else if (is_serial(remote)) {
776 int space, stop_bit, parity_bit;
778 lirc_t delta, origdelta, pending, expecting, gap_delta;
780 lirc_t max_space, max_pulse;
782 base = 1000000 / remote->
baud;
785 set_pending_pulse(base);
788 space = (rec_buffer.pendingp == 0);
791 delta = origdelta = 0;
798 if (remote->
parity != IR_PARITY_NONE) {
800 max_space += remote->
sone;
801 max_pulse += remote->pzero;
805 while (received < bits || stop_bit) {
807 delta = space ? get_next_space(max_space) : get_next_pulse(max_pulse);
808 if (delta == 0 && space && received + remote->
bits_in_byte + parity_bit >= bits)
814 log_trace(
"failed before bit %d", received + 1);
817 pending = (space ? rec_buffer.pendings : rec_buffer.pendingp);
818 if (expect(remote, delta, pending)) {
820 }
else if (delta > pending) {
823 log_trace(
"failed before bit %d", received + 1);
831 set_pending_pulse(base);
832 set_pending_space(0);
838 set_pending_pulse(0);
839 set_pending_space(0);
841 space = (space ? 0 : 1);
845 expecting = (space ? remote->
sone : remote->pzero);
846 if (delta > expecting || expect(remote, delta, expecting)) {
847 delta -= (expecting > delta ? delta : expecting);
853 if (received % (remote->
bits_in_byte + parity_bit) == 0) {
856 if ((remote->
parity == IR_PARITY_EVEN && parity)
857 || (remote->
parity == IR_PARITY_ODD && !parity)) {
858 log_trace(
"parity error after %d bits", received + 1);
866 temp << remote->
bits_in_byte | reverse(code >> parity_bit,
869 if (space && delta == 0) {
870 log_trace(
"failed at stop bit after %d bits", received + 1);
874 set_pending_space(stop);
878 if (delta == origdelta) {
879 log_trace(
"framing error after %d bits", received + 1);
885 space = (space ? 0 : 1);
888 unget_rec_buffer_delta(gap_delta);
889 set_pending_pulse(0);
890 set_pending_space(0);
892 }
else if (is_bo(remote)) {
894 lirc_t deltap, deltas;
898 for (i = 0; i < bits; i++) {
900 deltap = get_next_pulse(remote->pzero + remote->pone + remote->ptwo + remote->pthree);
902 if (deltap == 0 || deltas == 0) {
903 log_error(
"failed on bit %d", done + i + 1);
907 pzero = remote->pone;
908 szero = remote->
sone;
912 pzero = remote->ptwo;
913 szero = remote->
stwo;
914 pone = remote->pthree;
917 log_trace2(
"%lu %lu %lu %lu", pzero, szero, pone, sone);
918 if (expect(remote, deltap, pzero)) {
919 if (expect(remote, deltas, szero)) {
927 if (expect(remote, deltap, pone)) {
928 if (expect(remote, deltas, sone)) {
935 log_error(
"failed on bit %d", done + i + 1);
939 }
else if (is_xmp(remote)) {
940 lirc_t deltap, deltas, sum;
943 if (bits % 4 || done % 4) {
947 if (!sync_pending_space(remote))
949 for (i = 0; i < bits; i += 4) {
951 deltap = get_next_pulse(remote->pzero);
952 deltas = get_next_space(remote->
szero + 16 * remote->
sone);
953 if (deltap == 0 || deltas == 0) {
954 log_error(
"failed on bit %d", done + i + 1);
957 sum = deltap + deltas;
959 sum -= remote->pzero + remote->
szero;
960 n = (sum + remote->
sone / 2) / remote->
sone;
962 log_error(
"failed on bit %d", done + i + 1);
971 for (i = 0; i < bits; i++) {
973 if (is_goldstar(remote)) {
974 if ((done + i) % 2) {
976 remote->pone = remote->ptwo;
980 remote->pone = remote->pthree;
985 if (expectone(remote, done + i)) {
988 }
else if (expectzero(remote, done + i)) {
992 log_trace(
"failed on bit %d", done + i + 1);
1009 log_trace(
"Failed on pre_data: cannot get it");
1020 remote_pre = remote->
pre_data & ~toggle_mask;
1021 match_pre = pre & ~toggle_mask;
1022 if (remote->
pre_data != 0 && remote_pre != match_pre) {
1023 log_trace(
"Failed on pre_data: bad data: %x", pre);
1027 if (remote->pre_p > 0 && remote->
pre_s > 0) {
1028 if (!expectpulse(remote, remote->pre_p))
1030 set_pending_space(remote->
pre_s);
1039 if (remote->post_p > 0 && remote->
post_s > 0) {
1040 if (!expectpulse(remote, remote->post_p))
1042 set_pending_space(remote->
post_s);
1058 struct timeval current;
1065 if (rec_buffer.at_eof && rec_buffer.wptr - rec_buffer.rptr <= 1) {
1068 rec_buffer.at_eof = 0;
1075 rec_buffer.is_biphase = is_biphase(remote) ? 1 : 0;
1078 sync = sync_rec_buffer(remote);
1085 if (has_repeat(remote) &&
last_remote == remote) {
1087 if (!get_header(remote)) {
1093 if (get_repeat(remote)) {
1095 log_notice(
"repeat code without last_code received");
1105 is_const(remote) ? (min_gap(remote) >
1106 rec_buffer.sum ? min_gap(remote) -
1107 rec_buffer.sum : 0) : (has_repeat_gap(remote) ? remote->
1108 repeat_gap : min_gap(remote));
1110 is_const(remote) ? (max_gap(remote) >
1111 rec_buffer.sum ? max_gap(remote) -
1112 rec_buffer.sum : 0) : (has_repeat_gap(remote) ? remote->
1113 repeat_gap : max_gap(remote));
1118 sync_rec_buffer(remote);
1121 if (has_header(remote)) {
1123 if (!get_header(remote)) {
1125 if (!(remote->
flags &
NO_HEAD_REP && expect_at_most(remote, sync, max_gap(remote)))) {
1134 if (is_raw(remote)) {
1142 codes = remote->codes;
1144 while (codes->
name != NULL && found == NULL) {
1146 for (i = 0; i < codes->
length; ) {
1147 if (!expectpulse(remote, codes->
signals[i++])) {
1150 sync_rec_buffer(remote);
1153 if (i < codes->
length && !expectspace(remote, codes->
signals[i++])) {
1156 sync_rec_buffer(remote);
1161 if (found != NULL) {
1163 (remote, is_const(remote) ?
1164 min_gap(remote) - rec_buffer.sum :
1175 ir_code decoded = rec_buffer.decoded;
1184 ctx->
code = decoded & gen_mask(remote->
bits);
1185 ctx->
pre = decoded >> remote->
bits;
1187 gettimeofday(¤t, NULL);
1188 sum = remote->phead + remote->
shead +
1189 lirc_t_max(remote->pone + remote->
sone,
1190 remote->pzero + remote->
szero) * bit_count(remote) + remote->
plead +
1191 remote->
ptrail + remote->pfoot + remote->
sfoot + remote->pre_p + remote->
pre_s +
1192 remote->post_p + remote->
post_s;
1194 rec_buffer.sum = sum >= remote->
gap ? remote->
gap - 1 : sum;
1195 sync = time_elapsed(&remote->
last_send, ¤t) - rec_buffer.sum;
1197 if (!get_lead(remote)) {
1202 if (has_pre(remote)) {
1203 ctx->
pre = get_pre(remote);
1218 if (has_post(remote)) {
1219 ctx->
post = get_post(remote);
1226 if (!get_trail(remote)) {
1230 if (has_foot(remote)) {
1231 if (!get_foot(remote)) {
1237 rec_buffer.sum -= remote->phead + remote->
shead;
1238 if (is_rcmm(remote)) {
1239 if (!get_gap(remote, 1000))
1241 }
else if (is_const(remote)) {
1242 if (!get_gap(remote, min_gap(remote) > rec_buffer.sum ?
1243 min_gap(remote) - rec_buffer.sum :
1247 if (!get_gap(remote, min_gap(remote)))
1261 if (time_elapsed(&remote->
last_send, ¤t) < 325000)
1264 if (is_const(remote)) {
1265 ctx->
min_remaining_gap = min_gap(remote) > rec_buffer.sum ? min_gap(remote) - rec_buffer.sum : 0;
1266 ctx->
max_remaining_gap = max_gap(remote) > rec_buffer.sum ? max_gap(remote) - rec_buffer.sum : 0;
lirc_t min_remaining_gap
remember gap for CONST_LENGTH remotes
void rec_buffer_init(void)
Clear internal buffer to pristine state.
struct ir_remote * last_remote
TODO.
void rec_buffer_set_logfile(FILE *f)
Set a file logging input from driver in same format as mode2(1).
One remote as represented in the configuration file.
int bits
bits (length of code)
int fd
Set by the driver after init().
const struct driver *const curr_driver
Read-only access to drv for client code.
ir_code post_data
data which the remote sends after actual keycode
lirc_t post_s
signal between keycode and post_code
lirc_t plead
leading pulse
struct ir_ncode * toggle_code
toggle code received or sent last
void rec_buffer_rewind(void)
Reset the modules's internal fifo's read state to initial values where the nothing is read...
#define log_debug(fmt,...)
Log a debug message.
unsigned int baud
can be overridden by [p|s]zero, [p|s]one
lirc_t * signals
(private)
int eps
eps (relative tolerance)
struct ir_ncode * last_code
code received or sent last
unsigned int parity
currently unsupported
ir_code pre
pre data, before code.
int receive_decode(struct ir_remote *remote, struct decode_ctx_t *ctx)
Decode data from remote.
#define LIRC_EOF
Bit manipulator in lirc_t, see lirc.h .
lirc_t ptrail
trailing pulse
int pre_data_bits
length of pre_data
logchannel_t
Log channels used to filter messages.
void rec_buffer_reset_wptr(void)
Reset internal fifo's write pointer.
char * name
Name of command.
struct timeval last_send
time last_code was received or sent
#define log_trace2(fmt,...)
Log a trace2 message.
uint32_t rec_mode
Possible values are: LIRC_MODE_RAW, LIRC_MODE_PULSE, LIRC_MODE_MODE2, LIRC_MODE_LIRCCODE.
int post_data_bits
length of post_data
lirc_t sthree
3 (only used for RC-MM)
#define log_trace1(fmt,...)
Log a trace1 message.
#define log_error(fmt,...)
Log an error message.
ir_code pre_data
data which the remote sends before actual keycode
ir_code post
post data, sent after code.
uint32_t gap
time between signals in usecs
#define log_trace(fmt,...)
Log a trace message.
#define log_perror_err(fmt,...)
perror wrapper logging with level LIRC_ERROR.
lirc_t(*const readdata)(lirc_t timeout)
Get length of next pulse/space from hardware.
uint32_t repeat_gap
time between two repeat codes if different from gap
#define REPEAT_HEADER
header is also sent before repeat code
lirc_t max_remaining_gap
Estimated max time of trailing gap.
ir_code code
Code part, matched to code defintion.
int waitfordata(uint32_t maxusec)
If set_waitfordata(func) is called, invoke and return function set this way.
void set_waitfordata_func(int(*func)(uint32_t maxusec))
Set the function used by waitfordata().
#define NO_HEAD_REP
no header for key repeats
unsigned int stop_bits
mapping: 1->2 1.5->3 2->4
lirc_t pre_s
signal between pre_data and keycode
IR Command, corresponding to one (command defining) line of the configuration file.
const uint32_t code_length
Length in bits of the code.
lirc_t stwo
2 (only used for RC-MM)
lirc_t srepeat
indicate repeating
State describing code, pre, post + gap and repeat state.
lirc_t min_remaining_gap
Estimated min time of trailing gap.
lirc_t max_remaining_gap
gap range
ir_code code
The first code of the command.
void rec_set_update_mode(int mode)
Set update mode, where recorded pre_data is verified to match the template pre_data.
unsigned int min_code_repeat
meaningful only if remote sends a repeat code: in this case this value indicates how often the real c...
ir_code rc6_mask
RC-6 doubles signal length of some bits.
int repeat_flag
True if code is a repeated one.
ir_code toggle_bit_mask
previously only one bit called toggle_bit
int rec_buffer_clear(void)
Flush the internal fifo and store a single code read from the driver in it.
#define log_notice(fmt,...)
Log a notice message.
uint64_t ir_code
Denotes an internal coded representation for an IR transmission.
unsigned int bits_in_byte
default: 8