The Motorola DCT700 digital cable box is pretty common these days. Many cable providers are forcing its adoption in order to get access to "digital tier" programming. For MythTV users an external IR Blaster is required to control changing of channels for scheduled recordings. A remote definition will need to be added for the cable box and a channel changer script implemented to control the blaster. Fortunately this setup is relatively straightforward and problem-free. You will NOT see the STB's overlay in mythtv (but the myth overlay will obviously work just fine).

This setup was tested using the Microsoft MCE Remote and IR Receiver/Transmitter http://www.mythtv.org/wiki/index.php/MCE_Remote

Before Starting

Make sure your remote is configured and working properly in the myth frontend. You may choose from a number of preselected configurations by running the dpkg-reconfigure command. With the Windows MCE remote, pick the MCE Remote/Transmitter option and the Windows MCE/Motorola Cable box option.

Adding a remote definition for the DCT700 to /etc/lirc/lircd.conf

Once you setup LIRC for the MCE receiver/transmitter the blaster should work out of the box. You will first need to either create a remote definition using the irrecord command or use the following file (recommended. It works around the 0 issue). Simply create a file called DCT700.conf in /etc/lirc/ and copy the configuration below.

#########
#
# Modified DCT2000 entry for DCT700 (sends zeros)
# For use with the USB MCE ir receiver
#

begin remote

  name   DCT700
  flags RAW_CODES
  eps            30
  aeps          100

  ptrail        520
  repeat     0     0
  gap    100000

      begin raw_codes

          name bypass
             9000    4400     550    2200     550    2150
              550    4450     550    2150     550    4450
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    4450     550    4400
              550    2200     550    4400     550

         name power
             9050    4400     550    2200     550    4400
              550    2200     550    4400     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    4400
              550    4450     550    2150     550

          name help
             9000    4400     600    2150     550    4450
              550    2150     550    2200     550    4400
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    4450
              500    2200     550    4450     550

          name day-
             9000    4400     550    4400     550    2200
              550    2200     550    4400     550    4400
              600    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     500    2200
              550    4450     550    2150     550

          name day+
             9000    4400     550    2200     550    2200
              550    2150     550    4450     550    4400
              550    4400     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    4450     550    2150
              550    4450     550    2200     500

          name rec
             9050    4400     550    4400     550    2200
              550    2200     550    2150     550    4450
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    4450     550    4400     550

          name stop
             9000    4400     550    4400     550    2200
              550    2200     550    4400     550    4400
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    4450     500    2200     550

          name pause
             9000    4400     550    4400     550    4450
              550    4400     550    4450     550    4400
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550

          name rew
             9000    4400     550    2200     550    4400
              550    4450     550    4400     550    4450
              550    2150     550    2200     550    2200
              500    2200     550    2200     550    2200
              500    2200     550    4450     550    2150
              550    2200     550    2200     500

          name ffwd
             9050    4400     550    4400     550    2200
              550    4400     550    4450     550    4400
              550    2200     550    2150     600    2150
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    4450
              550    2200     500    2200     550

          name play
             9050    4400     550    2150     550    2200
              550    2200     550    4400     550    4400
              550    4450     550    2200     550    2150
              550    2200     550    2200     500    2200
              550    2200     550    4400     550    2200
              550    4400     550    2200     550

          name pageup
             9000    4400     550    2200     550    4400
              550    2200     550    4400     550    4450
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4400     550    4450
              550    2150     550    2200     550

          name pagedown
             9000    4400     550    4450     550    4400
              550    2200     550    4400     550    4450
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    4400
              550    2200     550    2150     550

          name info
             9050    4400     550    4400     550    4400
              600    2150     550    2200     550    4400
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    4450
              550    2150     550    4450     550

          name menu
             9050    4400     550    4400     550    2200
              550    2200     550    4400     550    4400
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    4400
              550    4400     550    2200     550

          name guide
             9050    4400     550    2150     600    2150
              550    2200     550    2150     550    4450
              550    4400     550    2200     550    2150
              600    2150     550    2200     550    2200
              500    2200     550    4450     550    2150
              550    4450     550    4400     550

          name lock
             9000    4400     600    2150     550    4400
              600    4400     550    2200     550    4400
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    2200
              550    2150     550    4450     550

          name exit
             9000    4400     550    2200     550    4400
              550    2200     550    2200     550    4400
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    2200
              550    4400     550    4450     550

          name up
             9000    4450     550    2150     550    2200
              550    4400     550    2200     550    4400
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    2200
              550    2200     500    4450     550

          name down
             9000    4400     600    4400     550    2200
              550    4400     550    2200     550    4400
              550    4400     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    4450     550

          name left
             9000    4400     550    2200     550    4400
              550    4400     600    2150     550    4450
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4400     550    4450
              550    4400     550    2200     550

          name right
             9050    4400     550    4400     550    4450
              550    4400     550    2200     550    4400
              550    4400     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    4450
              500    4450     550    2200     550

          name ok
             9050    4400     550    4400     550    2200
              550    2200     550    2150     550    4450
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    4400
              550    4450     550    4400     550

          name ch+
             9000    4400     550    4400     550    4450
              550    2150     600    4400     550    2150
              600    2150     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4450     500    2200
              550    4450     550    2150     550

          name ch-
             9050    4400     550    2150     600    2150
              550    4450     550    4400     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    4400     550    2200     550

          name last
             9000    4400     550    4450     550    4400
              550    2200     550    2150     550    4450
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    4400     550    4450     500

          name fav
             9000    4400     550    4450     550    2150
              550    4450     550    2150     550    4450
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    4450
              500    2200     550    4450     500

          name enter
             9000    4400     600    2150     550    2200
              550    2150     550    2200     550    4400
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4450     500    4450
              550    4400     550    4450     550

          name music
             9000    4400     550    2200     550    2200
              550    2150     550    2200     550    4400
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4400     550    4450
              550    4400     550    4450     500

          name p
             9000    4400     600    4400     550    4400
              550    4450     550    2150     550    4450
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    4450     550

          name x1
             9050    4400     550    4400     550    4450
              550    4400     550    2200     550    2150
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    4450
              500    4450     550    2200     550

          name x2
             9050    4400     550    2150     550    2200
              550    2200     550    4400     550    2200
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    4400
              550    4450     550    2150     550

          name 1
             9000    4400     550    4450     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4400     550    4450
              550    4400     550    4450     550

          name 2
             9000    4400     550    2200     550    4400
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    4450
              550    4400     550    4450     500

          name 3
             9000    4400     550    4450     550    4400
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550    2200
              550    4400     550    4450     500

          name 4
             9000    4400     550    2200     550    2150
              550    4450     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    4400     550    4450     550

          name 5
             9000    4450     550    4400     550    2200
              550    4400     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    2200     550    2150
              550    2200     550    4400     550    4450
              550    2200     500    4450     550

          name 6
             9000    4400     550    2200     550    4400
              550    4400     600    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     500    2200     550    2200
              550    2200     500    2200     550    4450
              550    2150     550    4450     550

          name 7
             9000    4400     550    4400     600    4400
              550    4400     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    4450     550    2150
              550    2200     550    4400     550

          name 8
             9000    4400     550    2200     550    2150
              550    2200     550    4400     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    2150     550    2200
              550    2200     550    4400     550

          name 9
             9050    4400     550    4400     550    2200
              550    2150     600    4400     550    2150
              600    2150     550    2200     550    2200
              500    2200     550    2200     550    2200
              500    2200     550    4450     550    4400
              550    4400     550    2200     550

          name 0
             9000    4400     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550    2200
              550    2150     550    2200     550   42050
             9000    2250     500

      end raw_codes

