[mythtv-users] DirecTV and the low speed data port

Bob Stafford bobstaff at bobstaff.com
Sat Jan 24 13:14:50 EST 2004


On Saturday 24 January 2004 11:07, tarek Lubani wrote:

In case it may be useful to anyone, I didn't find the perl scripts and so 
ended up writing this C program to control my Directv receiver.

#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/ttyS1",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;
}

> Hey!
>
> the RCA.pl was one of the older scripts.. I believe it was submitted
> with the intention of separating RCAs from Sony receivers due to some
> minor differences.. As far as I know, it is deprecated and should be
> replaced with the sony.pl that's out there (look at the comments for the
> current maintainer Mike's address)..
>
> GOod luck!
>
> tarek : )
>
> > I have a RCA DRD430RG
> >
> > I have found the script at http://tarek.2y.net/myth/RCA.pl
> >
> > and the windows app at http://www.pcmx.net/dtvcon/
> >
> > I guess what I need to know now is
> >
> > a) is the RCA.pl what I need ?
> >
> > b) will a "standard" 9pin serial connector->RJ-11 adapter work, or is
> > there a special pinout?
> >
> > On Sat, 2004-01-24 at 11:35, Tom Jaeger wrote:
> > > What kind of receiver do u have?
> > > Tom J
> > >
> > > > -----Original Message-----
> > > > From: mythtv-users-bounces at mythtv.org
> > > > [mailto:mythtv-users-bounces at mythtv.org] On Behalf Of Jason Donahue
> > > > Sent: Saturday, January 24, 2004 8:11 AM
> > > > To: Discussion about mythtv
> > > > Subject: [mythtv-users] DirecTV and the low speed data port
> > > >
> > > >
> > > > I just read that I may be able to hook a serial cable up to my DTV to
> > > > change channels etc. from Myth - WOW.
> > > >
> > > > Anyone out there have a link to a decent write up on how to do this,
> > > > and/or the scripts required?
> > > >
> > > > Thanks. (This stuff ROCKS)
> > >
> > > ______________________________________________________________________
> > > _______________________________________________
> > > mythtv-users mailing list
> > > mythtv-users at mythtv.org
> > > http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> >
> > ______________________________________________________________________
> > _______________________________________________
> > 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