Exit Fix for Kodi Raspbian built


82 posts   Page 1 of 4   1, 2, 3, 4
by expandables » Wed Feb 18, 2015 11:53 pm
Hi I am a beginner coder and i got tired seeing a blank screen on exit when i am using Kodi on Raspbian so i came up with a fix.
This is a fix for
Code: Select all
http://michael.gorven.za.net/raspberrypi/xbmc
.
My Kodi launcher script.
Code: Select all
#!/bin/bash
setterm -cursor off
mkdir -p ~/.kodi
clear
/usr/lib/kodi/kodi.bin --standalone
setterm -cursor on

kodi-standalone runs in tty7 and it appears that it leaves a blank screen. To fix this, run
Code: Select all
sudo nano /usr/bin/kodi-standalone


Delete or comment out the last three lines, so they look like this:

Code: Select all
#VT="$(fgconsole)"
#chvt 7
#chvt "$VT"

and save it.

When you try to "Quit ", Kodi appears to leave a blank screen.
Kodi log shows
Code: Select all
WARNING: Attempted to remove window 10013 from the window manager when it didn't exist

I made 2 scripts to fix this error.
The first script:
Code: Select all
sudo nano /home/pi/exitfix.sh
and put
Code: Select all
#!/bin/bash
find /home/pi/.kodi/temp/kodi.log  -type f -exec egrep -w "Attempted to remove window 10013" {} \;  > /home/pi/exitfix2.txt


The second script:
Code: Select all
sudo nano /home/pi/exitfix2.sh
and put
Code: Select all
#!/bin/bash

    exitfix=$(cat  /home/pi/exitfix2.txt| awk 'NR==1' | tail -c 6)

     if [ $exitfix = "exist" ]; then
      sudo killall /usr/lib/kodi/kodi.bin  && sudo rm -r /home/pi/exitfix2.txt  /home/pi/.kodi/temp/kodi.log
fi


I now use crontab to run these script every minute
Code: Select all
sudo crontab -e
and put
Code: Select all
*/1 * * * * /home/pi/exitfix.sh
*/1 * * * * sudo sh  /home/pi/exitfix2.sh
Last edited by expandables on Sun Feb 22, 2015 10:26 pm, edited 2 times in total.
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by Fght » Sun Feb 22, 2015 9:19 pm
1. in what directory to put these?
exitfix.sh
exitfix2.sh

2. and this is how the crontab should look like?

http://postimg.org/image/nizi1cozp/
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by expandables » Sun Feb 22, 2015 10:03 pm
Hi yes that's how crontab suppose to look.
That script runs every minute.

Code: Select all
sudo nano /home/pi/exitfix.sh

Code: Select all
sudo nano /home/pi/exitfix2.sh


The home directory. :mrgreen:

If you want kodi to instantly get back out of the black screen you can put this script in crontab and delete the one minute cronjobs out of crontab.
Do this:
Code: Select all
sudo nano /home/pi/fastkodiexit.sh

and put this in
Code: Select all
while [ 1 ];
do
 sudo sh /home/pi/exitfix.sh & /home/pi/exitfix2.sh
  sleep 1;
done

Now do
Code: Select all
sudo chmod +x fastkodiexit.sh

Then put this in crontab
Code: Select all
@reboot  sudo sh /home/pi/fastkodiexit.sh
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by Fght » Mon Feb 23, 2015 10:14 am
so you said i'm goog to go if i put both first files in the home directory........!?
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by Fght » Mon Feb 23, 2015 10:18 am
sorry,
i did it but my tv still turning off....... when i exit kodi
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by expandables » Mon Feb 23, 2015 1:48 pm
Fght wrote:sorry,
i did it but my tv still turning off....... when i exit kodi

If your TV turning off then you have CEC enable.
To disable CEC in kodi go to system settings then go to input devices you will see "Peripherals" click on that and a box will appear saying cec adapter. Now Click on that and where you see enable click on that to disable the cec adapter and press OK.

Also you might want to put this in your config file
Code: Select all
sudo nano /boot/config.txt


Code: Select all
hdmi_ignore_cec=1
hdmi_ignore_cec_init=1
:mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by Fght » Mon Feb 23, 2015 6:12 pm
in what group to put this?:
hdmi_ignore_cec=1
hdmi_ignore_cec_init=1

under 'noobs auto generated settings?
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by expandables » Mon Feb 23, 2015 6:17 pm
Fght wrote:in what group to put this?:
hdmi_ignore_cec=1
hdmi_ignore_cec_init=1

under 'noobs auto generated settings?

Put it in the config.txt file sis you read the post? I showed you how to edit the config.txt file so you can put them in. :mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by Fght » Mon Feb 23, 2015 6:23 pm
http://postimg.org/image/ntpas7iin/

