SA3250HD Primer

From MythTV Official Wiki
Jump to: navigation, search

Author jwestfall
Description Primer Script for SA3250HD cable boxes.
Supports


Primer Script for SA3250HD cable boxes written by jwestfall. Written for two boxes but works equally well on one box. Still can't reliably record from two of these boxes but this will get them going. I put this in my /usr/bin directory and call it from the startup programs in the sessions application in Ubuntu and it works every time for me. Post something to the mailing list if you have problems getting it going.

The SA3250HD primer looks for jwestfall's firewire_tester script which should be located in the contrib directory. That section can be commented out if you don't have it though.

  • Update: there also exists a sa3250ch channel changer program. It may require some hand tuning as there appears to be two ways to change the channel depending on the vendor ID in your hardware. For now you have to hand tweak the source based on the diffs floating around. I've found that changing the channel to channel 1 (TWC NYC) before priming or when the backend loses the cable box fixes everything. I'll detail the procedure as it has my setup running rock solid.


Script.png sa3520_fixer.sh

#!/bin/bash
# sa3520_fixer.sh [-v]
#
# This should only be used prior to starting the backend.  Using it as 
# part of an external channel changer would be a bad idea since its doing 
# a bus reset.
#
# jwestfall a surrealistic d net 

# List of nodes to fix
NODES="0 1"

# The number of times to try and fix a node
ATTEMPTS=5

# The number of consecutive tests that must be successful
# for a node to be considered working
TESTS=5

# verify firewire_tester and plugctl are installed
if [ "`which firewire_tester`" = "" ]; then
  echo "firewire_tester is required, but not found"
  exit
fi

if [ "`which plugctl`" = "" ]; then
  echo "plugctl is required, but not found"
  exit
fi

# deal with -v commandline
VERBOSE="/dev/null"
if [ "$1" = "-v" ]; then
  echo "verbose output enabled"
  VERBOSE="/dev/stdout"
fi

# global failed variable for when the script exits
FAILED=0

# reset the firewire bus
# this should normalize all the plugs and reset n_p2p to 0
echo Resetting the Firewire bus
firewire_tester -R > $VERBOSE 2>&1

for NODE in $NODES;
do
  TRY=0
  SUCCESS=0  
  
  echo -n "Setting up node $NODE, ";
  while [ "$TRY" -lt "$ATTEMPTS" -a "$SUCCESS" -ne "1" ];do

    # tell stb to send data
    plugctl -n $NODE oPCR[0].n_p2p_connections=1

    # see if the stb is sending data
    firewire_tester -p -n $NODE -r $TESTS > $VERBOSE 2>&1
    if [ "$?" -eq "0" ];then
      SUCCESS=1
    else
      # stop sending data
      plugctl -n $NODE oPCR[0].n_p2p_connections=0
    fi
    let TRY+=1
  done

  if [ "$SUCCESS" -eq "1" ];then
     echo "SUCCESS (after $TRY attempts)"
  else
     echo "FAILED"
     FAILED=1
  fi

done

exit $FAILED