On 2012-10-14, at 11:22 AM, Paul Onley <[email protected]> wrote:

> On 10/08/2012 11:18 AM, Peter Schneider wrote:
>> 
>> On 2012-10-03, at 11:15 PM, Paul Onley <[email protected]> wrote:
>> 
>> 
>> Paul,
>> 
>> I modified your script a little to accommodate another error that has 
>> plagued our home.  The Jump error appears to be tied to ivtv as well but is 
>> reported in the MythTV backend log so I added another IF statement to test 
>> for it.
>> 
>> ##########################################################
>> #!/bin/bash
>> #This script will automate the reloading of the ivtv modules. It is rather 
>> heavy handed but due to
>> #issues with firmware failures in the ivtv module causing recording issues 
>> on my PVR-500 it was
>> #my last resort to prevent failed recordings. Note that this script must be 
>> run as root in order to
>> #be able to reload the ivtv module. As such it has full root privilege and 
>> should be used very
>> #carefully. While it works as intended on my debian system I cannot 
>> guarantee it will work as
>> #intended on your system. Please check all commands before using.
>> 
>> 
>> 
>> #Cron jobs start on the minute and so do myth recordings so wait 15 seconds
>> #for the problem to occur and be logged
>> sleep 15
>> 
>> #If we find an indication in the syslog that the ivtv driver has failed
>> if  grep "Encoder has died : ivtv_serialized_open" /var/log/syslog ;  then
>> 
>>        #Kill both frontend and backend so that we can unload the ivtv module
>> 
>>        pkill mythfrontend
>>        pkill mythbackend
>> 
>>    #The ivtv module will not unload until the frontend and backend are 
>> stopped so
>>    #rather than sleep for some arbitrary ammount of time lets just try to 
>> unload
>>    #repeatedly until we succeed
>> 
>>        while ! /sbin/modprobe -vr ivtv ; do
>> 
>>        #Wait for a second
>> 
>>                sleep 1
>>                i=$(($i+1))
>> 
>>        #See if we have tried more than 15 times indicating there is a real 
>> problem
>> 
>>                if [ $i -gt 15 ];then
>> 
>>         #In which case return an exit value of 1
>> 
>>                        exit 1
>>                fi
>>    #Otherwise try again
>> 
>>        done
>> 
>>    #Relax for a second
>> 
>>        sleep 1
>> 
>>    #And reload the ivtv module the debug level is so that when someone tells
>>    #me what to look for my logs should have everything
>> 
>> 
>>        /sbin/modprobe -v ivtv debug=127
>> 
>> 
>>    #We are moving the logfile to another file so that we can corelate the 
>> failures with
>>    #Logs. the new file name is syslog.restart.n so check to see if n exists
>> 
>>        i=0
>>        while [ -e /var/log/syslog.restart.$i ];do
>> 
>>        #and if so iterate until we find a good name
>> 
>>                i=$(($i+1))
>>        done
>> 
>>    #Save the syslog file
>> 
>>        mv /var/log/syslog /var/log/syslog.restart.$i
>> 
>>    #start a blank syslog
>> 
>>        touch /var/log/syslog
>> 
>>    #restart the syslog daemon
>> 
>>        /etc/init.d/rsyslog restart
>> 
>>        sleep 5
>> 
>>    #Restart the backend
>> 
>>        /etc/init.d/mythtv-backend restart
>> 
>>        echo "ivtv reset Successful: $(date)" >> /var/log/ivtv_reset.log
>> 
>> else
>>   #If we find an indication in the mythbackend that the ivtv driver has 
>> failed realted to "Jump"
>>   if  grep "E DeviceReadBuffer DeviceReadBuffer.cpp:513" 
>> /var/log/mythtv/mythbackend.log ;  then
>> 
>>         /sbin/modprobe -r ivtv 
>>         sleep 5 
>> 
>>       #And reload the ivtv module with debug level 
>> 
>>         /sbin/modprobe -v ivtv debug=127
>> 
>> 
>>       #We are moving the logfile to another file so that we can corelate the 
>> failures with
>>       #Logs. the new file name is syslog.restart.n so check to see if n 
>> exists
>> 
>>         i=0
>>         while [ -e /var/log/mythtv/mythbackend.restart.$i ];do
>> 
>>           #and if so iterate until we find a good name
>> 
>>                i=$(($i+1))
>>         done
>> 
>>       #Save the syslog file
>> 
>>         mv /var/log/mythtv/mythbackend.log 
>> /var/log/mythtv/mythbackend.restart.$i
>> 
>>       #start a blank syslog
>> 
>>         touch /var/log/mythtv/mythbackend.log
>> 
>>         echo "ivtv reset on Jump failure Successful: $(date)" >> 
>> /var/log/ivtv_reset.log
>>   fi
>> fi
>> 
>> -Peter
>> 
>> 
>> 
>> _______________________________________________
>> ivtv-users mailing list
>> [email protected]
>> http://ivtvdriver.org/mailman/listinfo/ivtv-users
> I'm not sure about MythBuntu but on my debian system you cannot remove the 
> ivtv module while the backend  or frontend is running and your modification 
> does not stop and restart the backend or frontend before modprobing the ivtv 
> module. You could grep for both conditions in the original if at the top and 
> use my reset code loop for either condition and save the result of the grep 
> to echo to /var/log/ivtv_reset.log for identification of what caused the 
> reset.
> 
> Of interest is that the encoder has stopped dying on my system, unfortunately 
> I cannot duplicate what fixed it. I had installed a couple packages which 
> caused my usb network adapter to stop loading so I had to change some udev 
> rules to fix that and the encoder died messages stopped at the same time. The 
> root of this problem may be in the loading of the module and udev rules but I 
> do not know how to diagnose what my changes did to fix the problem.
> 
> Paul
> _______________________________________________
> ivtv-users mailing list
> [email protected]
> http://ivtvdriver.org/mailman/listinfo/ivtv-users

Hi Paul,

Interestingly enough, after doing the last patch (which for me was a 
significant one as I don't like to do updates when things are working) I have 
not seen the encoder dying via the original error either.

I had the same thought on the need to restart mythbackend but decided to test 
if first without.  The process must do something that forces the right resets 
or perhaps Ubuntu 12.04 is able to do the reset.  When it runs after the Jump 
error, the system comes back and you can watch live TV again.

-Peter

_______________________________________________
ivtv-users mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-users

Reply via email to