View Full Version : DirecTV HR20 serial help

February 14th, 2008, 07:12 AM
I've been trying to set up a lua script to control this unit for days with no luck. In the past, I've been able to modify existing scripts to control a number of devices in my home theater system, not so with this one. I can't even get it to initialize. If someone would help me with a script to get this to initialize & send a command, I should be able to take it from there. Attached is the protocol document.


Rob H
February 14th, 2008, 08:56 AM
Did you note the part in the manual that says

The USB port on most STBs support hot-plug. That means USB ports will work any time when a USB-serial adapter is plugged in. Only the HR20s USB port works differently. The USB-serial adapter must be plugged before the STB is booted. If the USB connector is plugged in when the HR20 is running, it must be reset.

Are you using a USB-Serial adapter and if so, is it one of the ones in the compatibility list?

Can you post the latest version of the script you've tried using?

February 14th, 2008, 11:23 AM

Thanks for the reply. Yes I did read about the serial adapter. I'm using the IOGear GUC232A and did restart the HR20 after connection. I've used the simple.lua that you posted some time ago, but am having difficulty with locating a callback type, send & receive terminators. The file is posted below. Thanks


Rob H
February 15th, 2008, 04:22 AM
Try using serial.CB_FIXEDLENGTH instead and use a length of say 255 (you may need to increase that if any responses can be longer than that).

In your ReceiveResponse() method you'd then use

if math.band(code, serial.INCOMPLETERESPONSETIMEOUT) > 0 then
code = serial.zerobits(code, serial.INCOMPLETERESPONSETIMEOUT)
-- your processing code here

February 15th, 2008, 12:30 PM
Thanks Rob,

I had a syntax error in the first lua file. I fixed that and Girder now initializes the HR20 fine. Problem now is I am getting no response from the HR20. Logger says it's unable to send to device when I send FA A5 (Command Prefix, Command ID) expecting a return of F0 (Command acknowledged). Attached is the new lua file. Thanks again


Rob H
February 15th, 2008, 12:53 PM
Can you post the full log from the Lua console?

February 15th, 2008, 02:09 PM
Sure Rob,

Serial: DirecTV HR20 : Command queued: FA A5 at postion 1
Serial: DirecTV HR20 : Simple Send: FA A5
Serial: DirecTV HR20 : Simple Receive: Data Code: 16384
Serial: DirecTV HR20 : ERROR: No response to last command


Rob H
February 16th, 2008, 03:36 AM
What sort of cable are you using to connect to the the USB-serial adapter? From the MythTV Wiki it seems it needs to be a null-modem cable.

February 16th, 2008, 07:46 AM
Sure enough Rob, I figured it had to be hardware related as I was getting no response from the unit. I tried a null modem adapter and that did the trick!

Thanks again for all your help.

Rob H
February 16th, 2008, 12:50 PM
Great, glad we've made some progress :)

March 8th, 2008, 10:40 PM
Is there any chance I could get your lua file and an example of a comand. I am using a usbuirt now. I would like to hardwire if possible.

Also, I am curious to know if you are sending macros to direct access channels? If so, when you send the macro, does the receiver change channels as soon as the last digit is sent, or does it take a while. Doing it with IR has a bit of lag.


March 11th, 2008, 08:59 AM

I've gotten side tracked setting up a new Nevo Q50 remote, so haven't finished up the HR20 setup in Girder. The last lua file I posted works fine for initializing the HR20, and as I have no need at this point for responses from the device other then command acknowledgment, I've sent commands using a "Serial Send" action.

Here's a few sample commands:

Menu: FAA50001F7

Guide: FAA50001D3

List: FAA50001A3

I haven't tried sending multiple commands at once for direct channel input, but it's on my todo list.

A couple points to remember:

Use one of the USB-Serial adapters listed in the protocol document, (I'm using a IOGear GUC232A) .

Use either a null modem cable or adapter when connecting to your PC's serial port.

Once connected, the HR20 needs to be rebooted to recognize the serial connection.

I should be able to get back to playing with this soon, so please post about any progress you've made.