end remote

Once you have done this, be sure to add an include line in your /etc/lirc/lircd.conf file for this configuration file we've just created. Simply add the following text to the end of your lircd.conf file:

#Configuration for the Motorola DCT700 Set Top Box IR codes:
include "/etc/lirc/DCT700.conf"

Testing the Remote definition and blaster

Restart LIRC:

$ sudo /etc/init.d/lirc restart

Next we'll test to see if the remote keys are defined correctly:

$ irw

You should see output for all the remote buttons you press.

Next we'll trying getting the blaster to do something on the cable box:

$ irsend SEND_ONCE DCT700 info

You should see the emitter on the blaster light up. If it blinks then we're in business. Don't panic if the cable box didn't do anything. The cable box is very picky as to where the IR receiver is located. Try issuing the following command which will repeatedly send the command to the blaster:

$ irsend SEND_START DCT700 info

The emitter is now sending a continuous stream of pulses. You will need to move the blaster around until you find the sweet spot. It will be similar to this:

http://farm2.static.flickr.com/1177/901277882_729f8f3489.jpg

Once it’s working you can stop the pulses by issuing the following command:

$ irsend SEND_STOP DCT700 info

Next try to change the channel to 151 (or some other channel) via the following command:

$ irsend SEND_ONCE DCT700 1 5 1 

Finally try powering the cable box on and off:

$ irsend SEND_ONCE DCT700 power

Create a change channel script

You will need to create a script called change-channel.sh and add it to /usr/local/bin and later add this to the "channel change script" entry in the Input Connections section of "mythtv-setup".

REMOTE_NAME=DCT700
cmd="$1"

case $cmd in
    [0-9]*)
    for digit in $(echo $1 | sed -e 's/./& /g'); do 
        irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME $digit
        sleep 0.2
        # If things work OK with sleep 1, try this for faster channel changes:
        # sleep 0.3
    done
        irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME OK
sleep 1
        irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME EXIT
    ;;

    *)
        irsend SEND_ONCE $REMOTE_NAME $cmd
        ;;
esac

"Note:" Moving the send of EXIT to before the loop over digits may give you success for channels 3 digits in length. That also may solve an issue with some of the first digits being dropped. It seems that the EPG from Comcast needs to be exited first before entering digits.

After you've created the file with your text editor of choice and then modify the permissions to make it executable by all users.

$ sudo chmod +x /usr/local/bin/change-channel.sh
$ sudo chmod 775 /usr/local/bin/change-channel.sh

As an alternative, the old channelchange.pl has been rewritten for the updated lirc files.

Again, you can access it at http://kin.bounceme.net/channelchange.pl

############################################################
# File -            channelchange.pl
# Author -          Guardian Bob
# Date -            Tuesday, August 07, 2007
# E-Mail -          Guardian.Bob@gmail.com
# Description -     Changes channels.
# Changelog -       August 07, 2007
#                   Initial Revision
#
#                   August 19, 2007
#                   Adjusted the sleep (0.2->0.3) as at
#                   0.2 two 5 commands were treated as 1.
#                   Starting each channel change with a
#                   ch+ to try to bring the box out of
#                   a standby mode (sometimes the box 
#                   ignores the first command sent.)
#
#                   April 28, 2010
#                   Now that someone fixed the 0, updated
#                   the script for better performance.
############################################################
use strict;

use constant IRCMD => "/usr/bin/irsend SEND_ONCE DCT700 ";
use constant SLEEP_CMD => "/usr/bin/sleep ";
use constant WAKEUP_DELAY => SLEEP_CMD . "1; ";

sub ChannelCmd
{
    my $chan = shift();
    if(length($chan)==0)
    {
        # double ok/exit combo needed to hide OSD.
        return  "ok ok exit exit; ";
    }
    my $digit = substr $chan,0,1,"";
    return $digit . " " . ChannelCmd($chan);
}

my $channel = int($ARGV[0]);
# tried exit, that didn't work correctly, so used info
my $cmd = IRCMD . "info " . ChannelCmd($channel);

# Build the cmd and print it
# Add the exit command and wait a second to process it, as the box can
# sometimes ignore the first command sent.

# Debug line, should put in option processing at some point.
#print IRCMD . "exit; " . WAKEUP_DELAY . $cmd . "\n";

exec IRCMD . "exit; " . WAKEUP_DELAY . $cmd;

This script should not suffer from threading issues.

Comcast On-Demand

The On-Demand button on the stock Comcast remote simply sends a 0 followed by Enter. As such, it should be possible to access On-Demand through MythTV, although there are a few caveats.

First, it should be noted that in order to cleanly exit from on-demand, an Exit signal *MUST* be sent or the DCT700 will automatically tune back to On-Demand.

Second, while on channel 0, certain functions from the remote that would ordinarily be processed by the frontend must be delegated to the DCT700. At a minimum, these functions must be passed to the IR blaster: arrow keys, ok, and exit commands.

If anybody can edit the change-channel.sh script to add this functionality, it would be greatly appreciated.

Third and last, it is likely useless to incorporate the pause, rewind, and fastforward features in On Demand. For one, they're absolutely horrible and unresponsive, and second, since the mythtv backend will be recording the On-Demand program, playback can be controlled in that manner. It also remains to be investigated whether or not mythtv can properly flag commercials in On-Demand, though there is no reason to suspect it shouldn't.

Known Issues

As of right now, there seems to be a problem calling the channel change script when manually entering a channel number in livetv that is two digits or greater. Changing channels from the program guide still works.

This issue seems to revolve around the script changing to the desired channel, but then changing (twice) to a channel corresponding to one of the digits entered.

Below is an irw output for the issue:

#  Tried changing to channel 25 with MCEUSB by typing 2, 5, OK
000000037ff07bfd 00 Two mceusb
000000037ff07bfd 01 Two mceusb
000000037ff07bfa 00 Five mceusb
000000037ff07bdd 00 OK mceusb
0000000000000022 00 2 DCT700
0000000000000025 01 5 DCT700
0000000000000017 02 ok DCT700
0000000000000012 03 exit DCT700
0000000000000022 04 2 DCT700
0000000000000017 05 ok DCT700
0000000000000012 06 exit DCT700

Below is a log file generated by adding the following line to the script:

echo "Changing channel to $cmd" >> ~/channel-change.log

#  Attempted to change to channel 32 by typing 3, 2, OK
Changing channel to 32
Changing channel to 2
Changing channel to 2
Changing channel to 2
Changing channel to 32
Changing channel to 3
Changing channel to 19
Changing channel to 25
Changing channel to 2


Motorola_DCT700_Channel_Change_Script (last edited 2012-11-30 02:54:16 by jimcolt)