Bus Reset Safe Firewire Priming Script with Channel Changer
Author | Steve Adeff |
Description | Bus reset safe firewire priming script with channel changer. |
Supports |
Steve Adeff's bus reset safe (ie multi-tuner safe) w/ channel changer primer
Note: This script relies on the 6200ch program.
From Steve Adeff's personal wiki page:
I wrote a script for handling my DCT-6200 cable boxes connected via firewire that changes the channel and uses firewire_tester to stabilize the connection before Myth tries to record. This has, over the last two years, allowed me to not fail in recording a single show.
To use, set it up in mythtv-setup as the channel change script. Give it the GUID of the box as shown in mythtv-setup. The script takes two variables, the first being the GUID (which is why you have to specify it) and the second is the channel number (which mythtv automatically feeds it at the end of the command you give it). The script then changes the channel on that GUID and runs firewire_tester. In running firewire_tester it requires that it show the connection is stable twice. If it iterates 10 times it will automatically re-tune the channel, and after 50 attempts total it will send Myth the "failed" result, otherwise it will send Myth the "success" result.
You can change the script to use another channel changer if you require.
#!/bin/bash # GUID=`echo "$1"|sed -r "s/[A-Z]+/\L&/g"` CHANNEL=$2 NODE=`plugreport | grep $GUID | awk '{if (($1 == "Node") && ($4 == "'"0x$GUID"'")) print $2}'` echo "Node: '$NODE'" echo "Changing to channel $CHANNEL" 6200ch -v -s -g $GUID $CHANNEL #maybe a pause is needed? sleep 4 STABILIZE="1" COUNT=0 TOTALCOUNT=0 STABLECOUNT=0 echo "Stabilizing Firewire Connection!..." #maybe an initial run followed by a verification run? #initial run firewire_tester -B -r2 -n$NODE #while [ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ] while [ $STABLECOUNT -lt 2 ] do STABILIZE=`firewire_tester -B -n$NODE|grep "already stable"` if [[ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ]] then echo "Not Stable! Attempt $COUNT" ((COUNT+=1)) ((TOTALCOUNT+=1)) if [ $TOTALCOUNT -gt 50 ] then echo "FAILED to Stabilize!!" exit 1 fi if [ $COUNT -gt 10 ] then 6200ch -v -s -g $GUID $CHANNEL COUNT=0 firewire_tester -B -r2 -n$NODE fi else echo $STABILIZE ((STABLECOUNT+=1)) fi done echo "Stable!" exit 0