Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11986 closed Patch - Bug Fix (fixed)

libCEC interface should use callbacks rather than polling

Reported by: Bradley Baetz <bbaetz@…> Owned by: Raymond Wagner
Priority: minor Milestone: 0.28
Component: MythTV - libCEC Version: 0.27-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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)

Attachments (1)

cec.patch (9.9 KB) - added by Bradley Baetz <bbaetz@…> 10 years ago.
Patch

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by Bradley Baetz <bbaetz@…>

Attachment: cec.patch added

Patch

comment:1 Changed 10 years ago by Bradley Baetz <bbaetz@…>

I've been running with this for 4 months now, on 0.27-fixes (updating about once a week or so), and its been perfectly stable.

comment:2 Changed 10 years ago by Bradley Baetz <bbaetz@…>

Resolution: fixed
Status: newclosed

In 351d2036f58f2bed2bcf452bf400d96bf4490f62/mythtv:

libCEC interface should use callbacks rather than polling

Fixes #11986

Signed-off-by: Jean-Yves Avenard <jyavenard@…>

comment:3 Changed 10 years ago by paulh

Milestone: unknown0.28
Note: See TracTickets for help on using tickets.