[mythtv] External channel Changer for DCT-6200

Stacey Son mythdev at son.org
Tue Aug 10 13:51:19 EDT 2004

Below is a small program that I wrote to change channels on a Motorola 
DCT-6200 cable box via a 1394 (aka. Firewire) connection.   I was 
working on some code to record the video/audio via firewire, however, I 
have noticed that my cable provider has started to encrypt (5C/DTCP) 
many of the channels that I care to record.   I am currently using a 
s-video cable, a PVR-250 and this code with mythtv until I figure out 
something better to do.   This works with for DCT-6200 but may be easy 
to modify for other firewire tuners as well.

To use this with mythtv do the following:

(1) Make sure you have 1394/Firewire drivers installed in your kernel.

(2) Install libraw1394, librom1394 and libavc1394.   (On gentoo:  
"emerge libavc1394").

(3) Compile and install "6200ch":

       # cc -o 6200ch 6200ch.c -lrom1394 -lavc1394 -lraw1394
       # cp 6200ch /usr/local/bin

(4) Connect a 1394/Firewire cable from your computer to your DCT-6200 
and test:

       # 6200ch <your_favorite_channel_number>

(5) Configure Mythtv to use the channel changer by running the "setup" 
program and adding to "/usr/local/bin/6200ch" to the "External channel 
change command" field under "Connect source to Input".


-------------- next part --------------
 * 6200ch - an external channel changer for Motorola DCT-6200 Tuner 
 * Copyright 2004 by Stacey D. Son <mythtv at son.org> 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include <libavc1394/rom1394.h>
#include <libavc1394/avc1394.h>
#include <libraw1394/raw1394.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>

// Motorola DCT-6200 IDs
#define DCT6200_VENDOR_ID  0x00000ce5
#define DCT6200_SPEC_ID    0x00005068
#define DCT6200_SW_VERSION 0x00010101
#define DCT6200_MODEL_ID   0x0000620a

#define AVC1394_SUBUNIT_TYPE_6200 (9 << 19)  /* uses a reserved subunit type */ 

#define AVC1394_6200_COMMAND_CHANNEL 0x000007C00   /* 6200 subunit command */
#define AVC1394_6200_OPERAND_SET 0x67      /* 6200 subunit command operand */

#define CTL_CMD0 AVC1394_CTYPE_CONTROL | AVC1394_SUBUNIT_TYPE_6200 | \
        AVC1394_SUBUNIT_ID_0 | AVC1394_6200_COMMAND_CHANNEL | \

#define OPERAND0 0x040000FF
#define OPERAND1 0xFF000000

#define STARTING_NODE 2  /* skip 1394 nodes to avoid error msgs */

void usage()
   fprintf(stderr, "Usage: 6200ch [-v] <channel_num>\n");

int main (int argc, char *argv[])
   rom1394_directory dir;
   int device = -1;
   int i;
   int verbose = 0;
   quadlet_t cmd[3];
   int chn = 550;

   if (argc < 2) 

   if (argc == 3 && argv[1][0] == '-' && argv[1][1] == 'v') {
      verbose = 1;
      chn = atoi(argv[2]);
   } else {
      chn = atoi(argv[1]);

#ifdef RAW1394_V_0_8
   raw1394handle_t handle = raw1394_get_handle();
   raw1394handle_t handle = raw1394_new_handle();

   if (!handle) {
      if (!errno) {
         fprintf(stderr, "Not Compatable!\n");
      } else {
         perror("Couldn't get 1394 handle");
         fprintf(stderr, "Is ieee1394, driver, and raw1394 loaded?\n");

   if (raw1394_set_port(handle, 0) < 0) {
      perror("couldn't set port");

   int nc = raw1394_get_nodecount(handle);
   for (i=STARTING_NODE; i < nc; ++i) {
      if (rom1394_get_directory(handle, i, &dir) < 0) {
         fprintf(stderr,"error reading config rom directory for node %d\n", i);

      if (verbose) 
         printf("node %d: vendor_id = 0x%08x model_id = 0x%08x\n", 
                 i, dir.vendor_id, dir.model_id); 
      if ( (dir.vendor_id == DCT6200_VENDOR_ID) &&
	   (dir.model_id == DCT6200_MODEL_ID)) {
            if (dir.unit_spec_id != DCT6200_SPEC_ID)
               fprintf(stderr, "Warning: Unit Spec ID different.\n");
            if (dir.unit_sw_version != DCT6200_SW_VERSION)
               fprintf(stderr, "Warning: Unit Software Version different.\n");
            device = i;
   if (device == -1) {
        fprintf(stderr, "Could not find Motorola DCT-6200 on the 1394 bus.\n");

   cmd[0] = CTL_CMD0;
   cmd[1] = OPERAND0 | (chn << 8);
   cmd[2] = OPERAND1;

   if (verbose)
      printf("AV/C Command: Opcode=0x%08X Operand0=0x%08X Operand1=0x%08X\n", 
              cmd[0], cmd[1], cmd[2]);

   if (avc1394_send_command_block(handle, device, cmd, 3) != 0) {
      fprintf(stderr, "Command not accepted\n");


More information about the mythtv-dev mailing list