Making VDR run under Systemd

Marko Mäkelä <[email protected]> Sun, 12 Sep 2021 12:46:54 +0300
Newsgroups gmane.linux.vdr
Message-ID <YT3MjtRAAj+etY/a@jyty>
Hi all,

I was an active VDR user from about 2004 to 2010 when my children were 
younger and there was a need to record TV programs for them. The old 
setup was more or less abandoned when I got a smart TV and the family 
started to use video streaming services.

Some years ago, I got a Raspberry Pi 2 B and an Astrometa DVB-T2 USB 
stick that also includes an infrared receiver. Because its bundled 
remote control unit (RCU) has much fewer buttons than the one that I got 
with the Hauppauge Nova-T PCI 90002 years ago, I configured lircd to 
translate the RC5 codes from the old RCU. For output, I am using 
rpihddevice.

Yesterday, I upgraded to VDR 2.5.6 and rpihddevice 1.0.4 from 
git://projects.vdr-developer.org/vdr-plugin-rpihddevice.git while 
keeping the rest of the Raspbian 9.13 mostly intact.

I installed the self-built software simply by replacing the original 
/usr/bin/vdr that was part of the distribution's vdr 2.2.0 package, and 
copying the plugin to /usr/lib/vdr/plugins/. It might not be the 
cleanest solution, but it worked for me.

I had some trouble with Systemd, which I resolved by creating a 
configuration file:

# cat > /etc/systemd/system/vdr.service << EOF
[Service]
Restart=on-failure
RestartSec=1s
ExecStart=/usr/bin/vdr
TimeoutStartSec=infinity
EOF
# systemctl daemon-reload
# service lightdm stop
# service vdr start

I did not double-check it, but I understood that this could entirely 
bypass the /etc/init.d/vdr script, which would invoke the runvdr script 
(which normally runs vdr in a loop). If I choose Restart from the VDR 
menu, systemd will restart it nicely.

I did not configure the Power button yet. Currently, VDR complains that 
no -s parameter is given when I press the Power button on the RCU.  
Ideally, I think that VDR should suspend the live video output and 
somehow inform Systemd that the entire system may be suspended, as far 
as VDR is concerned. (Of course, only if there are no recordings or 
remote connections active to VDR.) Then, if nothing else prevents the 
system from being shut down or suspended, Systemd would do it based on 
its configuration.

Years ago, I developed some patches and configuration at 
https://iki.fi/msmakela/software/vdr/ to achieve something like this on 
my old system, and I would now like to revive this somehow. Ideally, the 
Power button would shut down the DVB receiver and display some 
indication on the OSD or the video frame buffer that the output has been 
suspended.

If my Raspberry Pi were not an "always-on server" that runs some other 
services as well, I might want to reimplement the "wake-on-RCU" hardware 
that is generating a wake-on-LAN signal via the Nova-T PCI card, 
possibly by extending 
https://spellfoundry.com/product/sleepy-pi-2-usb-c/ or a similar product 
that would implement a wake-on-timer for the Raspberry Pi. Then, the 
system would power up nicely either by RCU or by a recording timer.  

Integrating the wake-on-timer logic with Systemd could be another 
challenge. I might try this on PC hardware, which already supports 
wake-on-timer out of the box. A quick search turned up a promising 
starting point:
https://www.freedesktop.org/software/systemd/man/systemd.timer.html

The motivation of this exercise is to have a stand-alone VDR front/back 
end installation that plays nicely with Systemd, without reinventing any 
logic around scheduling, startup, and shutdown.

Maybe one day, once some more progress has been made with Wayland and 
when using a Raspberry Pi model with more GPU memory, one could press 
the Power button on the RCU and have the live TV pop up either 
fullscreen or in a window, on top of the graphical desktop (which would 
be available for generic use).

Best regards,

	Marko

_______________________________________________
vdr mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr