HDHomeRun HD channel and connect issues

For discussion of topics specific to MythTV on linux
Post Reply
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

HDHomeRun HD channel and connect issues

Post by nmw01223 »

I am running Ubuntu 14.04 (MythBuntu) with MythTV 0.27.5 (up to date). Based in the UK, using Freeview off aerial.

I initially had 2x 292e USB tuners, which worked fine, but I could not tune any HD channels (DVB/T2). Looking at all the posts on this there appears to be a funamental problem with DVB/T2 on this device as the driver will not support auto-switching from T to T2.

I know that there are HD channels because when I use the same 292e tuners on a Windows system using Argus TV, I get them fine.

So I purchased an HDHomeRun Connect.

Set it all up, scanned for channels, and - no HD channels again. In fact, the HDHomeRun found the same set of SD channels as the 292e did. Looking further into MythTV and DVB/T2, I get the impression that this is just not possible with 0.27 due to the fact it handles all T2 channels as T. Is this right, am I wasting my time here? I saw something about modifying the channel database but do not really want to get into that if I can avoid it.

Is it also the case that 0.28, soon to be released, will solve this DVB/T2 problem - there is some suggestion that it will?

The next problem was after a shut down. I have MythTV so it can shut down while waiting for a recording, using ACPI.

When the system is booted, if I try to tune any channel (I am using Kodi as a front end), the Kodi message is 'PVR client - channel not available'. Looking in the back end log it says the tuner is not recognised (0xffffffff80000000), so I do not think it is a Kodi issue.

Running 'hdhomerun_config discover' makes no difference, though it is found. However if I go into the backend setup and out again (don't have to do anything), then it all works, so it is probably the act of restarting the backend.

I have the HDHR directly connected on its own ethernet link and the NIC is set to local link only, which others say is right. I cannot put it on the router and use DHCP for practical layout reasons. I do notice that after every power up the HDHR has a new IP address, always in the 169.254.x.x range, though.

So it seems to me I've made things worse - bought a HDHR and still not got any HD channels, cannot get it to work from a restart without manual intervention.

Can anyone assist?
User avatar
stuarta
Developer
Posts: 220
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by stuarta »

Yes we've added support for tuners like the 292e which don't auto switch between DVB-T and DVB-T2. That will be in 0.28 when it's released
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by nmw01223 »

stuarta wrote:Yes we've added support for tuners like the 292e which don't auto switch between DVB-T and DVB-T2. That will be in 0.28 when it's released
Fantastic, though it makes me wish I hadn't bought the HDHR. Is there a date? There is something out there saying 1/2/16, which is Monday, is it right?
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by nmw01223 »

nmw01223 wrote:... cannot get it to work from a restart without manual intervention?
This may be useful to someone, as after an internet search I've added some script into the /etc/init/mythtv-backend.conf job as follows (after the 'test ...' line in the script ... end script stanza):

Code: Select all

echo "`date`" " Searching for HDHR" > /var/log/mythtv/mythtv-backend-start
for i in `seq 1 30` ; do
    if hdhomerun_config discover >> /var/log/mythtv/mythtv-backend-start ; then
        echo "`date`" "HDHR found" >> /var/log/mythtv/mythtv-backend-start
        break
    else
        echo "[$i] " " : HDHR not found" >> /var/log/mythtv/mythtv-backend-start
        sleep 1
    fi
done
This is typed in from memory so there might be typos in it, but in principle
- puts out a time stamped message saying looking for HDHR
- Up to 30x it will use the HDHR utility to see if one has appeared yet by checking the exit code (after that it gives up because you don't want it stuck for ever)
- once the HDHR turns up, it carries on (if there were several, but I only have one, I'm assuming they'd all appear approximately at once)
- it keeps a brief transient log of what it was up to

Some points to note:
- conf files are bourne shell, not bash, so use relevant script syntax
- any command error (eg exit code 1) will cause the script to abort, but the HDHR utility returns 1 when it finds nothing, so it only doesn't abort because the utility is running in a conditional (if) statement, which is allowed
- the utility doesn't need a path because it is in /usr/bin and that is already in $PATH.

The point being that the HDHR must be there and visible before the backend starts or it is too late, but the local link ethernet setup (ipv4ll) can take quite some time to sort out IP addresses. From the logged timestamps it tends to be around 12-13 seconds in. You cannot just set up a static IP address for the HDHR (which would be a lot simpler) because the ability to do that appears to have vanished - they have to use DHCP / ipv4ll now (confirmed with Silicon Dust).

Hope that is helpful to someone.
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by nmw01223 »

Problem:

Now discovered this script addition causes a separate problem: it does cause loading of mythbackend to wait until HDHR is loaded, but on system shutdown there is 5 minute freeze at 'wait-for-state stop/waiting' before it will actually shutdown. Tried various changes to it, even just replacing it with 'sleep 20' and the same thing happens. No idea why this is.

Rapidly going off idea of using HDHomeRun.
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by nmw01223 »

Now solved the hang up problem on shutdown - it is caused by the Upstart being confused about process PIDs and tracking the wrong one.

Simple solution is to perform the test at the start of pre-start script instead. This now runs a script (mythtv-findhdhr in /usr/local/bin), and the script is:

Code: Select all

#!/bin/bash
# Checks for presence of HDHR

#LOGFILE="/dev/null"
#LOGFILE="dev/stdout"
LOGFILE="/var/log/mythtv/mythtv-backendstart.log"

TIMELIMIT=20

if [ ! -f /home/pvr/.mythtv/findhdhr ] ; then
    echo "`date`" " : No search for HDHR requested" > $LOGFILE
    exit 0
fi

echo "`date`" " : Search for HDHR" > $LOGFILE
let "TIMEOUT = `date +%s` + $TIMELIMIT"

while true ; do
	hdhomerun_config discover >> $LOGFILE
    if [ "$?" -eq 0 ] ; then
		echo "`date`" " : HDHR detected - exiting" >> $LOGFILE
        exit 0
    fi

    CURTIME=`date +%s`
    if [ $CURTIME -gt $TIMEOUT ] ; then
    	echo "`date`" " : HDHR not detected - exiting" >> $LOGFILE
        break
    fi

	sleep 1

done

exit 1
Basically, it looks for a file 'findhdhr' as a switch to test or not test. When testing it uses hdhomerun_config to check for presence of an HDHR, and exits when it finds one, or after 20 seconds if it doesn't (typically takes ~12 seconds).

Note that the script returns 0 or 1 depending on whether it finds an HDHR, and any error will cause the Upstart script to abort. Therefore it is necessary to treat the script as returning no error at all times:

Code: Select all

pre-start script
    mythtv-findhdhr || true
    ....
end script
This now all seems to detect HDHR correctly, with no shutdown problems, though have not yet tried to use the HDHR again.
nmw01223
Junior
Posts: 25
Joined: Sat Jan 16, 2016 11:52 am
Great Britain

Re: HDHomeRun HD channel and connect issues

Post by nmw01223 »

... and it does all work. Now just need to wait for a MythTV version that supports HD via DVB/T2.
Post Reply