id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,mlocked 11986,libCEC interface should use callbacks rather than polling,Bradley Baetz ,Raymond Wagner,"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)",Patch - Bug Fix,closed,minor,0.28,MythTV - libCEC,0.27-fixes,medium,fixed,,,0