where exactly inside the file? there are many sections...
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by DirkS » Mon Feb 23, 2015 6:53 pm
Fght wrote:http://postimg.org/image/ntpas7iin/

where exactly inside the file? there are many sections...

There are no real sections there. You can put it anywhere you like...
Posts: 7108
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by Fght » Mon Feb 23, 2015 7:05 pm
what do these actually do?
hdmi_ignore_cec=1
hdmi_ignore_cec_init=1

i did the first thing you guys instructed me but i'm wondering what does the config file editing do..
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by DirkS » Mon Feb 23, 2015 7:07 pm
Fght wrote:what do these actually do?
hdmi_ignore_cec=1
hdmi_ignore_cec_init=1

i did the first thing you guys instructed me but i'm wondering what does the config file editing do..

Described in the RPF docs: http://www.raspberrypi.org/documentatio ... fig-txt.md
Posts: 7108
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by Fght » Mon Feb 23, 2015 7:13 pm
ok i've found it there...

one more thing...

should it take some significant amount of time until the kodi is exiting? i think you said before that i can change how much time it takes until it is shutting down (kodi)...

because after hitting exit everything freezes and after some time i can see the gui again...
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by DirkS » Mon Feb 23, 2015 7:18 pm
Fght wrote:because after hitting exit everything freezes and after some time i can see the gui again...

Yes, it can take a while. Never measured it, but it can take long enough to make you wonder if it *does*.
Posts: 7108
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by Fght » Mon Feb 23, 2015 7:22 pm
thank you
Posts: 319
Joined: Thu Feb 05, 2015 10:26 pm
by expandables » Mon Feb 23, 2015 7:26 pm
Fght wrote:ok i've found it there...

one more thing...

should it take some significant amount of time until the kodi is exiting? i think you said before that i can change how much time it takes until it is shutting down (kodi)...

because after hitting exit everything freezes and after some time i can see the gui again...

Read the fastkodiexit script tutorial i previously posted. :mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by vankogt » Thu Mar 05, 2015 7:18 pm
Here is my working fix.

I start kodi from this script:

#!/bin/bash
kodi -fs && sleep 1 && sudo service lightdm restart
Posts: 3
Joined: Thu Mar 05, 2015 6:59 pm
by expandables » Thu Mar 05, 2015 11:10 pm
vankogt wrote:Here is my working fix.

I start kodi from this script:

#!/bin/bash
kodi -fs && sleep 1 && sudo service lightdm restart


I tried your script and i can confirm that this does not work. :mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by dom » Fri Mar 06, 2015 12:12 am
The exit hang has been fixed on Kido master branch and my helix_rbp_backports branch.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5083
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by expandables » Fri Mar 06, 2015 12:16 am
Really then how can i compile it?
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by gkreidl » Fri Mar 06, 2015 8:16 am
Someone should tell Michael Gorven about the fix and ask him to update his repository, (I can't, because his spam filter doesn't like my IP).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5114
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by vankogt » Fri Mar 06, 2015 3:04 pm
expandables wrote:
vankogt wrote:Here is my working fix.

I start kodi from this script:

#!/bin/bash
kodi -fs && sleep 1 && sudo service lightdm restart


I tried your script and i can confirm that this does not work. :mrgreen:


It works perfect on my Pi2. I start from desktop icon
Posts: 3
Joined: Thu Mar 05, 2015 6:59 pm
by juppiter89 » Fri Mar 13, 2015 12:07 pm
I think this is a better and simplier fix ;)

Code: Select all
sudo nano exitfix.sh

Code: Select all
#!/bin/bash

if [[ $(tail -1 /home/pi/.kodi/temp/kodi.log | grep "application stopped...") ]]
then
        killall kodi.bin
        mv /home/pi/.kodi/temp/kodi.log /home/pi/.kodi/temp/kodi.old.log
        chvt 2 && sleep 1 && chvt 1
fi

Code: Select all
sudo nano /etc/crontab

Code: Select all
*/1 * * * * root bash /home/pi/exitfix.sh
Posts: 91
Joined: Fri Jan 04, 2013 10:50 pm
by Pixa » Wed Mar 25, 2015 8:41 pm
Any news regarding this fix ?
Posts: 3
Joined: Tue Mar 03, 2015 2:26 pm
by gkreidl » Wed Mar 25, 2015 10:06 pm
Pixa wrote:Any news regarding this fix ?


No. There was a posting on kodi.tv forum a while ago (by popcornmix) who proposed that a fixed version should be added to the Raspbian repository, but that hasn't happened yet.
Last edited by gkreidl on Thu Mar 26, 2015 12:11 am, edited 1 time in total.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5114
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany