Fixed: OSMC alpha 1-4 RPi CEC issue

I´m just going to chip in with one thing, just in case;
I am still under the impression that libcec is exactly the same as in Raspbmc.
The reason I say this is that popcornmix´s libcec version went into his Kodi backport branch even before Kodi 14.0 release and as I have built Helix for Raspbmc for a long time I can say that you cannot even build his backport branch without his libcec version.

It HAS to be the same version, otherwise the wrong libcec is being shipped for Raspbmc but at the same time the Kodi version for Raspbmc is being built with the “correct” version.
I don´t think that this is the case.

Edit: That said, you cannot just switch the lib versions as Kodi depends on them (Popcornmix´s backport branch has patches that depends on his version of libcec both when building and after).
Unless there are different dependencies between newclock4 and the backport branch (newclock4 has more libcec patches)???

Have you actually tested this on raspbmc though or are you just assuming this is the case ?

Have you manually set the time forwards on raspbmc then triggered an ntp sync to cause the time to jump back while you are using cec ?

As miappa has pointed out, libcec should be nearly identical if not identical between raspbmc and osmc - there shouldn’t be any significant differences between the two that would cause one to be vulnerable and the other not.

Until proven conclusively otherwise I am going to assume that the raspbmc version of libcec is just as vulnerable to time shifts and that it just doesn’t exhibit under raspbmc because there aren’t two ntp clients fighting to control the time with one connecting to your dodgy ntp server.

As I said earlier, we will see if we can disable the built in ntp client in connman for the next build.

See “raspbmc-ok” few posts up.

About ntp - I wrote ealier that it is not ntp dependent issue. If I manually change time via date -s it triggers the “lost connection” too.
Please read my post regarding my testing procedure and test it yourself. It is completely harmless and you can test it on both osmc and raspbmc - I know I did :slight_smile:

I have some ideas and will comment in more detail shortly after I get home

Logs even when there’s no crash and everything just works?
The pi has been on since yesterday so I can check if it crashed in the meanwhile (once I get home, in ~6 hours)

sorry by logs I meant results of those commands I mentioned earlier


This is the Raspbmc library: You should be able to drop it in over /usr/lib/ as follows:

sudo -s
systemctl stop mediacenter
wget -O /usr/lib/```

My other comment was that ConnMan is likely getting time from DHCP time servers and 'fighting' with NTP. I will disable time updates in ConnMan for next release.


I suspected that it won’t work but I tested it anyway:

osmc@osmc:~$ cec-client
No device type given. Using 'recording device' cannot open shared object file: No such file or directory
Cannot load

osmc@osmc:~$ ls -la /usr/lib/*cec*
-rw-r--r-- 1 root root 7071368 gru 11 02:44 /usr/lib/libcec.a
-rwxr-xr-x 1 root root     988 gru 11 02:44 /usr/lib/
lrwxrwxrwx 1 root root      15 sty  1  1970 /usr/lib/ ->
-rwxr-xr-x 1 root root 3946431 lis  9 18:45 /usr/lib/ <-- this is the new downloaded lib
-rwxr-xr-x 1 root root 3681584 gru 11 02:44 /usr/lib/ <-- this is the original osmc lib

Maybe it should be somehow compiled for the new system or register somewhere else in the system? Or maybe it depend on some other file that is not in osmc distro.

Please bare in mind that I know absolutely nothing about linux libraries

EDIT: Of course I restarted RPi after switching libs just to be sure.


sudo ldconfig

Ok, library is working!

Unfortunately the same issue occurs (connection to cec lost after time shift backwards). So it is not the Any other thought about the root cause of the problem?

Maybe firmware, or some other dependant libraries?

I mean, this is not critical right now. After addressing the timing issues cec will probably work ok. It is just something that shouldn’t behave like that :wink: and I believe the decision is up to you, whenever or not you what to fix it.

I’d categorize this bug as moderate/high because it is not disrupting anything (when the time is correct) but just because nobody can find the root cause.

Fixed. You were getting bounced around between NTP and a local timeserver. Let’s bail early when ConnMan tries to update time.

Will be available in next (hopefully final) release.


1 Like

Glad to hear that. It should prevent weird time changes.

It doesn’t change the phenomenon of weird cec behaviour (lost connection) when time do change backwards.

I’m happy with workaround though and I learned a lot about a lot of things while debugging this issue.

Whenever or not you decide to investigate this issue further, I wish you good luck and keep the good work.

If anyone else need to test something regarding this issue please let me know I’ll do my best to help.

1 Like

I see earlier you mentioned tcpdump. If you could get me some captures when it happens I could look in Wireshark and confirm if the network really was causing the clock skew.

Of course it doesn’t really fix the problem, it’s a patch over an underlying problem.

Update: I pinged Lars Opdenkamp (CEC developer) on IRC and he has said that this is indeed a bug and he plans to fix it one day.


1 Like

hehe finally someone acknowledged that my finding is indeed a bug :smile:

Sam if you really want me to i’ll provide the dump but it would require reconfiguration of my sagem router which is a pain in the neck.
Basically it looked like this:

osmc.XXXX > > osmc.XXXX

and so on… (S,ACK,P,ACK … F,FA)

and then suddenly:

osmc.YYYY > myrouter.123
myrouter.123 > osmc.YYYY

and then the date in system changed to exactly the time that I could see on my routers web interface.

So YES, 100% it was another ntpclient-like process getting time from my router/dhcpd instead of servers listed in /etc/ntp.conf and that is why time changed back and forth.

If you need the tcpdump please let me know, I’ll try to get it for you.

Hey, sorry for not being to help a bit more.
My issue never repeated while I was looking at the tcp dumps running. It worked for a long time, but the next day it wasn’t working anymore, so it’s hard to pinpoint exactly when it fails.

Anyway, hoping the next release will fix it.

Unrelated: Do updates like this come in when updating the system via the UI or do I have to reflash?

Once we hit a stable release, these updates will come in automatically