Silicondust HDHomeRun setup

From MythTV Official Wiki
(Redirected from Silicondust HDHomeRun Dual)
Jump to: navigation, search

This page initially focused on the devices for North American broadcast and cable TV but is equally applicable elsewhere. See Category:HDHomeRun for other pages.


Setup Instructions

Requires Myth v0.20.0 or later. These instructions are adapted from HDHomeRun user support forum.

SchedulesDirect

Broadcasters in North America transmit very limited guide information along with their digital TV transmissions. It is recommended to create an account with SchedulesDirect, instead. SchedulesDirect provides guide information at least 2 weeks in advance that is far more extensive and accurate than that available free with broadcast TV. The price is $25/year with first 7 days free.

http://www.schedulesdirect.org/

On the SchedulesDirect website, sign up for an account and create a channel lineup: either Local Broadcast or for your cable provider.

MythTV Setup

mythtv-setup - Capture device

Add a new capture card with the following configuration:
Card type: HDHomeRun DTV tuner box
Device ID: <number from back of HDHomeRun>
Tuner: 0
Finish: <enter>

Shortcut - if there is only one HDHomeRun on the local network you can use the wildcard FFFFFFFF device ID.

Repeat adding a second capture card for tuner 1:
Card type: HDHomeRun DTV tuner box
Device ID: <number from back of HDHomeRun>
Tuner: 1
Finish: <enter>

North America Digital Antenna

Follow the instructions if you receive broadcast programming via an antenna.

mythtv-setup - Video sources
Add a new video source with the following configuration:
Video source name: Antenna
Listings grabber: No grabber (will come back and change this later)
Channel frequency table: us-bcast

mythtv-setup - Input connections
Configure HDHomeRun Port 0 as follows:
Video source: Antenna
External channel change command: <blank>
Preset tuner to channel: <blank>
Scan for channels: <enter>

Scan for channels page:
Scan type: Full scan
Frequency table: Broadcast
ATSC modulation: Terrestrial (8-VSB)
Channel seperator: Period
Existing channel treatment: Minimal updates
Next: <enter>

Back on "Connect source to input page":
Starting channel: <choose a valid channel>
Finish <enter>

Repeat for HDHomeRun Port 1.

Compare the list of channels that Myth has found with the channels listed by SchedulesDirect for your location. In SchedulesDirect, disable any channels that you aren't able to receive. Print the "Report" available from SchedulesDirect's web site--we'll need the enter the XMLTVID values.

mythtv-setup - Channel Editor
For each channel, clear the checkmark on "Use on air guide" and enter the XMLTV ID value from SchedulesDirect.

mythtv-setup - Video sources
Change the configuration for antenna as follows:

Listings grabber: North America (Schedules Direct) (Internal)
User id: <login name for Schedules Direct>
Password: <password for Schedules Direct>
Retrieve lineups: <enter>
Data direct lineup: <select correct listing>
Finish <enter>

North America Digital Cable

Note: you may find Scte65scan to be an alternative option that may more easily align channel numbers.

mythtv-setup - Video sources
Add a new video source with the following configuration:
Video source name: Digital Cable
Listings grabber: No grabber (will come back and change this later)
Channel frequency table: us-cable

mythtv-setup - Input connections
Configure HDHomeRun Port 0 as follows:
Video source: Digital Cable
External channel change command: <blank>
Preset tuner to channel: <blank>
Select "Scan for channels" <enter>

Scan for channels page:
Scan type: Full scan
Frequency table: Cable
ATSC modulation: Cable (QAM-256)
Channel seperator: Period
Existing channel treatment: Minimal updates
Next: <enter>

Back on "Connect source to input page":
Select "Scan for channels" <enter>

Scan for channels page:
Scan type: Full scan
Frequency table: Cable
ATSC modulation: Cable (QAM-64)
Channel seperator: Period
Existing channel treatment: Minimal updates
Next: <enter>

Back on "Connect source to input page":
Starting channel: <choose a valid channel>
Finish <enter>

Repeat for HDHomeRun Port 1.

On the SchedulesDirect website, edit the your channel lineup and enable/disable channels based on channels listed in the Channel Editor in mythtv-setup. Make sure the channel name and number in Schedules Direct matches the display channel name and number in the Channel Editor in MythTV. Print the "Report" available from SchedulesDirect's web site--we'll need the enter the XMLTVID values.


mythtv-setup - Channel Editor
For each channel, clear the checkmark on "Use on air guide" and enter a channel number and the XMLTV ID value from SchedulesDirect.

mythtv-setup - Video sources
Change the configuration for digital cable as follows:

Listings grabber: North America (Schedules Direct) (Internal)
User id: <login name for Schedules Direct>
Password: <password for Schedules Direct>
Retrieve lineups: <enter>
Schedules Direct lineup: <select correct listing>
Finish <enter>

Running mythfilldatabase

If you're replacing previous connections and channels, make sure you download a complete new listing using:

 mythfilldatabase --dd-grab-all

Without that option you'll find yourself still missing guide data.

Make this option the default for all mythfilldatabase runs initiated by mythbackend. In mythtv-setup, go to "General", find the screen "Program Schedule Download Options" and ensure that "Guide data arguments" contains "--dd-grab-all".

At this point, you should be able to run mythbackend and schedule recordings. See the Troubleshooting section if you experience difficulties.

Setting up IR Forwarding

The older HDHomeRun (with the white case) is capable of forwarding infrared (IR) commands via your LAN to LIRC. This can save you some money on purchasing an additional IR receiver for your frontend. However, the IR receiver is very directional and may require you to aim the remote directly at the HDHR. These instructions come from the Silicondust website.

If you don't have them installed already, you need the hdhomerun_config tools installed. If you're using Ubuntu or one of its derivatives, you can install this by entering the following within a terminal:

sudo apt-get install hdhomerun-config

Now that you have the HDHR software installed, you need to figure out what the <device id> of your box is. Do this by entering the following command:

hdhomerun_config discover

You should get a result that follows this format:

hdhomerun device <device id> found at <device IP address>

Now you need to tell the HDHR to send IR commands to your frontend's IP address via a specific port. Port 5000 is used below, but it can be set to any unused port. Just make sure you remember what you set it to because we'll be using that when setting up LIRC.

hdhomerun_config <device id> set /ir/target "<frontend IP address>:5000 no_clear"

NOTE: Silicondust's website says that you can save the IR target to the HDHR's flash memory using the following command. I've had difficulty getting this to work, but here's the command. If this doesn't work either, you'll just need to issue the above command whenever your HDHR is unplugged and sometimes if your router gets reset.

hdhomerun_config <device id> set /ir/target "<frontend IP address>:5000 store" 

The last thing to do is to get LIRC listening for IR commands being sent from your HDHR. We'll kill any lircd processes first, just to be sure. Then we'll get LIRC listening on the proper port. We're using port 5000 again here, because that's what we told the HDHR to use. If you used another port, you'll need to specify that same port here.

sudo killall lircd
sudo lircd -H udp -d 5000

That's it. If mythfrontend is already running on your machine, you'll need to exit out of it and restart the frontend (just the application, not the computer) for it to work.

Troubleshooting

What to do if you get no channels

If you know you for a fact that you should be getting some channels, but mythtv's scanning isn't working - you can try to fix it by doing these two things:

  1. Install the hdhomerun-config utility ( For recent distributions of Ubuntu it's as simple as sudo apt-get install hdhomerun-config )
  2. Run hdhomerun_config discover and make note of the actual device ID, use this instead of FFFFFFF
  3. delete the HDHR tuners and re-add them

For at least one user, the above set of steps solved the problem of getting 0 channels reported. The hdhomerun-config may be required for the scanner to work properly? If you still get nothing try the command: hdhomerun_config DeviceID scan 0
Which should do a scan on tuner 0 of the hdhomerun box and show it with output looking like:
SCANNING: 653000000 (us-bcast:44)
LOCK: none (ss=35 snq=0 seq=0)
SCANNING: 647000000 (us-bcast:43)
LOCK: 8vsb (ss=60 snq=52 seq=100)
TSID: 0x0559
PROGRAM 3: 44.2 World
PROGRAM 4: 44.3 Create
PROGRAM 5: 44.4 Kids
PROGRAM 7: 44.1 WGBX-HD
and so on.

Can't Connect to HDHR?

You may have a firewall in the middle blocking traffic. If so, an easy solution is adding a firewall rule that permits all traffic to and from the HDHR.

The following example uses the HDHR's mac address to avoid any hassles with IP changes:

-A INPUT -m mac --mac-source HDHR:MAC:ADDRESS -j ACCEPT

It is convenient (or maybe required for your OS flavor when using a GUI to edit the rules) to store this rule in an external file. For example, on Fedora, /etc/sysconfig/iptables-hdhomerun, and add a custom rule that refers to that file.

Network Connection

The HDHomeRun normally expects to obtain a DHCP lease. However, with the latest firmware it is also possible to configure it automatically with ipv4 link-local addresses (query: Not with all HDHR devices eg Connect Quattro? How?). This is particularly convenient if you want to connect the HDHomeRun directly to a NIC on your MythTV system, rather than through a switch on your network. To do this, configure your local interface with a static IP address in the range of 169.254.x.x (eg. 169.254.1.10) with a subnet mask of 255.255.0.0 and no gateway. No need to configure routes, the HDHR's will not be accessible to devices on your existing network, but your backend should have no problem seeing them.

Alternatively add the following lines to your interfaces file ('ipv4ll' is a relatively new option, easier than using 'static'):

auto eth1
iface eth1 inet ipv4ll

The HDHomeRun uses UDP to communicate to the backend. Since UDP is connectionless, it does not retry if a packet is lost. This can cause a problem with hubs, especially with multiple HD video streams and other traffic. Any collision on the network generally results in part of the video stream being lost. This shows up as random blocks in the video being corrupt, generally with colors that stand out against the video. Switches resolve this problem since they break up the network into more collision domains, although this problem will still appear if then network becomes fully saturated with traffic or if there are multiple switches in the path.

Truncated Recordings

When connecting to the HDHomeRun, it is recommended that you use the Device ID and not the IP address to specify the HDHomeRun to MythTV-setup. There may be an issue with in addressing the second tuner of the HDHomeRun, which will result in existing recordings terminating abruptly when the other tuner is accessed by MythTV. See #9247.

Ensure that the HDHomeRun device is properly detected on the network using the hdhomerun_config discover command. If it is not, then resolve the connection issue before attempting to add the HDHomeRun in mythtv-setup. If things are configured correctly, the mythtv-setup program should automatically detect the device ID of the HDHomeRun when adding the tuner.

In one case, although the IP of the HDHomeRun could be pinged from the MythTV machine, different netmasks between the MythTV machine and the HDHomeRun caused mythtv-setup and hdhomerun_config not to autodetect the device. Other causes might include a firewall on the MythTV box blocking access.

Network buffers

Choppy playback, trying increasing the network buffers.

sysctl -w net.core.rmem_max=1048576
or by appending a line to /etc/sysctl.conf. eg
net.core.rmem_max=8388608


Network loss

Check for network loss found in silicondust FAQ forum. Pasted below, you can translate the path of the binaries yourself.

Low level test for network packet loss - ATSC/QAM/DVB:

1) Run HDHomeRun Setup and go into the channel editor. Choose a physical channel number (for example CH102). This is the number before the - in the Tune column.

2) From a cmd prompt run: "C:\Program Files\Silicondust\HDHomeRun\hdhomerun_config" FFFFFFFF set /tuner0/channel auto:<channel number> "C:\Program Files\Silicondust\HDHomeRun\hdhomerun_config" FFFFFFFF save /tuner0 null

Replace "<channel number>" with the physical channel number from HDHomeRun Setup (e.g. 102).

If you have more than one HDHomeRun unit then replace "FFFFFFFF" with the device ID of the desired unit.

You should see a series of dots. "n" indicates network packet loss. "t" indicates a reception error. "s" is informational.

Low level test for network packet loss - PRIME:

1) From a cmd prompt run: "C:\Program Files\Silicondust\HDHomeRun\hdhomerun_config" FFFFFFFF set /tuner0/vchannel <channel number> "C:\Program Files\Silicondust\HDHomeRun\hdhomerun_config" FFFFFFFF save /tuner0 null

Replace "<channel number>" with the channel number for an unprotected channel in your area.

If you have more than one HDHomeRun unit then replace "FFFFFFFF" with the device ID of the desired unit.

You should see a series of dots. "n" indicates network packet loss. "t" indicates a reception error. "s" is informational.

No Lock - Australia

The DVB HDHomeRun3 (second generation with a single antenna input) has been known to have issues getting a lock on some Australian channels when set to 'Auto' constellation.

If most channels work fine, but you cannot reliably get a lock on one, or a couple of channels (e.g. SBS Melbourne in particular), try the following:

1) Make sure that the frequency configured in the Transport is correct. SBS Melbourne is 536625000 Hz (536.625 Mhz), not 536500000 (536.5 Mhz) as is configured by default in MythTV. The HDHomeRun appears to be able to correct for this, but it may still cause issues. If you have this incorrect frequency in your transports, delete it then proceed.

2) Do a channel scan scan of the correct frequency, but set the Constellation to QAM-64 and the channel bandwidth to 7Mhz (it may not find the channels if these are set to the default of "Auto"). If, after setting the constellation and bandwidth correctly you do get a lock when scanning for channels, this will create the transport and channels, however it will not configure the constellation correctly to the QAM-64.

mythtv-setup also may not reliably allow you to edit the transport parameters through the GUI.

As an alternative, the following SQL will allow you to reconfigure the transport to QAM-64: mysql> update dtv_multiplex set constellation = "qam_64" where frequency = 536625000;

Failure after system reboot

Following a backend system reboot, the backend may restart before the supporting network and/or the Homerun is fully ready and recordings then fail. A symptom of this is that a further backend restart will fix this. Waiting for the Homerun to be available before starting the backend will resolve this.

A second rarer condition is that one tuner fails and stays 'broken' after having worked fine. The HDHR responds to pings and hdhomerun_config discover commands and a backend restart or reboot does not fix this. A power cycle or reboot of the HDHR followed by a backend restart does fix it. The cause is unknown at the time of writing - see [1].

A script which waits for the HDHR to respond, reboots it then waits again for it to respond before allowing the backend to start will fix the first issue and allow recovery from the second. It also includes code to remove ghost 'pending delete' recordings which can be left by a closedown shortly after the deletion of a recording (but this is not a specific HDHR issue - see [2]).

The script is triggered (in Ubuntu) by an override file /etc/systemd/system/mythtv-backend.service.d/override.conf

[Unit]
After=network-online.target
Wants=network-online.target
[Service]
ExecStartPre=/usr/local/bin/mythbackendpre.sh

which calls /usr/local/bin/mythbackendpre.sh before starting the backend code:

#!/bin/bash
function waitforhdhr(){
  echo "waiting for HDHD" >> $LOG
  for i in $(seq 30); do
   hdhomerun_config $1 get /sys/model > /dev/null 2>&1
   if [ $? -eq 0 ]; then
	echo "Found hdhomerun $1 at try $i" >> $LOG
	return
   fi
   sleep 2
  done
  echo "Cannot find hdhomerun $1 after 30 tries" >> $LOG
  exit 1
}

# run before backend starts 

LOG=/var/log/mythtv/mythbackendpre.log
echo $(date)>$LOG

#wait until hdhomerun is up and running (and network up) then reboot it

waitforhdhr FFFFFFFF
echo "Rebooting hdhomerun" >> $LOG
hdhomerun_config FFFFFFFF set /sys/restart self > /dev/null 2>&1

#whilst rebooting, let's clear and delete pending flags

echo "Clearing out 'pending delete' recordings" >> $LOG
#get database password:
PASS=`grep Password /home/mythtv/.mythtv/config.xml | sed 's/ *<\/*Password>//g'`
SQLLINE="UPDATE recorded SET deletepending = 0 where recgroup = 'Deleted' or recgroup = 'LiveTV';" 
echo $SQLLINE | mysql --database=mythconverg --user=mythtv --password=${PASS} >>$LOG 2>&1

#back to the HDHR:
sleep 3
waitforhdhr FFFFFFFF
exit 0

That log file will need write permissions set.

Note that the three hdhomerun_config commands use FFFFFFFF rather than the individual identifiers. This is a 'wild card' identifier which is fine if you only have one HDHR device. If you operate two HDHRs you will need to find their individual identifiers with hdhomerun_config discover then duplicate the three lines with FFFFFFFF and substitute the individual ids.

If you landed up here from the periodic maintenance page, you do not have a homerun device and are only interested in flushing out 'ghost' recordings than you will need to edit mythbackendpre.sh to remove the homerun stuff. Just leave the code to define the log file, to extract password and echo the $SQLINE.

No EIT data

Only the first tuner can be used for active EIT scanning. It will be used for scanning but grabbed for recording when necessary. See the MythTV forum topic No active EIT scanning If you want to reserve this tuner for EIT only and force recordings on to other tuners then set 'Schedule Order' to zero for this first tuner in the Input Connections in backend setup.

More Information