Kodi Community Forum
Raspbmc CEC Reconnect - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166)
+---- Thread: Raspbmc CEC Reconnect (/showthread.php?tid=199522)



Raspbmc CEC Reconnect - lmrdaddy - 2014-07-08

Hi,
I am running the latest Raspbmc and I am using my (Toshiba) TV's remote to control XBMC via CEC. This is working fine until I turn off the TV. If I turn the TV back on the CEC connection is lost, which is probably (just guessing) the TV's fault. If I start cec-client on the Pi I can see the TV going from "Standby" to "On", but controlling XBMC does not work until I change one of the settings (doesn't matter which one) of the CEC adapter in XBMC. So the question is: is there anything I can do to automatically reconfigure/reinitialize the CEC adapter once the TV is turned on. If not: is there a way to do this via a script, maybe using the HTTP-API?

Cheers,
lmrdaddy


RE: Raspbmc CEC Reconnect - ActionA - 2014-07-08

There is a much simpler way that should keep the pi aware of what it is connected to and it's capabilities.

Quote:sudo tvservice -d /boot/edid.dat

and add:
hdmi_edid_file=1
hdmi_force_hotplug=1

http://forum.stmlabs.com/showthread.php?tid=7118&pid=57862#pid57862


RE: Raspbmc CEC Reconnect - dandnsmith - 2014-07-08

Quote:and add:
hdmi_edid_file=1
hdmi_force_hotplug=1

Those last 2 lines are added to /boot/config.txt (in case there was any doubt)


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-07-08

Thanks for the hint but I had already done that. I helped to reconnect CEC after a reboot of the Pi, but not the other way round. My suspicion is, that the TV does not "know" the Pi is still there and therefore does not send any commands.


RE: Raspbmc CEC Reconnect - ActionA - 2014-07-08

Did you try unplugging the TV from it's power source for several minutes in order to give it a hard reboot of it's system? We've seen this resolve a lot of CEC issues.


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-07-08

Quote:Did you try unplugging the TV from it's power source for several minutes in order to give it a hard reboot of it's system? We've seen this resolve a lot of CEC issues.

Yes, I've done this several times, I tried turning the TV completely off (unplugged it) or only going to standby, same result :-(


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-07-09

Apparently the only thing that helps is reconfiguring the CEC adapter on the Pi, so back to my question: any ideas on how to this via script or HTTP requests?


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-07-15

Well, just for the record, maybe someone else has the same problem: I solved by using a small Python script connecting to the Event Server and sending ACTION_EXECBUILTIN "CECActivateSource".


RE: Raspbmc CEC Reconnect - Milhouse - 2014-07-15

Not a solution, but you might want to keep an eye on this discussion in case its related.


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-07-15

Yep, I agree, this sounds at least similar. I will keep an eye on it, thank you.


RE: Raspbmc CEC Reconnect - mikkelnl - 2014-10-15

Hi all, I have the same issue and stumbled upon this (kinda) old thread Smile

I've read quite a few topics and no 'fix' solved the issue for me: my Sony TV will control raspbmc fine via HDMI CEC until the TV is turned off/to standby. Upon restart the CEC connections seems lost. Driving me nuts.

I'd like to try this fix:

(2014-07-15, 09:24)lmrdaddy Wrote: Well, just for the record, maybe someone else has the same problem: I solved by using a small Python script connecting to the Event Server and sending ACTION_EXECBUILTIN "CECActivateSource".

But have no idea how to achieve this? Any help is appreciated Smile


RE: Raspbmc CEC Reconnect - mikkelnl - 2014-10-16

Phew, I'm ready to give up Wink After spending hours trying to find out how to solve this issue (CEC lost after tv turns off/on), I tried the below suggestion, but am completely lost how to do this.

(2014-07-15, 09:24)lmrdaddy Wrote: Well, just for the record, maybe someone else has the same problem: I solved by using a small Python script connecting to the Event Server and sending ACTION_EXECBUILTIN "CECActivateSource".

It seems after spending many hours reading forums, the CEC issue is not an XBMC fault I think (tried raspbmc and xbian), I think the TV loses the CEC connection somehow.

The above mentioned 'fix' sounds logical as a workaround but again: no idea how to do that, any ideas? Or other tips to get a reliable CEC link? For the record; I have the pi powered on 24/7, so I only turn on the TV and Receiver.


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-10-16

mikkelnl Wrote:I seem to have the exact same issue, and I'd like to try your fix, but have NO idea where/how to do this, could you help me? Appreciated!

Michel

Hi,

sorry for the late answer, unfortunately the notification email ended up in my Spam folder and I am not a regular user of this forum.
Let me start by saying that I am not using this method any more, I changed from using CEC to a normal IR receiver because I could never make it work really reliably. Anyway, I still have the script, here it is:

Code:
#!/usr/bin/python

import sys
sys.path.append("../../lib/python")
sys.path.append("/scripts")

from xbmcclient import *
from socket import *

def main():
    import time
    import sys

    host = "raspi"
    port = 9777
    addr = (host, port)
    sock = socket(AF_INET,SOCK_DGRAM)

    packet = PacketHELO("CECEnabler", ICON_NONE)
    packet.send(sock, addr)

    packet = PacketACTION("CECActivateSource", ACTION_EXECBUILTIN)
    packet.send(sock, addr)

    # wait for 5 seconds
    time.sleep (10)

    packet = PacketACTION("CECActivateSource", ACTION_EXECBUILTIN)
    packet.send(sock, addr)

    packet = PacketBYE()
    packet.send(sock, addr)

    return 0

if __name__=="__main__":
    main()

I hope it works for you, let me know the results.


RE: Raspbmc CEC Reconnect - mikkelnl - 2014-10-16

(2014-10-16, 10:38)lmrdaddy Wrote:
mikkelnl Wrote:I seem to have the exact same issue, and I'd like to try your fix, but have NO idea where/how to do this, could you help me? Appreciated!

Michel

Hi,

sorry for the late answer, unfortunately the notification email ended up in my Spam folder and I am not a regular user of this forum.
Let me start by saying that I am not using this method any more, I changed from using CEC to a normal IR receiver because I could never make it work really reliably. Anyway, I still have the script, here it is:

Code:
#!/usr/bin/python

import sys
sys.path.append("../../lib/python")
sys.path.append("/scripts")

from xbmcclient import *
from socket import *

def main():
    import time
    import sys

    host = "raspi"
    port = 9777
    addr = (host, port)
    sock = socket(AF_INET,SOCK_DGRAM)

    packet = PacketHELO("CECEnabler", ICON_NONE)
    packet.send(sock, addr)

    packet = PacketACTION("CECActivateSource", ACTION_EXECBUILTIN)
    packet.send(sock, addr)

    # wait for 5 seconds
    time.sleep (10)

    packet = PacketACTION("CECActivateSource", ACTION_EXECBUILTIN)
    packet.send(sock, addr)

    packet = PacketBYE()
    packet.send(sock, addr)

    return 0

if __name__=="__main__":
    main()

I hope it works for you, let me know the results.

Thanks man Smile Could you please explain how to run this, and I guess you set it via a cronjob maybe? ANyway; much appreciated Smile


RE: Raspbmc CEC Reconnect - lmrdaddy - 2014-10-16

You need to install xbmcclient.py from here:
https://github.com/xbmc/xbmc/blob/master/tools/EventClients/lib/python/xbmcclient.py (copy to /scripts, if you install somewhere else you need to fix the import statement).

Then you need to adjust hostname and port in the script to your system, start the script by calling
Code:
python scriptname.py

I did not run the script from cron but rather ran it via fhem (http://fhem.de) whenever the TV is turned on (done via fhem).