I wrote this for my own purposes because setting up Comcast Digital is a very manual process. I just though I'd share in case anyone else finds this useful.
Give me suggestions and I will modify this first post so it is easy to find.
Code:
echo "
hdtest_funcs by Richard Bronosky
This file is intenteded to be sourced from a Linux command line. It defines
some functions that I found to be quite useful in setting up my HDHOMERUN and
finding qam signals from my cable provider. I define most (but not all) of
the values I thought you may need to tweak as variables. You can override
them right here from the command line, or edit the script."
# If it is not located in your PATH, you will have to alter the following line
export HDHR_CONFIG="hdhomerun_config";
export IP="$(ifconfig|awk '/inet addr:/ {sub(".*:","",$2); print $2;exit}')"
# If you have only one HDHR on you network, you can use FFFFFFFF as a wildcard
export HDHR_ID="10101C26";
export HDHR_BASEPATH="/tmp";
export HDHR_SCANFILE="$HDHR_BASEPATH/channel_scan.txt";
export HDHR_CHANNELFILE="$HDHR_BASEPATH/channel_scan_filtered.txt";
hdscan(){
$HDHR_CONFIG $HDHR_ID scan /tuner1 $HDHR_SCANFILE
}
echo "
Defined function, hdscan, which takes no arguments and populates the file
$HDHR_SCANFILE with the raw output of doing a scan."
hdfilterscan(){
awk '
BEGIN {
encrypted=0
nodata=0
named=0
unnamed=0
}
/^SCANNING/ {
scan=$0;
frequency=$2;
}
/^LOCK: none/ {next;}
/^PROGRAM: none/ {next;}
/^PROGRAM: internet/ {next;}
/^LOCK:/ {lock=$0;}
/^PROGRAM:/ {
if($0 ~ /encrypted/){
encrypted=encrypted+1;
next;
}
if($0 ~ /(no data)/){
nodata=nodata+1;
next;
}
if(scan!=0){
print scan lock;
scan=0;
}
program=$2
sub(":","",program)
if($0 ~ /^PROGRAM: [0-9]+: [0-9.]+ [a-zA-Z]/){
named=named+1;
unname=0
}else{
unnamed=unnamed+1;
}
print $0;
print " hdtune " frequency " " program;
}
END {
print "###########################"
print "# Named Programs:" named
print "# UnNamed Programs:" unnamed
print "# Encrypted Programs:" encrypted
print "# \"no data\" Programs:" nodata
print "###########################"
}
' $HDHR_SCANFILE | tee $HDHR_CHANNELFILE
}
echo "
Defined function, hdfilterscan, which takes no arguments and filters the raw
scan file into a more useful file, $HDHR_CHANNELFILE."
hdtune() {
$HDHR_CONFIG $HDHR_ID set /tuner0/channel "qam:$1"
sleep 2s
$HDHR_CONFIG $HDHR_ID get /tuner0/streaminfo
if [ -n "$2" ]; then
$HDHR_CONFIG $HDHR_ID set /tuner0/program $2
fi
}
echo "
Defined function, hdtune, which takes (1)channel fequency and optionally
(2)program number as arguments. It will tune the HDHR making it ready to
test."
hdtest() {
vlc --key-quit=Esc udp://@:1234 &
sleep 6
$HDHR_CONFIG $HDHR_ID set /tuner0/target $IP:1234
}
echo "
Defined function, hdtest, which takes no arguments and launches vlc then
targets $IP after a few seconds. (It tries to wait for vlc to
get ready.)"
To use this, you just save the code above to a text file and source it from a bash shell. It will define several functions and give you an explanation. (What I am about to explain is shown in a transcript below.) First run "hdscan" to create a scan file to work with. (This takes a while.) Then run "hdfilterscan|more" which will out put only the frequencies and channels you care about. It follows each program it finds with an indented line that is meant to copy and paste. (triple-click, middle-click) Like so " hdtune 699000000 10" Then you run "hdtest" to launch vlc and target it. you can leave vlc open, and rerun "hdfilterscan|more" and copy paste the next one you want to try, like so " hdtune 699000000 30" . Of course all of this is made much easier by using at least two "windows" in Gnu Screen, but I guess you could have multiple xterms open too.
Code:
sh-3.1$ hdscan
SCANNING: 55750000 (us-hrc:2)
LOCK: none (ss=97 snq=0 seq=0)
SCANNING: 57000000 (us-bcast:2, us-cable:2, us-irc:2)
LOCK: (ntsc) (ss=100 snq=0 seq=0)
# ... long process...
sh-3.1$ hdfilterscan|more
SCANNING: 111000000 (us-cable:98, us-irc:98)LOCK: qam256 (ss=97 snq=70 seq=100)
PROGRAM: 3: 2.1 WSB HD
hdtune 111000000 3
PROGRAM: 10: 17.1 WTBS HD
hdtune 111000000 10
SCANNING: 525000000 (us-cable:74, us-irc:74)LOCK: qam256 (ss=93 snq=90 seq=100)
PROGRAM: 200: 0.0
hdtune 525000000 10
# ...lots of similar text...
sh-3.1$ hdtune 111000000 3
3: 2.1 WSB HD
8: 0.0 (encrypted)
10: 17.1 WTBS HD
sh-3.1$ hdtest
[1] 8626
VLC media player 0.8.6a Janus
libdvbpsi error (PSI decoder): TS discontinuity (received 3, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 3, expected 0) for PID 48
[00000337] a52 decoder: A/52 channels:2 samplerate:48000 bitrate:384000
sh-3.1$ hdtune 111000000 10
libdvbpsi error (PSI decoder): TS discontinuity (received 10, expected 12) for PID 48
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc0)
libdvbpsi error (PSI decoder): TS discontinuity (received 9, expected 12) for PID 0
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc1)
libdvbpsi error (PSI decoder): TS discontinuity (received 9, expected 0) for PID 160
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc0)
libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 0) for PID 128
libdvbpsi error (PMT decoder): invalid section (table_id == 0x41)
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc0)
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc1)
libdvbpsi error (PMT decoder): invalid section (table_id == 0xc0)
3: 2.1 WSB HD
8: 0.0 (encrypted)
10: 17.1 WTBS HD
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 2) for PID 160
All those errors are from vlc, they can be piped to /dev/null if they frighten you.
Code:
hdtest >/dev/null 2>&1
_________________
LOL! "...amazingly, incredibly, spectacularly bad."
-tjc