Menu

#189 FTDI Regression since duty_cycle support

0.9.5
closed
nobody
None
fixed
2016-08-02
2016-05-09
No

The recent commit c9afda9 added support for duty_cycle to the ftdi driver.
This worked for lircd config files that actually specified duty_cycle
but broke it for config files that didn't as it would default to 0 rather
than 50.

Before this commit it was the responsibility of each driver that implements
duty_cycle to know about this default. This fix centralises the defaults
in config_file.c, simplifying the drivers. As a result, even though this
patch is to fix a bug in ftdi it doesn't actually touch ftdi.c.

This issue didn't come up in testing c9afda9 because I'd only tested it
with config files that actually explicitly set duty_cycle. I've tested this
fix with both, but only with the ftdi driver.

1 Attachments

Discussion

  • Alec Leamas

    Alec Leamas - 2016-05-09

    hm... First of all: good catch!

    That said, I'm not enterely happy with this patch. For better or worse, the overall convention in lircd.conf and the remote struct is that the value 0 reflects the default, unconfigured value. Furthermore, the lircd.conf manpage explicitly states the the configured value is between 1 and 100 i. e. , not 0.

    I think it would be better if you kept the current handling in config_file.c and friends and instead parsed the value 0 in ftdix.c as 'unconfigured' i, e., 50 in the same way as the default driver. Some more text in lirc.conf.5 on this issue would of course also be great.

     
  • William Manley

    William Manley - 2016-05-10

    I think it would be better if you kept the current handling in config_file.c and friends and instead parsed the value 0 in ftdix.c as 'unconfigured' i, e., 50 in the same way as the default driver.

    Ok. I figured that duty_cycle was like freq in that it is a property of the carrier, thus should always be set, but I'm happy to change it. I still like the idea of centralising the default however so I'll make an accessor function in ir_remote.h if that would be acceptable?

     
  • Alec Leamas

    Alec Leamas - 2016-05-10

    An accessor providing the default value if it's set to 0? Looks reasonable. But if you do, please also update the default.c driver so it's used in a consistent manner.

     
  • William Manley

    William Manley - 2016-05-10

    Here's a patch implementing this with an accessor. Please don't apply it yet, I won't have a chance to test it until tomorrow.

     
  • David Röthlisberger

    I have tested Will's patch second patch ("0001-plugins-ftdi-Specify-duty_cycle-to-fix-ftdi-driver.patch" in the previous comment) successfully will all the following variations:

    • ftdi driver with duty_cycle specified in the config file
    • ftdi driver with duty_cycle not specified
    • ftdix driver with duty_cycle specified
    • ftdix driver with duty_cycle not specified
    • default driver with duty_cycle specified
    • default driver with duty_cycle not specified
     
  • William Manley

    William Manley - 2016-05-13

    Thanks Dave

     
  • Alec Leamas

    Alec Leamas - 2016-05-15
    • status: open --> closed
    • Resolution: na --> fixed
     
  • Alec Leamas

    Alec Leamas - 2016-05-15

    Thanks to both of you for a nice piece of work! Committed as [f164c8]

     

    Related

    Commit: [f164c8]

  • Alec Leamas

    Alec Leamas - 2016-08-02
    • Milestone: Future --> 0.9.5
     

Log in to post a comment.

MongoDB Logo MongoDB