Skip to content
/ cec-fix Public
forked from glywood/cec-fix

Fixing some CEC incompatibilities between my Roku, receiver and projector

License

Notifications You must be signed in to change notification settings

heston/cec-fix

 
 

Repository files navigation

Heston's cec-fix

Some Raspberry Pi code that allows my Roku remote to control my home theater over HDMI-CEC and TCP sockets.

My Setup

  • NAD T778 receiver
  • JVC NX7 projector
  • Roku Ultra

Goal

Allow the Roku remote to control all primary aspects of the theater system.

Roku remote means the physical remote that came with the Roku Ultra, as well as the Roku Android/iOS app.

Primary aspects means:

  1. Turning both the receiver and projector on and off.
  2. Controlling the audio volume of the receiver.
  3. Automatically switching the receivier's input to the correct one for the Roku.

Basically, I want to pick up the Roku remote, hit the power key, and watch a movie. When I'm done, I want to hit the power key again, and have everything go into standby mode.

I should only need the NAD and JVC remotes if I'm doing something unusual.

Approach

  1. Make the Raspberry Pi pretend to be the TV (CEC logical address 0), since Roku only sends power commands to the TV.
  2. Connect to JVC projector on LAN interface using a TCP socket (JVC projectors do not support CEC).
  3. Listen to CEC messages on the HDMI-CEC bus, and send messages back to the bus and projector.

Resources

  1. Raspberry Pi Zero W.
  2. The original cec-fix.
  3. JVC Interface Specifications, specifically JVC D-ILA® Projector RS232 / LAN / Infrared Remote Control Codes PDF.

Installation

  1. Check out this repo on the Raspberry Pi, as the build references firmware libraries that are only available there.
  2. cd into the directory and make to build it.
  3. /build/cec-fix PROJECTOR_HOST_IP to run, where PROJECTOR_HOST_IP is the IP address of the JVC projector. CTRL-c to exit.
  4. To run as a service on boot:
    echo "PROJECTOR_HOST_IP=xxx.xxx.xxx.xxx" > .env
    sudo make install
    

A note on GPU driver compatibility

The default GPU driver was replaced with DRM V4 V3D on newer distributions of Raspian (at least starting at Bullseye). This appears to be incompatible with the Broadcom CEC APIs used by this project. If you run into trouble, you can disable these newer drivers:

  1. Open /boot/config.txt for editing (e.g. sudo vim /boot/config.txt).
  2. Replace the line dtoverlay=vc4-kms-v3d with #dtoverlay=vc4-kms-v3d (i.e. comment it out).
  3. Save the file.
  4. Restart the Raspberry Pi.

Uninstalling

sudo make uninstall

Compatibility

This was tested on a Raspberry Pi Zero W running Rapsian Bullseye. Older versions of Raspian should also work, as should similar Raspberry Pi hardware generations (e.g. B, A, B+). However, this has not been verified.

Interprocess Control

It is possible for other running processes on the Raspberry Pi to control the theater system over a named pipe (FIFO). When running, a named pipe is created at /tmp/p-cec-fix. Another process can write to this pipe to turn the system on and off (assuming the default playback device is at logical address 4).

To turn the system on, and set the active source to Playback Device 1 (logical address 4), write "1" to the pipe.

To turn the system off (set all devices to standby), write "0" to the pipe.

To see an example of a Python process controlling the system in response to Google Assistant voice commands, look at Theater Commander and Theater Commander Server.

About

Fixing some CEC incompatibilities between my Roku, receiver and projector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.5%
  • C 1.3%
  • Makefile 0.2%