Aw: bug in lirc code: 'post' data from conf file not sent
[email protected] Sat, 10 Feb 2018 16:30:12 +0100
| Newsgroups | gmane.comp.hardware.lirc |
|---|---|
| Message-ID | <trinity-b94e697f-1fe9-4585-ac27-20ac90217d80-1518276612007@3c-app-gmx-bs52> |
Hi
'pre' is equally affected. Below a patch that should address the issue for 'pre' and for 'post'. I sent the patch also to alec_leamas on sourceforge.
Best
Al_
diff --git a/lib/transmit.c b/lib/transmit.c
index 178e889..28a4af4 100644
--- a/lib/transmit.c
+++ b/lib/transmit.c
@@ -302,20 +302,20 @@ static void send_pre(struct ir_remote* remote)
{
if (has_pre(remote)) {
send_data(remote, remote->pre_data, remote->pre_data_bits, 0);
+ }
if (remote->pre_p > 0 && remote->pre_s > 0) {
send_pulse(remote->pre_p);
send_space(remote->pre_s);
}
- }
}
static void send_post(struct ir_remote* remote)
{
- if (has_post(remote)) {
if (remote->post_p > 0 && remote->post_s > 0) {
send_pulse(remote->post_p);
send_space(remote->post_s);
}
+ if (has_post(remote)) {
send_data(remote, remote->post_data, remote->post_data_bits, remote->pre_data_bits + remote->bits);
}
}
> Gesendet: Samstag, 10. Februar 2018 um 15:57 Uhr
> Von: [email protected]
> An: [email protected]
> Cc: [email protected]
> Betreff: bug in lirc code: 'post' data from conf file not sent
>
> Hi
>
> I found the issue and I believe it is a bug: 'post' (i.e., a pulse and a space of specific lengths) is only sent if also 'post_data' (i.e., a sequence of 'zero' and 'one') is configured. This limitation is not described in the documentation (see http://www.lirc.org/html/lircd.conf.html). In more detail: the function send_post(remote) sends only if has_post(remote) is true; this is only the case if remote->post_data_bits > 0 (code snippets for your convenience below).
>
> Two options to correct:
> 1) Fix the code in lib/transmit.c (preferred) - move "if (has_post(remote)) {" down by 4 lines so that it only applies to "send_data" (= the post_data) but not to sending the pulse and space of post.
> 2) Fix the documentation - add that post is only sent if also post_data will be sent.
>
> Best
>
> Al_
>
> ***** Code snippets *****
> // copied from lib/transmit.c
> static void send_post(struct ir_remote* remote)
> {
> if (has_post(remote)) {
> if (remote->post_p > 0 && remote->post_s > 0) {
> send_pulse(remote->post_p);
> send_space(remote->post_s);
> }
> send_data(remote, remote->post_data, remote->post_data_bits, remote->pre_data_bits + remote->bits);
> }
> }
>
> // copied from lib/ir_remote.h
> static inline int has_post(const struct ir_remote* remote)
> {
> if (remote->post_data_bits > 0)
> return 1;
> else
> return 0;
> }
>
>
>
>
>
> > Gesendet: Samstag, 03. Februar 2018 um 18:08 Uhr
> > Von: [email protected]
> > An: [email protected]
> > Cc: [email protected]
> > Betreff: 'post' data from conf file not sent
> >
> > Hi
> >
> > I have decoded the IR signal from a heater and written a conf file (copied below). However, when I send an IR signal with "irsend SEND_ONCE zehnderheating KEY_8", the 'post' pulse and space are missing; all other pulses and spaces are correct (see oscilloscope output at https://imgur.com/a/b06JM ; the measured length of the last long pulse matches ptrail, but post is missing). Run on a Raspberry Pi 3 with raspbian kernel version 4.9.59-v7+ and irsend version 0.9.4c.
> >
> > Any idea what could be the reason?
> >
> > Al_
> >
> >
> >
> > begin remote
> >
> > name zehnderheating
> > bits 8
> > pre_data_bits 8
> > flags SPACE_ENC
> > # eps 10
> > aeps 68
> > min_repeat 0
> >
> > zero 30 650
> > one 30 830
> > # sequence: header plead pre_data pre data post post_data ptrail foot gap
> > header 30 1000
> > pre_data 0xB8
> > # post 30 460
> > # ptrail 30
> > post 1000 460
> > ptrail 300
> > # an arbitrary long space as nothing follows
> > gap 100000
> >
> > frequency 455000
> > duty_cycle 50
> >
> > begin codes
> > KEY_0 0x0D # switch heater off
> > KEY_1 0x86
> > KEY_2 0x95
> > KEY_3 0xA0
> > KEY_4 0xB3
> > KEY_5 0xCA
> > KEY_6 0xD9
> > KEY_7 0xEC
> > KEY_8 0xFF
> > end codes
> >
> > end remote
> >
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot