[mythtv-users] Waiting for a HD HomeRun before starting the MythTV backend

Jay Summet jay at summet.com
Sat Feb 14 19:03:12 UTC 2009


My mythtv box uses a SiliconDust HDHomeRun external network based tuner.
Every so often (1 out of 5 boots) the network subsystem (or at least
DHCP) does not get started up before the mythtv-backend daemon. This
causes an error where the mythtv-backend does not find the tuner, so it
can not record any shows.
[I have my HDHomerun set up with an ethernet crossover cable directly
plugged into the MythTv box, which is doing the DHCP setup of the
HDHomerun directly, as opposed to having an external home router that
does this. I suspect that this is the cause for the race condition.]

To fix this problem, I created a script (wait_for_hdhr) that will wait
for the HDHomerun device to be found on the network before it exits. I
call this script from inside the /etc/init.d/mythtv-backend script just
before it starts up the mythtv-backend.

Now, about 1 out of 5 boots, instead of failing to connect to the tuner,
my Ubuntu 8.04 based mythtv box will “pause” at the booting status bar
for five to ten seconds. Then it drops to the text based boot-up
messages and displays 8 to 12 “No HDHomeRun found yet…” messages before
continuing with the bootup procedure after the network is initialized
and the HDHomerun device is found.

Jay

The script:

#!/bin/bash
#
# This script polls the network for an HD HomeRun device.
# While no device is found, it prints a message and tries
# again.
#
# when a device is found, it exits.
#
RESULT=`hdhomerun_config discover`

#The -q option to grep suppresses output.
while  echo "$RESULT" | grep -q "no"
do
  echo "No HDHomeRun found yet..."
  sleep 1
  #do it again
  RESULT=`hdhomerun_config discover`
done

echo "$RESULT"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20090214/1cbefa31/attachment.pgp>


More information about the mythtv-users mailing list