Re: bug in lirc code: 'post' data from conf file not sent

Bengt Martensson <[email protected]> Sat, 10 Feb 2018 17:16:06 +0100
Newsgroups gmane.comp.hardware.lirc
Message-ID <[email protected]>
On 02/10/18 15:57, [email protected] wrote:
> 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.


I would strongly advice against "fixing bugs" like that.

This is what the man-page of lircd.conf says:

    LIRC  was  designed  to  collect IR data and save it in a private,
    compact, yet human readable format with the purpose of being able to
    re-transmit (or re-recognize) these signals. It was not designed
    with the goal of providing a well documented and tested configuration
    file format that could be used e.g., to generate arbitrary IR signals
    or to convert them to other formats. The configuration  file
     hould thus not be considered a public interface to LIRC.

     This  manpage  should be understood with this in mind. It was
     authored by reading the code of LIRC, and does not constitute an
     authoritative specification of the behavior of LIRC and its
     configuration
        file.  ...

Lirc is not a well defined language with an associated rendering engine.
Its core was written almost 20 years ago by people who are no longer 
active. Probably it is fair to say that no-one today really understands 
the code. The documentation of the lircd.conf keywords was written many 
years later by other persons, first by the WinLirc people and then by 
Alec, "by reading the code of LIRC".

Also keep in mind that Lirc, in different guises, is used fairly widely. 
If changing the current version, we have different versions that render 
the same file differently. How do you make clear that the rendering of 
all present files is not changed? Or, it they are affected by the "bug", 
should they render differently?

For these reasons, I think the Lirc rendering engine should not be 
changed in a non-trivial way, like "bug fixes".

 > 2) Fix the documentation - add that post is only sent if also 
post_data will be sent.

I have no problem with that. Just post an improved version to Alec.

BTW, if you are looking for a rendering engine, look at 
https://github.com/bengtmartensson/IrpTransmogrifier .

Greetz,

Bengt

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot