[mythtv-commits] Ticket #11986: libCEC interface should use callbacks rather than polling

MythTV noreply at mythtv.org
Mon Dec 23 05:30:46 UTC 2013


#11986: libCEC interface should use callbacks rather than polling
------------------------------------------+------------------------
     Reporter:  Bradley Baetz <bbaetz@…>  |      Owner:  wagnerrp
         Type:  Patch - Bug Fix           |     Status:  new
     Priority:  minor                     |  Milestone:  unknown
    Component:  MythTV - libCEC           |    Version:  0.27-fixes
     Severity:  medium                    |   Keywords:
Ticket locked:  0                         |
------------------------------------------+------------------------
 The attached patch moves libCEC event handling from polling every 200ms to
 libCEC's callback mechanism.

 This decreases the CPU% for mythfrontend when I'm on the menu and not
 doing anything from 12-13% to 7% (on an NL40)

 Tested on a Sony TV with a pulse8 CEC adapter. I tested the
 poweron/poweroff keys as well. (although poweron had to be tested via the
 netcat port 6546 interface, because my TV doesn't send any keypress events
 when its turned off)

 I moved setting the callbacks to before calling ->open, so that the
 initial log messages are still sent and logged even when the adapter isn't
 fully ready (currently the code reads those in the polling loop).
 handlekeypress is still safe, because |valid| isn't true yet.

 The change at the end of Open to turn the TV on was needed because in the
 current code, this wasn't actually doing anything - the call to turn the
 TV on and switch inputs at startup wasn't working, because it was done
 before setting valid to true, but HandleActions exists early if !valid.
 The old code worked because the TV would be turned on at the next 200ms
 timer interval and the actions would be taken then. However, I could only
 test that by looking at the logs - if my TV is configured to allow poweron
 commands via HDMI, it changes the input automatically.

 There is also one more bug I discovered and fixed while I was changing
 this - I've allowed HDMI port 4 to be used if configured - 4 ports are
 valid in the HDMI CEC spec (Note that using any port other than port 1
 requires a manual change to the DB settings table, since the default of
 'auto' actually means 1 with the current code)

--
Ticket URL: <http://code.mythtv.org/trac/ticket/11986>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list