Installing a Hauppauge WinTV HVR-1600 tuner card in Mythbuntu 8.10

After struggling for almost two days while attempting to install a new Hauppauge hvr-1600 tuner card in my old Mythbuntu 8.04 installation, I finally threw caution to the wind and used the Gnome System->Admin->Update Manager to move up to 8.10 Intrepid Ibex. Suddenly, to my great delight, the card was recognized within the mythbackend setup program and I was able to configured the mpeg encoder and dvb ATSC tuner. So far everything appears to be working. Here are some hints you may find helpful if you intend to install this card.

Note: My Mythbuntu 8.10 installation includes the Gnome desktop which I prefer over the XFS desktop. So some of the references here will be slightly different. If you want the Ubuntu Desktop(aka Gnome DT), then in the Mythbuntu Control Centre program. ,  you can command Mythbuntu to install it.  Click  System Roles -> Desktop Role then check by  Ubuntu Desktop then Apply.  Be ready for a long download.  Also it’s possible to run the Mythtv Backend Setup Program on one of the two default Gnome desktops.  If you have the Gnome (Ubuntu)  desktop installed,  you could display this hints page on one desktop and the Mythbuntu setup screens on the other for easy reference, jumping back and forth by pressing  Ctrl+Alt  ->(right arrow)  or Ctrl+ Alt <- (left arrow)

The reason that Mythbuntu 8.10 worked where Mythbuntu 8.04.2 didn’t was, I think, is that 8.10 installs the correct drivers for this card. Apparently, the kernel 2.6.27 includes the drivers for this card. So, the command below entered in a terminal window, should show the firmware files these critical firmware files:

lj@mythtv:$ ls -alt /lib/firmware/v4l*
-rw-r–r– 1 root root 141200 2008-10-26 23:33
/lib/firmware/v4l-cx23418-apu.fw
-rw-r–r– 1 root root 158332 2008-10-26 23:33
/lib/firmware/v4l-cx23418-cpu.fw
-rw-r–r– 1 root root 16382 2008-10-26 23:33
/lib/firmware/v4l-cx23418-dig.fw

After the card has been inserted in its PCI slot, and Mythbuntu 8.10 rebooted, your system utility “list pci” should show:

lj@mythtv:~$ lspci -v | grep Conexant
05:02.0 Multimedia video controller: Conexant Systems, Inc. CX23418
Single-Chip MPEG-2 Encoder with Integrated Analog Video/Broadcast Audio
Decoder

Buried in the generous text output of “lspci -v”,  you should find a paragraph similar to this one:

05:02.0 Multimedia video controller: Conexant Systems, Inc. CX23418
Single-Chip MPEG-2 Encoder with Integrated Analog Video/Broadcast Audio
Decoder
Subsystem: Hauppauge computer works Inc. Device 7444
Flags: bus master, medium devsel, latency 64, IRQ 18
Memory at e4000000 (32-bit, non-prefetchable) [size=64M]
Capabilities:
Kernel driver in use: cx18
Kernel modules: cx18

Dmesg, the system message utility,  should show lots of cx18 activity:

