Author Topic: Control DirecTV receiver via serial  (Read 9807 times)

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Control DirecTV receiver via serial
« on: October 03, 2008, 06:52:00 am »
I am working on switching to LMCE from my existing pure MythTV setup, but am not quite sure how to get LMCE to control my sat box. Currently MythTV calls an external perl script that simply accepts the channel number as its only option, and creates a data packet to send to the box over a connected serial cable. If the channel change succeeds, the script exits normally. If it fails, the script exits with an error.
The box is a RCA, model is D10-100 (yes, it is quite old. I passed on a free upgrade recently because I really like the serial control). I was unable to find an existing template for this system. I did poke around in the generic serial device, but it really doesnt make sense to me (and I am a programmer by trade). Is there some option I am overlooking in LMCE, or do I just set it up directly in MythTV like I have it in my current setup?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #1 on: October 03, 2008, 01:50:04 pm »
GSD's are very easy to set up, especially with regards to creating a new device template.

You may want to look at this to start:
http://wiki.linuxmce.org/index.php/Generic_Serial_Device

-Thom

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #2 on: October 03, 2008, 03:12:17 pm »
I had already read through that page, but it really didnt help me, perhaps because I know nothing of Ruby.
I dug through the perl script I am using to get an idea of exactly what it is doing, and it looks like it is forming a packet of 6 bytes. For instance to change to channel 244:
0xFA leading byte
0xA6 "change channel" command
0x00 channel high byte
0xF4 channel low byte
0xFF trailing byte
0xFF trailing byte
The sat box sends back a confirmation of this, but I am really not concerned with receiving events from it since it is always turned on anyway. I also dug up a page documenting this protocol, if interested http://www.dar.net/~andy/tivo/rca_dss_serial.html
How would I implement this in a generic serial device?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #3 on: October 03, 2008, 03:22:07 pm »
I would suggest messaging ddamron here on the forums. He is our resident GSD hacker.

-Thom

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Control DirecTV receiver via serial
« Reply #4 on: October 03, 2008, 06:37:01 pm »
I had already read through that page, but it really didnt help me, perhaps because I know nothing of Ruby.
[...]
How would I implement this in a generic serial device?

You do not need to know Ruby to do a GSD. Basically all you do is <$"\x0201POF\x03"$>  <-- This transmits 0x02 01POF 0x03  over rs-232. Have a look at Device Template 1779, the Pioneer Elite TV. It shows very nicely, how easy it is to do a simple GSD.

After you have your device controlled to do stuff, you can look at the Yamaha RX-V1500 template and add receiving capabilities to your device, so you will be able to let LinuxMCE know, when you did something on the box itself.

Again, this has nothing to do with knowing Ruby, but it helps to know a tiny little bit programming, even if it was just a single high school class in "Programming 101" during spring break ;)

rgds
Oliver

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #5 on: October 04, 2008, 01:46:32 am »
I'm sorry, perhaps I am just dense or something but this is not making much sense to me. It looks like the whole generic serial device thing is meant to only emulate button presses on a remote control, and that is not what I want here.
Is there really no way to just have it execute an external script anytime the channel needs changed, and pass that script just a single argument of the channel number? Thats all I need to get this working the same as it is right now with MythtTV.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #6 on: October 04, 2008, 01:58:29 am »
The GSD allows for the creation of new devices in LinuxMCE.

Since the satellite box is an A/V device, it should have commands defined for the individual functions that would normally be present on the remote. This includes the number digits.

This is so that not only can the satellite box be used in MythTV, but it can also be used in Live TV mode as well. This way, you can hook up your satellite box directly to the TV as well as to the tuner card, and once you have device templates for your TV and Amplifier, LinuxMCE can control them all, from a single remote, sending button presses to the correct devices. A bit more than your average mythtv setup, but also a lot more integrated.

So, while you do need commands for the individual channel changing, you can also override the Tune to Channel as well to send a channel number.

-Thom

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #7 on: October 04, 2008, 02:25:10 am »
My system right now consists of just the TV, sat box, and audio system.
The only functions used on the TV are on/off.
The only function used on the sat box is "change channel".
The only functions used on the audio system are vol up/vol down.
The only function managed by MythTV is changing channels, everything else is handled by the devices normal IR remotes. The TV has no connection to the sat box; that is to say live tv is managed through MythTV and only MythTV. I should imagine it would become very confusing very quickly with multi-room setups if AV equipment was connected directly to each other rather than routed through LinuxMCE... If live tv is not or cannot be managed by LinuxMCE in the same manner as MythTV (on disk ring buffer for pausing, etc), then I will stop right here, that is the primary use of the system. I accidently hit the "TV" option once in the UI and it attempted to launch MythTV though so I assume it works as I expect.
With all that in mind, I see no reason to implement anything other than the sat box "change channel" command at this time, since I am only looking for equivalent functionality from the setup. I dont even have the possibility to control any of the other equipment yet, as they have no serial or usb interfaces and I do not have any IR transmitters. While there are 10 key commands in the protocol, I am worried about performance of the sat box in this case. It is painfully slow to respond to them on the remote.
If I need to get dirty with code to solve this, dont be afraid to get technical with me. I have over 10 years experience as a linux sysadmin and just as much with just about every scripting language except ruby (php, javascript, perl, tcl, etc).

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #8 on: October 04, 2008, 02:29:25 am »
**hmm** you're not getting it.

I'm trying to tell you what to do.

(1) Implement the protocol presses for the individual buttons, and the channel change will work as expected.

if you want to override the tune to channel command to send it all at once, then do so.. but there is no need to do this..

If you do this correctly, then:

(1) mythTV will be able to change channels
(2) liveTV will be able to work (and yes, even with liveTV, you can bounce the same stream to multiple media directors)
(3) the on-orbiter EPG will also work and change channels in both mythTV and liveTV mode.

If you don't want liveTV then don't use it... but there is a specific reason we integrate into DCE, instead of duct taping on a script.

-Thom

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #9 on: October 04, 2008, 06:29:39 am »
I am getting it, I am just not understanding why such a simple thing like changing a channel has to be made so complicated.
In any case I will find out tomorrow how or if it works, since I will finally have a gap in my recording profiles long enough to swap out the hardware (the new system is currently just hooked up to a monitor with no a/v equipment installed). Heres to hoping a PVR-350 will be detected the same as a 250 :)

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #10 on: October 04, 2008, 07:22:36 am »
we currently do not have a device template for the 350...although the 250 could be used as a pattern.. or you could specifically set a 250 in the media directors page in the web admin.

and it's not complicated.. it's just no longer duct taped on, like it is in MythTV. Any part of the system can send messages to any other part...this is used to great effect for many powerful features in the system.

-Thom

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #11 on: October 04, 2008, 10:11:19 pm »
Ok so I am confused again, but no surprise there I am sure. At this point I am not entirely sure why the capture card and channel changing even needs to be setup in LinuxMCE as it seems MythTV takes care of all of it. At least it seems to be working fine with the PVR-350 setup only in Myth, and using an external channel changing script exactly how i had it setup previously. The only thing I still need to get working is the remote that came with the PVR card, but that shouldnt be too difficult.
Did I just make an incorrect assumption about how this all works, or is there something else going on?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #12 on: October 05, 2008, 12:10:41 am »
you CAN circumvent and put in your own channel changing script.. but damn it, that's duct taping it!

*hmm*

please look around in the system... you'll find that there is a lot more going on than just MythTV. It is important that DCE handles talking to all the devices, so that everything can be integrated smoothly together.

I will not respond again, until you dig in, and read! or even better...actually look around and explore the system!

-Thom

merkur2k

  • Addicted
  • *
  • Posts: 513
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #13 on: October 05, 2008, 12:54:45 am »
I have read everything I have come across so far, and nothing talks about this. And I have gone through setting after setting in the admin web interface. So all I really have to go on is what I can guess by poking at things. I filled out all the stuff for the serial control, but as far as i can tell it will never be used. Again I have to guess at this because nothing talks about how this actually works.
I have yet to see ANY integration between LMCE and MythTV. I press the "TV" option and I am dumped into myth in live tv mode. Any keys I press appear to be handled by myth directly whout LMCE getting involved.
So, thanks for nothing, other than a really lame "RTFM".

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: Control DirecTV receiver via serial
« Reply #14 on: October 05, 2008, 02:33:49 am »
I have read everything I have come across so far, and nothing talks about this. And I have gone through setting after setting in the admin web interface. So all I really have to go on is what I can guess by poking at things. I filled out all the stuff for the serial control, but as far as i can tell it will never be used. Again I have to guess at this because nothing talks about how this actually works.
I have yet to see ANY integration between LMCE and MythTV. I press the "TV" option and I am dumped into myth in live tv mode. Any keys I press appear to be handled by myth directly whout LMCE getting involved.
So, thanks for nothing, other than a really lame "RTFM".

Posde gave you a good pointer in the right direction, you however replied with "that is not what I want"... so suit yourself.

PS. Does pressing F6, F7 or F8 also appear to be handled by mythtv?

"Change is inevitable. Progress is optional."
-- Anonymous