Getting started with Pi TV HAT and gpio-ir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Much of this message would probably belong to some wiki page, along with some photographs that I made. Before starting to write this, I checked https://vdr-projects.github.io and did not find any hardware projects. The hardware section of the VDR wiki at https://www.linuxtv.org does not seem to have been updated for years; it does not mention Raspberry Pi at all, despite it being a viable alternative for more than 10 years.

I was an active VDR user from 2004 or 2005, when I built a PC based setup, using a "budget" DVB-T card (Hauppauge Nova-T PCI). That system was never upgraded to DVB-T2; instead, we got a flat screen TV with a built-in tuner. Gradually, as our children got older, recordings were made and watched less often.

We mostly stopped using VDR about 10 years ago. Since then, I have made some attempts to "come back", initially, using a Raspberry Pi 2 B and an Astrometa USB DVB-T/T2 stick.

This month, I purchased a TV HAT case and the DVB-T/T2 uHAT for my Raspberry Pi 2 B. As far as I understand, the plexiglass TV HAT case should fit the Raspberry Pi 2, 3, and 4. The LED holes next to the MicroSD card slot are on the wrong side for the Pi 2, but everything fits perfectly.

I regret that I did not buy the Pi TV HAT earlier. The USB stick is simply garbage compared to it.

The Astrometa USB stick switches channels very slowly and the tuner very frequently produces errors in the bit stream, when using a good outdoor aerial that other devices have no trouble with. By design, its infrared receiver will lose messages when a button is being held down, because a 128-byte buffer of the microcontroller would overflow, and there is no way to use it as a ring buffer (I tried). A kernel maintainer came up with some experimental patches that significantly improved the situation, but every few of seconds some key-repeat events were still being lost.

Out of that effort, a tiny patch from me was included in the Linux kernel, to have the kernel's LIRC interface set the "repeat" flag for all IR protocols: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b464763cc3489af406437a7650de8575a0973235

The Pi TV HAT is missing an infrared receiver out of the box. I soldered an IR receiver module to some thin wires, isolating the legs with heat shrink tube. The other ends of the thin wires I soldered to some pads next to the connector: 3.3V at pin 1, ground at pin 6 (or 9), and the signal output to GPIO 18 (pin 12). GPIO 17 at pin 11 would have worked as well. I made the IR receiver module stick out from a vent hole on the top, because my initial attempt of keeping the module inside the transparent lid of the case did not work that well.

The module can pick up IR signal some 8 meters away.

The software configuration was easy:

(1) Add the following line to /boot/config.txt:

dtoverlay=gpio-ir,gpio_pin=18

(2) Execute "sudo apt install ir-keytable"

(3) Edit /etc/rc_maps.cfg to load a suitable table for your remote control unit. To reuse the old remote control unit that I had, I wrote an entry
* * hauppauge.toml

(4) Reboot for the config.txt change to take effect.

For me, the remote control unit appeared in /dev/input/event0 as well as /dev/lirc0 and some buttons (such as the number keys) would directly work in the /dev/tty1 textual login prompt.

For starting up VDR, I used a command like this:

vdr -v /var/lib/vdr/video --no-kbd -Prpihddevice -P'remote -i /dev/input/event0'

Yes, the Pi TV HAT was detected automatically; I did not have to do anything special. I had previously used the same VDR configuration with an Astrometa USB stick.

This is with a copy of https://github.com/reufer/rpihddevice with some critical patches applied. (The issues and a pull request that I opened in January 2022 are still unattended.)

The experience with the Pi TV HAT is simply great. The Sony tuner in the Pi TV HAT produces an error-free bit stream and switches transponders very quickly. The kernel GPIO IR driver is rock solid. I think that the user experience is at least as good as with my old PC setup.

Some buttons on my remote control unit were unreliable. Using an expired debit card, I was able to pry open the grey Hauppauge remote control unit, starting next to the IR LED. I guess I should upload pictures of the internals somewhere, to help others open theirs.

Next, I plan to attach some external storage for recordings. A USB 3.0 NVMe drive would allow faster backups (when detached from the Raspberry Pi 2) and an upgrade to a Pi 3 or 4.

On the software side, I am thinking to apply my kernel patch and to write a "kernel LIRC plugin" for VDR that would allow me to use /dev/lirc0 for the input. I would prefer to use the lower-level interface where each IR message corresponds to an event. I do not like the key-repeat timer logic of the kernel's input event driver. And I never liked the user-space lircd.

With best regards,

	Marko

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux