How to control your PC from a TV remote?

⏳ 4 min read📅 2021-08-24

Short log of my research on the topic.

🔗Setup

I have a modern LG TV that is connected to a PC via HDMI. I use this setup for coach-based gaming and to watch movies. However, the latter has a major usability issue: you can’t just pause playback with a TV remote, you need a mouse or a keyboard nearby. Just because of this I use a wireless mouse and keyboard, so I could take them on a coach and stop a video with walking to the PC.

There should be a better way doing this, right?

🔗CEC

And there is! If is called “Consumer Electronics Control” or CEC for short. It is a part of the HDMI specification. In fact, there is a mandatory pin in every HDMI cable just for this feature!

Pin 13: CEC

Pin 13: CEC

Different companies try to sell CEC under different names: Anynet+ (Samsung), Aquos Link (Sharp), BRAVIA (Sony), EasyLink (Philips), Fun-Link (Phillips) and in my case SimpLink (LG).

In TV settings I had to mark my PC as “Set-Top Box”, so that TV would imagine that it is supremer and feel the power to send commands to such a peasant device. But this is only the smaaalest part of the problem.

🔗Graphics Cards 😓

In order to get it work, both devices should support CEC of course. I had some doubts about TV or HDMI cable, but as long as the signal is in the PC, everything should be just a matter of drivers and configuration, right? He he he

Even though there is dedicated physical pin for this, almost ALL video cards tend to ignore it. Mine wasn’t any different.

My feelings at this moment

My feelings at this moment

If you didn’t know, the image above is from Linus Torvald’s talk at Aalto University “Fuck you, Nvidia!” - he said there

Anyway, we’re engineers, we got to solve this!

🔗Raspberry Pi?

Unlike Nvidia graphics cards, Raspberry Pi that costs ~$30 supports CEC. The initial idea was to just plug it into USB and use as CEC-USB-adapter. It would capture the CEC commands from HDMI input, send them via USB while forwarding the rest of video input straight into an output. That part could even work, however, Raspberry Pi would need two HDMI ports: one for TV input, the other — for PC output. And it even has two HDMI ports, but… both of them are outputs 😭

Okay, we shouldn’t give up… not yet! There is an extension module for Raspberry that acts as a HDMI input: B101. Unfortunately, it supports only up to 1080p video, while I have 4K 😭

Raspberry Pi with B101 installed on top

Raspberry Pi with B101 installed on top

This approach will also require some codding, linux configuring and I think there will be some addition latency, which is already on its upper limit (I play Dark Souls 3 right now through 15m cable. Of course I blame the input lag for my deaths!)

🔗Pre-made adapter

Luckily, there is a ready-made adapter exactly for this purpose: Pulse-Eight USB-CEC Adapter. Folks behind it maintain libcec, which is an Open Source and available for all platforms. The total price is around 50€ including delivery, which is probably reasonable.

I’ll update this post once I got this solved 👋