Kodi Community Forum
Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp (/showthread.php?tid=157201)



Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - jknotten - 2013-02-23

I would like for XBMC to suspend the PC (or at least stop playing) when the TV is turned off. Unfortunately, my TV does not appear to be sending a power off CEC message, so the existing functionality in XBMC to do this doesn't work.

What I would like to try to implement is to poll for the TV's power status and if it's transitioned from on to off, to tell XBMC to stop playing and / or suspend the computer.

I was having a look at xbmc/peripherals/devices/PeripheralCecAdapter.cpp and it seems that there are two threads, a CPeripheralCecAdapter:Tonguerocess and CPeripheralCecAdapterUpdateThread:Tonguerocess. Since I'm new to this code, I'm not entirely sure what each
thread is used for and whether I should try to put my polling code into one of these threads or perhaps make a new one.

Any advice would be much appreciated.


RE: Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - opdenkamp - 2013-02-23

doesn't your tv send out any message at all when going to standby? please pastebin xbmc's debug log, and indicate where you press the power button of your tv.

CPeripheralCecAdapterUpdateThread:Tonguerocess is just used to send an updated libcec_configuration struct to libCEC


RE: Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - jknotten - 2013-02-24

Thanks for this, I've uploaded my log to http://pastebin.com/W2dZTgPx

In the log, I switch off the TV with the remote towards the end of 09:36.

I then went away for bit and at 9:44:50 I come back and press a key on my USB keyboard, and then I switch the TV back on with the remote. You can see all the CEC messages after that.


RE: Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - opdenkamp - 2013-02-24

in your tv's settings, there's a "auto standby" option or something similar. that option needs to be enabled, or the tv won't tell us that it went into standby mode


RE: Hacking on xbmc/peripherals/devices/PeripheralCecAdapter.cpp - jknotten - 2013-02-26

I have an 'Auto Turn Off' menu item, which does indeed do the trick. The description for the menu item is:

"Turns off Anynet+-equipped HDMI-CEC devices at the same time the TV turns off. And turns off TV when Anynet+-equipped HDMI-CEC device requests power off to the TV"

My TV is a Samsung, about 3 years old now. Model number is LE32C530 and firmware is T-MSX5DEUC-2011.0 which I believe is the latest (2011/03/18_002011).

But the problem is that this setting resets itself from time to time. Looking at http://www.avforums.com/forums/lcd-led-lcd-tvs/1370694-samsung-ue55c6505-problem-anynet-setup-auto-turn-off-onkyo-htx-22hd.html it might be that this setting is resetting itself because the TV is checking for a firmware upgrade 2 hours after it enters standby. I've now tried disabling this auto-upgrade "feature" and the setting seems to be sticking!

Interestingly, the TV does respond to CEC commands from the PC to switch it on and off and the status of the TV can be polled accurately. Strange that it won't send the standby event without this setting.

Thanks for your help!