How to get the TiVo to play nice with HDMI-CEC

Discussion in 'TiVo Coffee House - TiVo Discussion' started by bdraw, Nov 1, 2016.

Tags:
  1. Nov 1, 2016 #1 of 61
    bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL

    Advertisements

    I love my TiVo peanut remote and have never found a programmable remote that I felt wasn’t a compromise to use instead. So while I have a Harmony, in the end it just ends up adding to the remote clutter. This is because I also like certain features of my remote for my Apple TV, AVR, TV and my PS4 controller.

    So it ends up that the only device that doesn’t work with HDMI-CEC in my home theater system is my TiVo. And while I dream of being able to control the volume and power of my system with my TiVo iPad and iPhone App, at this point I’m just happy I figured out a way to get my TiVo to play nice with CEC.

    Before I implemented this solution, often when my Harmony would turn on my TV a few seconds after the activity fired, one of my CEC enabled devices would become active and switch the input on my AVR to that device. To fix it, I had to either use the Harmony to select the correct input, or just grab the AVR remote and hit input 2. I tried all kinds of work arounds in the Harmony activity, but most people online just suggested disabling CEC completely. Only this wasn’t really workable because my TV requires CEC for the Audio Return Channel and right now my TV is the only way I can watch HDR via Netflix, Amazon and Vudu, so disabling HDMI-CEC completely isn’t an option.

    IMG_0545.JPG

    This solution essentially adds just enough CEC to the TiVo for the other devices to realize it is in use and doesn’t switch the input unexpectedly. It also makes it so that the TiVo shows up on my TV’s input list, which means I can use the input button on the TiVo remote to change the input on the AVR and watch TV. Best of all I don’t even need the Harmony to watch TV anymore, I just turn the TV on and off by programming the TV power button on the TiVo remote, then I press the TiVo button to turn on the TV. When I’m done I just turn the TV off using the same button. Even a babysitter could figure that out.

    Overview of solution:
    Program the TiVo remote to control the TV’s power and input.
    Program the TiVo remote to control the AVR volume and mute.
    Buy a Raspberry PI and Pulse-Eight CEC Adapter and configure it, basically $100 in parts — if you don’t already have some of it. Should take about an hour, because the PI processor takes a long time to compile.

    Materials (thanks in advanced for using my Amazon affiliate links)
    Raspberry pi $35
    CEC Adapter $50
    USB power supply or USB micro to USB cable and use the TiVo's USB port for power.
    16GB SD Card (can use as small as a 2GB)

    IMG_0546.JPG

    Download Raspbian Jessie Lite and follow installation instructions to install to SD Card using your regular computer.

    Now lets connect everything.
    Insert the SD Card
    Connect CEC Adapter to the Pi via included USB
    Connect CEC Adapter inline between your TiVo and your AVR or TV.
    Connect PI NIC to a switch for configuration and troubleshooting
    Connect PI Micro USB to the TiVo for power
    Give it some time to boot and then get the IP from your DHCP server

    Now lets configure it
    Login via SSH with pi/raspberry and change the password with passwd command (use putty on windows)
    Run the following commands on the PI to update it and configure the CEC adapter:
    Code:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    reboot
    sudo apt-get install git cmake liblockdev1-dev libudev-dev libxrandr-dev python-dev swig
    git clone [URL]https://github.com/Pulse-Eight/platform.git[/URL]
    mkdir platform/build
    cd platform/build
    cmake ..
    make
    sudo make install
    cd
    git clone git://github.com/Pulse-Eight/libcec.git
    cd libcec
    vi CMakeLists.txt
    
    Add this line next to the other lines that start with “set” (try pico if you don’t want to lookup vi shortcuts)
    Code:
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    mkdir build
    cd build
    cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
    make -j4
    sudo make install
    sudo ldconfig
    
    Now that libcec and thus cec-client are installed, you need to figure out the physical address of your device. Just like TCP/IP, CEC has a physical and logical address. But instead of a MAC and an IP, CEC’s logical address is based on the type of device (0-15, TV is zero, etc) and the physical address is based on which port of the TV it is connected to. The TV is always 0.0.0.0 and if you had your TiVo connected directly to HDMI1, then your TiVo would be 1.0.0.0. My TiVo is connected to my AVR’s port 2, which is in turn connected to my TV’s port 2, so my TiVo’s logical address is 2.2.0.0. The reason why this is important is because you want to ensure both the TV and the AVR are on the correct input when you select the TiVo to be the active device.

    Now that I know my CEC physical address and I know I want my TiVo to show us as “TiVo” on my other devices on-screen displays, this is the command I’ll launch cec-client with:
    Code:
    cec-client -b 2 -p 2 -o TiVo
    
    Run cec-client -h for details, but basically -b is the TV’s input, -p is the AVR’s input and -o is the OnScreen display name (cectester is the default).

    Since I want cec-client to run even after I disconnect from SSH or restart the Raspberry PI, I edit rc.local with the following command:
    Code:
    sudo vi /etc/rc.local
    
    Then add this command to the end to get the cec-client to start on boot
    Code:
    nohup cec-client -b 2 -p 2 -o TiVo > /dev/null 2>&1 &
    
    Next I'm looking for a way to turn the system on with just the TiVo button. I'd like to find a way to detect the push of the TiVo button with the PI (perhaps with an IR receiver) and then send the Active Source command from the CEC Adapter. This way I can just use one button on one remote, no matter which input was used when the TV was turned off.
     
    Last edited: Nov 1, 2016
    jonw747, wizwor, DatCFC and 1 other person like this.
  2. Nov 3, 2016 #2 of 61
    ehharley1

    ehharley1 New Member

    13
    0
    Apr 28, 2016
    Sounds bad ass,
    I'm impressed. I've been curious to see some real world applications of Raspberry Pi


    Sent from my iPhone using Tapatalk
     
  3. DatCFC

    DatCFC New Member

    24
    6
    Nov 22, 2016
    This is great, and solves my current dilemma.
    I just got a Roamio Plus last week, and was pretty sad that it didn't have HDMI-CEC.
    Not sure when I'll be able to, but I've added this on my to do list.
    I'm wondering though, if there's a way I could leverage my HTPC to do the same as the PI.
    I'm currently using a Pulse-Eight CEC adapter with the PC, but I have my doubts that I'd be able to run two adapters off the single PC.

    For now, I have my TiVo hooked up to an HDMI input directly on my TV (LG), so I can still have CEC enabled and use ARC, however, I don't have Dolby Digital pass through, so I'm settling for 2.0 audio.
    If your TV can pass-through 5.1 from other HDMI inputs via ARC, that may work for you.

    Thanks for sharing!
    CFC
     
    Last edited: Nov 30, 2016
  4. bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL
    You should be able to use two, but you probably only need one. CEC is a shared bus without any authentication. There is an Eventghost plug-in for the CEC-Adapter. You should be able to use it to configure automated tasks for both apps. The trick will be getting Eventghost to know when you are using the TiVo and when you are using your HTPC. If you have an IR reciever you can probably key off a remote code.

    I'm working on an update to this post to add IR. Basically I want to be able to hit the power button the TiVo remote and have everything turn on and wake up the TiVo with one button press -- if only TiVo would make the power button able to do macros.
     
  5. DatCFC

    DatCFC New Member

    24
    6
    Nov 22, 2016

    Advertisements

    Hmm... I'm not visualizing how I'd use just one.
    Are you suggesting simply switching the logical address on the CEC app based on which device I'm wanting to use? Or perhaps you mean with the Eventghost plug-in? As far as I can tell, the Windows CEC app detects the logical address automatically, but I haven't investigated it further since it did what I needed it to with just the HTPC.
    Interesting.
    I have an IR receiver - an MCE RC6 compatible one.

    Another thought I had was using an IR capable HDMI switch to toggle between HTPC and TiVo, thus not needing to change the CEC logical address.

    CFC
     
  6. bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL
    Yes, you should be able to either switch the physical & logical address of the adapter. Another option would be to just send the commands you want manually. There is no authentication, so if you send a command saying device 1 wants to be active, no one will question where the command came from. This might be easier said then done, as some CEC commands expect a level of interaction.

    I currently have lirc working to send 1f:82:22:00 (1-logical source address|f- destination broadcast:82-active source command|2200- HDMI2TV,HDMI2AVR) when the input button on my TiVo button is pressed. I could just as easily send some other input. You can figure out all kinds of commands on CEC-O-MATIC and send them on the bus.

    The CEC app does auto detect the USB device and physical address, you can manually specify it, though.
     
    DatCFC likes this.
  7. DatCFC

    DatCFC New Member

    24
    6
    Nov 22, 2016
    Ok, I think I understand.
    Where you're using lirc, I'd instead use eventghost to send a command to the CEC adapter?
    In my case, I have my AVR connected to the TV's HDMI 1, my HTPC to HDMI 3 of the AVR passing through the CEC adapter, and the TiVo I will have it say on HDMI 2 of the AVR with a direct HDMI cable connection.
    If I wanted to switch to HTPC, I'd need to send 4F:82:13:00 (as a playback device)
    If I wanted to switch to TiVo, I'd need to send 1F:82:12:00 (as a recording device)
    Sounds about right?
    I really appreciate the help. Would be really nice if I didn't even need to get more hardware.

    CFC
     
  8. bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL
    You got it, but the trick is I think you'll need to register the logical device first. By default the CEC Adapter registers itself as logical device 1 (recorder). The other devices may not respond to a command if it doesn't know about the device. That's why you may just need to get Eventghost to switch from HTPC to the TiVo, since that is how the software is written to work. This way you can still use one device and you probably don't ever need the output of the HTPC and the TiVo at the same time.

    You can read about the addressing here, but basically the logical address is between 0 and 15, and is like an IP address. The physical address is based on the input, and is like a MAC address.

    The HDMI-CEC bus - wikwikwai
     
    DatCFC likes this.
  9. DatCFC

    DatCFC New Member

    24
    6
    Nov 22, 2016
    I think I'm getting it.
    Based on logical/physical with my given scenario I'm thinking now:
    To switch to HTPC, I'd need to send 1F:82:13:00 (logical address 1)
    Then to switch to TiVo, would I need to send FF:82:12:00 (as an unregistered device) or EF:82:12:00 (as a "Free Use" device)? Or would it just be 1F:82:12:00 - keep the CEC Adapter as the logical device, but "fake" the actual physical address?
    Then again, does it even matter what the first byte (source) is since it's simply broadcasting an active source request? Shouldn't matter where the message is coming from.
    Guess I have some testing to do :D

    What did you program your TiVo remote's "Input" button to? Just a random device so that lirc can capture it?

    CFC
     
    Last edited: Nov 30, 2016
  10. bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL
    Yes, that's the basic idea. What I don't know is if a device will switch inputs from a logical device it doesn't know about. I've watched the BUS and the devices query each other, so I suspect if a device is unknown and doesn't respond to quries, it may not respond to active source requests from it.

    But what I think you might be able to do is to get Eventghost to stop the HTPC CEC service, start up CEC again as the TiVo and issue commands. Then both devices will be known. It'll require some testing, and worst case you get another CEC Adapter and have the HTPC use one and Eventghost use the other. This should be as simple as not using auto-detect.

    I used the IR command for a generic device in the list, then just used lirc to capture the command.
    Hold Input & TiVo for 5 sec, Enter 0014
     
  11. DatCFC

    DatCFC New Member

    24
    6
    Nov 22, 2016
    Unfortunately, it doesn't seem like sending commands through EventGhost will cut it.
    When sending command, the input switches correctly, but immediately reverts back to the previous. Haven't figured out a way to keep it active.
    For now I've hard coded the TiVo's physical address to the CEC-Adapter tray application, and it works like your PI setup.
    Not perfect, but good enough. I may need to get that additional adapter eventually, but this will hold me over.
    I don't mind manually switching to the HTPC since I'll be using it less and less (RIP Windows Media Center :sob:)

    I really appreciate the tips.
    Are you Ben Drawbaugh previously of Engadget? Really like your work. I read up on your old Roamio review before deciding to pull the trigger on this one. Where do you write these days?

    CFC
     
  12. bdraw

    bdraw Member

    466
    9
    Aug 1, 2004
    Tampa, FL
    That's interesting that it works but then switches back, but not surprising.

    Yeah, that's me. I haven't written anything other than on forums and stuff in a few years. It was always a second job for me, so now I just have one job. It was a lot of fun while it lasted. Thanks for the kind words.
     
  13. SFDave

    SFDave New Member

    22
    1
    Aug 25, 2006
    San Francisco
    Thanks for this guide. I have an Onkyo TX-NR626 receiver and an LG OLED65E6P TV. I was having the same issues you described. This solved it for me too. In addition to a TiVo, I have a PS3, a PS4, and a Fire TV connected to the AVR. I had to disable CEC on the PS3 and PS4, because every time I turned on the TV, it turned on the PS3 and PS4 too. I previously had this connected to a Samsung PN60F8500 TV, and it didn't turn on any connected CEC devices, which was the behavior I preferred.

    I did have to make some adjustments to your guide. The link to the Raspberry PI is a model that uses a micro SD card instead of an SD card. These newer models also don't have SSH enabled by default, so I had to connect a wireless keyboard and monitor (TV) to enable it.
     
  14. jonw747

    jonw747 Active Member

    638
    32
    Aug 2, 2015
    I ran in to an issue getting this work, seems to be related to getting the physical address assigned. I finally got it working by manually setting the physical address with the "pa ab cd" command where a.b.c.d is the physical address of the TiVo.
     
  15. AppleTechy

    AppleTechy New Member

    11
    0
    Dec 30, 2017
    Hello. I seem to be having some issues. I have an LG TV on port 2(Which supports ARC), then connected to my Yamaha TSR-7810 receiver which on HDMI port 3 is connected to the TiVO(with adapter/RPI in between the two). When I run the command given, when power cycling the system when previously set to the correct HDMI 3 input on the receiver with everything working; it seems to end up setting my receiver to AV4 which is the audio only, however, the TiVo visual is still getting passed through to the TV. It seems that the receiver is recognizing the CEC but is mis-interpreting(?) the signal and sets the video to HDMI input 3 on the receiver but sets the audio to AV4. Is there some TX command I can send that tell the receiver to read the audio from the HDMI port? Any ideas or guidance would be much appreciated!
     
  16. kpeters59

    kpeters59 Well-Known Member

    3,039
    631
    Jun 19, 2007
    Houston, Texas
    Wait...what?

    What port is the TV plugged in to?

    [​IMG]
    -KP
     
  17. AppleTechy

    AppleTechy New Member

    11
    0
    Dec 30, 2017
    HDMI-out 1 which is arc complaint. And the TiVo is plugged into HDMI-in 3
     
    Last edited: Jan 1, 2018
  18. dougdingle

    dougdingle HD Tech

    926
    73
    Jul 4, 2007
    West Coast
    CEC is an undisciplined public domain crapshoot. Sometimes it works, more often it doesn't.

    There are literally thousands of posts on the AVS forum threads (including the thread for your Yamaha, which I used to own) with complaints about it being randomly messed up.

    I finally got fed up and am using a Harmony 700 remote to control things, and it's much more reliable. Takes some programming of it to get it right, but once it's working, it just works.

    The Yamaha and CEC drove me crazy, as did the Denon with which I replaced it. As long as CEC remains public domain, and manufacturers are free to 'improve' the protocol as they wish, randomly adding and removing and modifying commands and structure, it will remain useless garbage for most users.
     
    kpeters59 likes this.
  19. AppleTechy

    AppleTechy New Member

    11
    0
    Dec 30, 2017
    I do use a Harmony Hub remote. The reason I want it to declare itself as a CEC device, is when I turn off the setup from watching TiVo when I turn it back on the Apple TV normally hijacks the input. So it’s not to be able to use the TiVo remote to control the setup, but rather to prevent the hijacking. Is there anyway to scan the Yamah to figure out what command it is picking up for the TiVo when it’s set to the TiVo input. I don’t want to send any commands, just simply prevent the hijacking. Any ideas?


    Sent from my iPhone using Tapatalk
     
  20. dougdingle

    dougdingle HD Tech

    926
    73
    Jul 4, 2007
    West Coast
    If you have a component that you don't want issuing CEC requests (if I understand what you mean by 'hijacking'), you can use an adapter like this one in line with its HDMI cable:

    HDMI NON-CEC Adapter Type A M/F

    All it does is not allow HDMI pin 13 (the CEC signal) to go through it.
     
    kpeters59 likes this.

Share This Page

spam firewall

Advertisements