One-tuner Firewire Priming Script for Broadcast Connections

From MythTV Official Wiki
Jump to: navigation, search

Author Josh Rosenbluh
Description One-tuner firewire priming script for broadcast connections
Supports


This script relies only on firewire_tester, 6200ch and the broadcast mode in case you can't get a p2p connection.


Script.png firewire_primer.sh

#!/bin/bash
# v0.05
# 6200-broadcast-helper, another firewire channel changer
# Written by Josh Rosenbluh
# Released under GPL, 2008
#
# =Intended Use=
# This script is intended for MythTVers who can't get p2p working
# and can only use broadcast mode for their firewire connection.
# It isn't as fancy as some other scripts, but it does the job.
# =Required software in /usr/local/bin/=
# 1. '6200ch' channel changer binary
# 2. 'firewire_tester' binary
#
# Please feel free to improve upon this scriptlet.
# My email: <my_last_name>@gmail.com



#Changing the channel
/usr/bin/time -f "Channel Changing took %e seconds.\n" /usr/local/bin/6200ch $1

# This section loops up to LIMIT times to get a link.
# firewire_tester has a -r option to repeat the tests, 
# but that occasionally doesn't work on known good channels.
# on those occasions, mythtv fails to record a program.

# Assumes the 1st node of the firewire card. This is usually the same after each
# reboot or reconnection of the cable.

# The loop below could probably be written with a bash function and
# a while statement.


LIMIT=10
EXIT_STATUS=1
for ((a=1; a <=LIMIT && EXIT_STATUS; a++))
do
   echo "Attempt $a out of a possible $LIMIT"
   /usr/bin/time -f "That took %e seconds.\n" /usr/local/bin/firewire_tester -n1 -B
   EXIT_STATUS=$?
done

exit $EXIT_STATUS