Package: lirc Version: 0.9.4c-9 Severity: normal Tags: patch Dear Maintainer,
In a configuration file for a remote control, I use 'post' to send a pulse (30 us) and a space (460 us) after the data, then ptrail for a trailing pulse. The 'post' cannot be part of 'data' as the space of 'zero' and 'one' is 650 us and 830 us (not 460 us). The pulse and space configured in 'post' is, however, not sent, i.e., the 'post' directive is silently ignored. Looking into the source code I found the issue in lib/transmit.c: '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. The function send_post(remote) checks if has_post(remote) is true; this is only true if remote->post_data_bits > 0. Same applies to 'pre' and 'pre_data'. This limitation is not described in the documentation (see http://www.lirc.org/html/lircd.conf.html). Thus, I suggest to either update the documentation or fix the code. I prefer the latter as I see no logic why a directive should be ignored. I attach a patch. For my specific use case, I have a workaround: I replace 'ptrail' by a single bit 'post_data'. This only works because the 'ptrail' pulse happens to have the same duration as the pulse of 'one'. Thus, I now have 'post_data' and therefore 'post' is no longer ignored. My workaround results in having two spaces at the end (the space of the 'one' from 'post_data' and the 'gap'); this does no harm. I have not found a generic workaround that can be used if the trailing pulse has a different duration than 'one' and 'zero', nor for repeat sequences. Best regards Andreas -- System Information: Distributor ID: Raspbian Description: Raspbian GNU/Linux 9.3 (stretch) Release: 9.3 Codename: stretch Architecture: armv7l Kernel: Linux 4.9.59-v7+ (SMP w/4 CPU cores) Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages lirc depends on: ii init-system-helpers 1.48 ii libasound2 1.1.3-5+rpi3 ii libc6 2.24-11+deb9u1 ii libftdi1-2 1.3-2 ii libgcc1 1:6.3.0-18+rpi1 ii liblirc-client0 0.9.4c-9 ii liblirc0 0.9.4c-9 ii libportaudio2 19.6.0-1 ii libstdc++6 6.3.0-18+rpi1 ii libsystemd0 232-25+deb9u1 ii libudev1 232-25+deb9u1 ii libusb-0.1-4 2:0.1.12-30 ii libusb-1.0-0 2:1.0.21-1 ii lsb-base 9.20161125+rpi1 ii python3 3.5.3-1 Versions of packages lirc recommends: pn gir1.2-vte <none> ii python3-gi 3.22.0-2 ii python3-yaml 3.12-1 Versions of packages lirc suggests: pn ir-keytable <none> pn lirc-compat-remotes <none> pn lirc-doc <none> pn lirc-drv-irman <none> pn lirc-x <none> pn setserial <none> -- no debconf information
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); } }