random findings by wt8008
RSS icon Home icon
  • HDHomerun, Comcast QAM, MythTV

    Posted on September 4th, 2010 wt8008 2 comments

    With my new HDHomeRun, I need to setup MythTV backend to get channels from Comcast unencrypted QAM.Mythbuntu comes preinstalled with the hdhomerun_config command line and GUI tools, under Applications->Multimedia->HDHomeRun Config GUI. If it is plugged in the “Scan” button will discover any tuners on the network. Also, if you plug different sources into HDHomeRun, such as Cable and OTA, note the tuner numbers for later reference. If you have dual tuners you will have two entries. From there, you can flip through the channels and view what streams exist under that channel. With the “View” button VLC will open and play the video stream.

    HDHomeRun Config GUI

    HDHomeRun Config GUI

    The device ID of your HDHomeRun can be found by

    $ hdhomerun_config discover

    The output will look like

    hdhomerun device XXXXXXXX found at Y.Y.Y.Y

    where the XXXXXXXX represents the HDHomeRun ID, and Y.Y.Y.Y is the IP address. You should note the ID for use later on.

    Channel Scanning

    Integrating into Mythtv is not as direct as I hoped. The scanner built into Mythtv 0.23 does not handle the Comcast QAM stream properly. It can scan the channels, but it cannot use the virtual channel numbers from Comcast, and Mythtv will results in many conflicting channel numbers. Follow the guide at http://www.mythtv.org/wiki/Scte65scan to use scte65scan to scan and discover the virtual channel numbers. The rough procedure from the wiki is below:

    1. Run mythtv-setup to configure the backend.
    2. Setup section 1: General, and section 2: Video sources. Do not setup the other sections (or else the database dump of scte65scan will not work, maybe using -f4 as a command line option is a workaround and also default sourceid=1 , not tested or tried yet.)
    3. Download scte65scan source and HDHomerun libraries, follow the instructions to compile and for editing the HDHomrun Makefile.
    4. The VCT_ID for my area is 3065 (0x0bf9), after following the instructions on the wiki to discover them (the scan takes a few minutes):

    $ ./scte65scan -H FFFFFFFF us-Cable-Standard-center-frequencies-QAM256

    5. Now the SQL script will be generated to be used to import into Mythtv.

    $ ./scte65scan -H XXXXXXXX,0 -p -f3 -V 3065 us-Cable-Standard-center-frequencies-QAM256 > vct.sql

    Recall XXXXXXXX is the HDHomeRun ID, the 0 after it represents the tuner number, -p option is needed for the local PSIP channels in the cable stream, -f3 for SQL install script, -V 3065 where 3065 is my local areas VCT_ID, us-Cable-Standard…. is a file containing the channel frequencies that will be scanned, and finally vct.sql is the output SQL script. Read

    $ scte65scan --help

    for more details.

    6. Next import the output to the SQL database

    $ mysql -u mythtv -p mythconverg < vct.sql

    This allows you to access the mythconverg database as the mythtv user, but remember to lookup the database password in the Mythtv frontend before you proceed. The other method is to logon as -u root, if you remember the initial password you setup for it. If you get an error regarding

    ERROR 1062 (2300) at line 4: Duplicate entry '1' for key 'PRIMARY'

    it is due already having video sources defined, you can either delete them, or try different -f options in

    $ scte65scan --help

    7. The channel information entered is viewable in the backend setup under 5. Channel Editor. Continue with the setup by adding the 3. Video Source, and the channels should populate without a scan. Also setup the 4. Input connections.

    The channel scanner for OTA signals works fine, so you can use the internal scanner for that purpose.

    Inferred Sensor

    Using the inferred sensor on the HDHomeRun requires telling the device to forwards the signals to the backend, using lircd on the backend to process the signals into keys, and having mythtv map the remote key presses to keyboard shortcuts.

    The HDHomeRun site has a guide for setting up the HDHomeRun.

    $ hdhomerun_config  <device id> set /ir/target "<backend-ip>:5000 store"

    The store command saves the setting into flash, so on reboot of the tuner, it will continue to foward the IR commands. Next, use irrecord to let the computer learn each key of the remote.

    $ irrecord -H udp -d 5000 "<name of remote>"

    Attempt to give generic/general key names, since later a parser will be used to generate the key maps to Mythtv. Copy the resulting file,

    # sudo mv "<name of remote>" /etc/lirc/lircd.conf

    Now to start up lircd the first time, I recommend using verbose mode to watch what happens.

    # sudo lircd -n -H udp -d 5000

    Use irw to test the setup. With irw running press remotes on the key and it will print out the corresponding key that is pressed. If all is well then configure the /etc/lirc/hardware.conf file. Some recommended settings


    Now, setup the key mapping between lirc and MythTV, Mythbuntu users can use

    $ mythbuntu-lirc-generator

    This will parse the keynames in /etc/lirc/lircd.conf and guess a corresponding key/function in MythTV. Next, manually edit the generated file

    $ vim ~/.lirc/mythtv

    Custom mappings or unmaps keys needs to be manually added in. The format is

      remote = "<name of remote>"
      prog = mythtv
      button = CHUP
      config = Page Up  
      delay = 0
      repeat = 0