lj@mythtv:~$ dmesg | grep cx18
[ 13.645863] cx18: Start initialization, version 1.0.0
[ 14.040459] cx18-0: Initializing card #0
[ 14.040462] cx18-0: Autodetected Hauppauge card
[ 14.040474] cx18 0000:05:02.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[ 14.040483] cx18-0: Unreasonably low latency timer, setting to 64 (was 32)
[ 14.041783] cx18-0: cx23418 revision 01010000 (B)
[ 14.244769] cx18-0: Autodetected Hauppauge HVR-1600
[ 14.244772] cx18-0: VBI is not yet supported
[ 14.512133] tuner 4-0043: chip found @ 0×86 (cx18 i2c driver #0-1)
[ 14.526900] tuner 4-0061: chip found @ 0xc2 (cx18 i2c driver #0-1)
[ 14.526923] cs5345 3-004c: chip found @ 0×98 (cx18 i2c driver #0-0)
[ 14.530740] cx18-0: Disabled encoder IDX device
[ 14.530816] cx18-0: Registered device video0 for encoder MPEG (2 MB)
[ 14.530819] DVB: registering new adapter (cx18)
[ 14.609402] cx18-0: DVB Frontend registered
[ 14.609551] cx18-0: Registered device video32 for encoder YUV (2 MB)
[ 14.609700] cx18-0: Registered device video24 for encoder PCM audio (1 MB)
[ 14.609851] cx18-0: Registered device radio0 for encoder radio
[ 14.609854] cx18-0: Initialized card #0: Hauppauge HVR-1600
[ 14.610129] cx18: End initialization
[ 109.298075] cx18-0: loaded v4l-cx23418-apu.fw firmware V00120000
(141200 bytes)
[ 109.855620] cx18-0: loaded v4l-cx23418-cpu.fw firmware (158332 bytes)
[ 109.861762] cx18-0: FW version: 0.0.74.0 (Release 2007/03/12)
[ 111.048707] cx18-0: loaded v4l-cx23418-dig.fw firmware (16382 bytes)

Mythbuntu Backend Setup

If you are getting these messages, you are ready for the next step. So click System->Admin-> Mythbackend Setup to bring up the following screen. We’ll go through steps 2 through 4 shown below:

Mythbuntu Backend Setup Screen

Mythbuntu Backend Setup Screen

Click #2  Capture Card then and select New Capture Card. First we’ll set up the mpeg encoder. The versatile HVR-1600 has an old styleanalog  NTSC tuner, a newer digitial ATSC (8-VSB or clear QAM) tuner, and most importantly a hardware mpeg enccoder. It’s this encoder we’ll configure first.

Tab to the Card Type field and left/right arrow until you select MPEG-2 encoder card as shown. Probed Info: should automatically be filled in with HVR-1600 as shown.  If this is the only encoder device in your PC,  the /dev/video0 is correct.  If you have more than one choice in the device field,  you have to go back to dmesg and see what device ubuntu linux assigned the HVR-1600 encoder.  For example, it might be /dev/video1. Likewise, /Default input set to S-Video 1 because I’m connecting the s-video input of my satellite receiver to the s-video of the HVR-1600.   The HVR-1600 also shows an S-Video 2.  I don’t know what thats attached to.  When you are satisfied, click Finish.

Capture Card Setup showing MPEG enccoder of HVR1600 selected.

Capture Card Setup showing MPEG enccoder of HVR1600 selected.

Click New Card again. Again tab to the card type and then Again select New Capture Card, move down to the Card type field, then left/right  on your cursor until until DVD DTV capture card is selected. The Front End ID: should show the Samsung model as shown below.  Note that this card shows up as DVB1. That’s because it’s the second ATSC card installed in my Mythbuntu.  My HD5000 ATSC card already claims DVB0.  Click Finish and Esc back to the main menu (the one with the red and white sprocket wheels)

Capture Card Setup showing ATSC tuner of HVR1600 selected.

Capture Card Setup showing ATSC tuner of HVR1600 selected.

I didn’t test the NTSC tuner part of the HVR-1600 card because no non-duplicated program material is available locally on analog anymore.

3. Video Sources

Next escape back to the main setup screen.  Select #3 Video Sources.  Here is where you tell mythtv the methods by which you will feed your mythtv installation television. For example,  I have two sources. First, I get a few ATSC stations from over the air using an outside antenna. Second, I have the s-video of the HVR-1600 hooked up to the s-video output of my Dish Satellite Receiver Box. The first source I called antenna and used the “scan for channels” to cause Mythbuntu’s backend program to scan all 83 channels while adding the active channels to an internal table. The second source I labeled “dish” and was created by subscribing to Schedules Direct.

Source (dish sat receiver)  connected to  HVR1600 Mpeg encoder

Source (dish sat receiver) connected to HVR1600 Mpeg encoder

Note: Don’t hit Scan for Channels here where you are configuring the Capture Device /dev/Video0. After all, the hardware encoder can’t scan. It creates mpeg video with whatever baseband video you have connected to the HVR s-video input. The only time Scan for channels should be clicked is where the HVR is connected to an outside antenna or a cable TV line. So you would click Scan for channels, for example, if you were configuring Capture Device: DVB0: In my case, I ” Fetch channels from listing source” when I want to bring down a list of my dish network channels I subscribe to. The list is configured at the Schedules Direct Site(See screen shot below) This was an endless source of confusion for me. Anyway if you want, you can escape out to the Main window (sprocket wheels) and look at what channels you have configured by choosing #5. the Channel Editor.

Here’s what the schedules direct configuration screen looks like. Simply click on the channels your satellite or cable provider supplies and then click Fetch Channels from Listings Source.

Schedules Direct Configuruation Screen  Red appear in Mythtv Program Guide

Schedules Direct Configuruation Screen -- Red appear in Mythtv Program Guide

Remote Control  and Blaster Setup

Finally, you need to tell Mythbuntu you are planning to use the HVR-1600′s imitation  mceusb remote and  infra-red blaster. System-> Administration-> Mythbuntu Control Centre then choose “Infrared Devices”. Your screen should look like this one:

HVR1600 Remote and Blaster Configuration Screen

HVR1600 Remote and Blaster Configuration Screen

If your remote isn’t working, here a few diagnostic tests you can run.
“ls -al /dev/lirc*” should show:
lj@mythtv:/$ ls -al   /dev/lirc*

crw-rw—- 1 root root 61, 0 2009-02-28 08:30 /dev/lirc0
srw-rw-rw- 1 root root 0 2009-02-28 09:06 /dev/lircd

If after making a change to the remote (lirc) configuration files, you can restart the lirc processes by doing:

lj@mythtv:/$ sudo /etc/init.d/lirc restart
* Stopping remote control daemon(s): LIRC [ OK ]
* Loading LIRC modules [ OK ]
* Starting remote control daemon(s) : LIRC [ OK ]

If you open a terminal window, Applications->Accessories->Terminal and then enter “irw” you should see some responses when you press your remote as shown in the example below:

lj@mythtv:~$ irw
000000037ff07be1 00 Up mceusb
000000037ff07be1 01 Up mceusb
000000037ff07be1 02 Up mceusb
000000037ff07bdd 00 OK mceusb
000000037ff07bdd 01 OK mceusb
000000037ff07bdd 02 OK mceusb

The file /etc/lirc/hardware.conf set up for the HVR-1600 remote and blaster controlling my Dish Network ViP612 receiver looks like this:

# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE=”Windows Media Center Remotes (new version Philips et al.)”
REMOTE_MODULES=”lirc_dev lirc_mceusb2″
REMOTE_DRIVER=”"
REMOTE_DEVICE=”"
REMOTE_LIRCD_CONF=”mceusb/lircd.conf.mceusb”
REMOTE_LIRCD_ARGS=”"

#Chosen IR Transmitter
TRANSMITTER=”Microsoft Windows Media Center V2 (usb) : Dish Receiver”
TRANSMITTER_MODULES=”lirc_dev lirc_mceusb2″
TRANSMITTER_DRIVER=”"
TRANSMITTER_DEVICE=”/dev/lirc0″
TRANSMITTER_LIRCD_CONF=”dish/general.conf”
TRANSMITTER_LIRCD_ARGS=”"

Blaster Configuration

Just plug in the IR blaster to the USB phono plug socket and place it near the infra-red detector of your reciver or cable box.  By default,  the script that causes infra-red commands to be sent is placed in the directory  /usr/local/bin.    You have to tell Myth Setup where it is and insert the complete path to the channel change script. For example,   /usr/local/bin/change-channel-lirc.pl   is how mine is entered.   Also the channel change script must be readable.   So you might have to do   “sudo chmod +rx /usr/local/bin/change-channel-lirc.pl”

To test whether your channel change script will command your external box (like my Dish Sat. Receiver), I brought up my TV so I could monitor the output of the Dish Network Receiver. Then I ssh’d into my mythtv box from another PC.

lj@dell:~$ ssh -Y lj@mythtv
lj@mythtv’s password:
Linux mythtv 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686

I then commanded the channel change script to go to Dish networks WX channel on channel number 214.

lj@mythtv /usr/local/bin/change-channel-lirc.pl 214

If I see the WX channel popup on the TV, so much the better. Then I tried the same with 200 rather than 214 to see if I could change to CNN (on Dishnetwork it’s channel 200).

The channel change script written in perl (the dot pee ell) at the end, doesn’t know how to deal with four digit channels used by Dishnetwork. So I modified it. Here’s my “channel-change-lirc.pl” script:

$remote_name = “dish”;
# Next two lines added to get rid of advertisement that comes up
# on the Disnetwork Vip612 receiver when inactive.
system (“irsend -d /dev/lircd SEND_ONCE $remote_name power_on”);
sleep 5;
system (“irsend -d /dev/lircd SEND_ONCE $remote_name select”);
sleep 1;

sub change_channel {
my($channel_digit) = @_;
system (“irsend -d /dev/lircd SEND_ONCE $remote_name $channel_digit”);
sleep 1;
}
# allow for four digit channels such as 9404 on Dishnetwork
$channel=$ARGV[0];
sleep 1;
if (length($channel) > 3) {
change_channel(substr($channel,0,1));
change_channel(substr($channel,1,1));
change_channel(substr($channel,2,1));
change_channel(substr($channel,3,1));
} elsif (length($channel) > 2) {
change_channel(substr($channel,0,1));
change_channel(substr($channel,1,1));
change_channel(substr($channel,2,1));
} elsif (length($channel) > 1) {
change_channel(substr($channel,0,1));
change_channel(substr($channel,1,1));
} else {
change_channel(substr($channel,0,1));
}
system (“irsend -d /dev/lircd SEND_ONCE $remote_name select”);

DishNetwork Receiver Remote Address Scheme

You’ll notice that the above script calls out a remote “dish”.   If you look in the file ~/.lirc/mythtv, you will find sixteen different remote=  sections. (dish throughdish16  This corresponds to the  sixteen different addresses that Dish Network remotes and receivers can be set to.  If you call out the wrong one,  your script will not cause the receiver to change channel.   Since Dish uses a UHF or Wireless Remote,  there was the possibility that a neighbor in your apartment complex could control your receiver.  With sixteen different addresses, at least sixteen people could co-exist close by.  The important point for MythTV users is that you must select the correct “remote” to use. “dish” as called out above is good for the default or “dish1″ address.   If your receiver uses address 2, then you need to call out “dish2″  ($remote_name = “dish2″;)   How do you find out which address your receiver is set to receive?   Press System Info from the VIP612′s front panel.   The receiver address shows up as a number near the modulator output channel (3 or 4).

Remote Button Assignments

Finally I modified some of the button assignments. I made the Red button spit out “D” to delete a recording by adding the following stanza to the end of the ~/.lirc/mythtv file:

begin
remote = mceusb
prog = mythtv
button = Red
config = D
repeat = 0
delay = 0
end

I like the volume up/down buttons to repeat so that the volume indicator line changes rapidly as you hold down the button. Putting a # at the beginning of a line makes it into a  comment or documentation line, not read by the lirc processes.

# change repeat to = 2 so holding vol down  button rapidly
# and continuously changes the green on screen volume indicator
begin
remote = mceusb
prog = mythtv
button = VolUp
config = ]
repeat = 2
delay = 0
end

If you want to know what command with the correct capitalization and spelling pops out when a particular button is pressed, this diagram may help.  For example,   I reassigned the DVD button to Escape, so I could walk back out of mythtv’s menus by pressing the conveniently located DVD button.

HVR-1600 Remote showing Button Outputs

HVR-1600 Remote showing Button Outputs

This entry was posted in MythTV and Mythbuntu and tagged , , , . Bookmark the permalink.