[mythtv-users] RCA DirecTV serial cable

nate s nate.strickland at gmail.com
Mon Nov 22 21:57:00 UTC 2004


Here it is.  The only things I changed was the /dev/ttyS0 to
/dev/ttyS4 (for my serial port,) and commented out the command for
old-style recievers and uncommented the command for new ones.  It
works great for my RCA DRD430RG.

just save it as changechannel.c and do:

gcc -o changechannel changechannel.c
cp changechannel /usr/local/bin
chmod a+x /usr/local/bin/changechannel

Credit for the code goes to whoever it was that originally posted it
on this list (thanks, by the way!)

-Nate



#include <stdio.h>
#include <termio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


int main(int argc,char *argv[])
{
	int chan;
	int port;
	int baud,parity,stop;
	struct termio term;	
	char buff[8];

	
	if (argc != 2)
		exit(1);

	chan = atoi(argv[1]);

	port = open("/dev/ttyS4",O_RDWR);
	if (port < 0)
	{
		printf("Cannot open port");
		exit(1);
	}

	baud=B9600;
	parity=0;
	stop=1;

	/*
	** Get the current setting just for grins.
	*/
	if(ioctl(port, TCGETA, &term))
	{
		perror("ioctl TCGETA");
		return -1;
	}

	term.c_iflag = IGNBRK;
	term.c_oflag = 0;		/* No output processing		*/
	term.c_lflag = 0;		/* No lexical processing	*/
	term.c_cc[VMIN] = 0;		/* Block forever for one input	*/
	term.c_cc[VTIME] = 100;		/*  character; no timeouts	*/

	/*
	** Set baud rate, eight bits, enable receiver, no modem control.
	*/
	term.c_cflag = baud | CS8 | CREAD | CLOCAL;
	/*
	** Set two stop bits if indicated.
	*/
	if(stop == 2)
		term.c_cflag |= CSTOPB;
	/*
	** Enable parity checking, odd or even as indicated.
	*/
	if(parity != 0)
	{
		term.c_cflag |= PARENB;
		if(parity == 1)
			term.c_cflag |= PARODD;
	}
	/*
	** Set up the port.
	*/
	if(ioctl(port, TCSETA, &term))
	{
		perror("ioctl TCSETA");
		return -1;
	}


	// You may need to use this longer command format on newer boxes
	sprintf(buff,"%c%c%c%c%c%c",0xfa,0xA6,chan >> 8,chan & 0xff,255,255);
	write(port,buff,6);

	// Format for older boxes
	//sprintf(buff,"%c%c%c%c",0xfa,0x46,chan >> 8,chan & 0xff);
	//write(port,buff,4);

	return 0;
}




On Mon, 22 Nov 2004 16:32:43 -0500, Kris.S.Boultbee
<kris.s.boultbee at delphi.com> wrote:
> 
> That would be mighty nice of you Nate. I already tried the rca_control.txt script and it actually does nothing. I never get a response back from the receiover at all. Not sure why. If you have some C code that'll conpile and run that would be very nice. I'll give anything a try at this point.
> 
> Does anyone know of a guide to getting this kinda of thing to work. As I said before, all the information is scattered all over the place and is quite vague on almost every point. About the only thing that is clear is that you need a cable and a script. :)
> 
> Thanks,
> 
> Kris
> 
> I found that the rca.pl script didn't work for me, so I found a
> snippet of C that someone had posted in the archive to change channels
> with and it works fine for me. If you need it, I can re-post it.
> 
> -Nate
> 
> On Thu, 18 Nov 2004 12:21:47 -0500, David George <david at thegeorges.us> wrote:
> > On 11/18/2004 10:40 AM, Kris.S.Boultbee wrote:
> >
> > [snip]
> >
> > >I have made me a serial cable that works great with the Windows control program. So I know the cable works. The problem is that when I download the rca.pl it does nothing and when I use the sony.pl script it just resets the receiver. I don't know the model number of the receiver off the top of my head but I do know that it supports the new command set and not he old. I also am fairly well versed in perl.
> > >
> > >
> > The following script supports the new command set. At least on my RCA
> > DRD435RH.
> >
> > <http://bach.as.arizona.edu/~johng/rca_control.txt>
> >
> > rename to rca_control.pl and set the executable bits (chmod 755
> > rca_control.pl)
> >
> > [snip]
> >
> > >Also, how do you tell myth to use the script? I think you go to the section for the external channel change command and put /usr/local/bin/sony.pl in there but I'm not certain. This is also something that seems quite vague.
> > >
> > >
> > That's it. Or in my case /usr/local/bin/rca_control.pl
> >
> > HTH,
> > David
> >
> >
> >
> 
> ****************************************************************************************
> 
> Note: The information contained in this message may be privileged and confidential and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
> 
> ****************************************************************************************
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>


More information about the mythtv-users mailing list