(For Devs) Osmc changes hdmi input when "send inactive source command when stopping kodi" is on

Greetings and kudos for your hard work!

I am facing a “problem” which i assume is connected to how osmc works.
When osmc’s update implementation starts (blue screen), kodi somehow stops (the update action “kills” kodi) if you have enabled “send inactive source command when stopping kodi” in kodi’s hdmi cec settings…

Having that cec command enabled, when updates start, hdmi source is reverting back to were it was (tv?).
Having that cec command disabled, update blue screen starts ok, but when you shutdown kodi it stays on hdmi mode (doesn’t revert back to TV) because the command is disabled…

Had similar problem when starting retosmc, but mcbit found a solution by tweeking the retropie.sh script.

This is my post:

Mcbit found a solution here that works (for retrosmc):

So is it possible to tweek osmc to not change hdmi input when update blue screen starts?

I guess osmc devs should address that somehow.

Thanks in advance!

I suggest you disable “send inactive source command when stopping kodi” then, because Kodi must exit to install some updates, there’s nothing we can do about that.

That is not a solution but thanks…

Well I don’t see any other solution when Kodi has to exit to update itself. Why do you have that setting enabled in the first place ?

The only times Kodi will exit are during an update, during a reboot/shutdown or if you choose exit/quit.

So I’m trying to understand how having that setting enabled is useful for you.

Why is that not a solution?

That’s exactly what the commands mean.

With CEC, sending “Active source” means “please switch to my input - I’ve got something to show”
and “Inactive source” means “you can switch away now, I’ve finished”.

I think most of the users will have the “send inactive source command” enabled in order for the osmc to return to tv when kodi shuts down/exits.

Unless you close your tv set in osmc’s hdmi source,thus meaning a black screen…

Anyway i thought it was a small tweek like retrosmc, but i guess it is difficult to be implemented…

Btw: Update blue screen means that kodi is inactive? Well…i think it is not, because somehow you are still in kodi,right?

So are you happy with the normal kodi behaviour with active/inactive source, but it’s just a problem when updating kodi?
Does rebooting osmc work okay?

If an osmc update requires kodi to restart, I’d expect an inactive source to be sent when kodi exits (which may make your TV switch to a different input), and then an active source when kodi restarts (which should make your TV switch back). Is that what is happening?

Hmm…i also thought that but…not…that isn’t happening…“Send inactive source command” makes my tv switch to different input (when update starts) but it stays on my tv

I have to manually switch the source back to kodi… :confused:

You should check the cec settings on the TV if they perform some action when an active source shuts down.

I see what haris is asking here.
If kodi shutsdown ie so user can power off, cec inactive should be sent.
But if kodi exits to restart, cec inactive shouldn’t be sent.

This is really a kodi issue as it controls cec on close of kodi, unless osmc devs can over-ride kodi sending cec inactive?

Hypothetical, if an update is in progress, would be nice to see the progress instead of having tv source switch inputs away from pi, then back to pi on kodi restart.

Or am i way off the mark…

I agree with vbat99.

I think that devs could make a script (or add some lines like mcbit on my 1st post) to “fool” kodi into thinking that it is still active ,even if “send inactive command” is on…

Send inactive command should ONLY work when kodi is restarting/powering off i beleive…

Just my though

I am sending some stuff with the debian cec client to make the kodi libcec crash and prevent it from sending the inactive source command. Then killing the cecclient to let kodi take control again when it restarts.
As I stated earlier, this is really ugly but I cannot think of another way to do this.

If you want to experiment a bit, you can try to put the lines, I posted into the update part of the mediacenter script.

mcobit you mean add the lines in retropie.sh? I have already done this.

If not can you post the appropriate link here?

Just guessing, but they should be in /usr/bin/mediacenter somewhere where the update process is launched.

Better to ask dbmandrake or sam where this is exactly.


I guess DBMandrake will see that. I am willing to try it though

And re-launching Kodi should send the active source command, and change the input back.

If the issue is that every time you change to RetroPie, the TV changes input, but not when starting Kodi, then RetroPie needs to also send the active source command

Be careful doing things like this. If CEC isn’t torn down properly, you can get ‘ghosting’ where the TV things that it has multiple CEC peripherals (instances of Kodi, RetroPie etc) attached.

Anyone knows what is the path of the update part of the mediacenter script? Maybe in /usr/bin/mediacenter somewhere??

I want to try adding the appropriate lines that mcobit used

Updates are not done in the mediacenter script, they are done by a service called manual-update.service, whose script is /usr/bin/manual-update. One of the first things it does is stops mediacenter.service.

Both these scripts are likely to get replaced during updates so it is not recommended to edit either of them directly.

So…A question for the devs:

Is it possible to just add some lines in /usr/bin/manual-update script in order not to stop mediacenter.service during update?

I guess this would solve the problem of changing hdmi inputs when “Send inactive source command” is enabled…