Re: [vdr] Making VDR run under Systemd
Hi all, hi Marko! Am 12.09.21 um 11:46 schrieb Marko Mäkelä: I was an active VDR user from about 2004 to 2010 Yes good times! :-) Actually I still use the VDR excatly for the same reasons: to record shows for my kids. 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. I currently don't use systemd, but I have a similar use case for my server. I agree that a solution with systemd would be nicer, but a few years back, I didn't get systemd to work with vdr the way I liked. So I've created a python script which starts vdr, and if vdr stops it captures the next time vdr requests to be run. Then it kills vdr, unloads the dvb drivers (which also switches of the LNBs) and opens all the network ports vdr is using. A second script runs every 5 minutes or so and checks if vdr is running, a user is logged in, or some other services have been recently used. If not it suspends the server and sets the wake-up time to vdr requested time. So the server wakes up ahead of a recording. The python script checks if the start time requested by vdr is close, and starts vdr a few minutes before the requested time. If I need the server or vdr I just send a wol packet. When I access the vdr and the python script is running instead of the vdr, the python script closes all network ports, loads the dvb drivers and starts the vdr. This even worked very nicely with kodi, but I stopped using kodi, I don't like the user interface. Now I use vdr-xineliboutput. I have to start vdr-xineliboutput several times until the vdr is started, but I don't mind :-). Using this setup I can use the server for many more services, and don't waste power when I don't need the vdr. This was partly inspired by systemd, but I think it is still not possible to implement this with systemd. I can share the scripts if you like to modify them for your needs. Regards, Martin ___ vdr mailing list vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] Making VDR run under Systemd
Mon, Sep 13, 2021 at 10:57:23AM +0200, g.bruno wrote: Hallo, the problem for the shutdown bottom "no -s option" (not parameter) is in /etc/vdr/config.d/00-vdr.conf where the line 21 concerning shutdown is commented out: #--shutdown=/usr/lib/vdr/vdr-shutdown.wrapper Thank you, but it is not that simple in case VDR is not the main use of the system. What I would want to achieve is some kind of a "wake lock" (borrowing Android terminology): the system would shut down automatically after some timeout, unless a service prevents it from shutting down. VDR would be only one such service. There could other reasons that prevent a shutdown, say, a user being logged in, or a file server running or being actively used. I would want VDR to release most resources (and stop consuming 5% of CPU time and a larger chunk of the 1GiB RAM) when I press the Power button on the RCU. If I press the button again, VDR should wake up. Maybe this can be achieved with a "shutdown" program that would not actually shut anything down, but wait for another Power button press to possibly start up VDR. Another feature that I might want is that when I plug in the DVB-T2 stick into the computer, VDR will start up. That is, the main purpose of the computer could be something else, and the computer would switch to "appliance mode" only when needed. Likewise, the USB stick would only consume power and expose the system to lighting (via the antenna mast) when needed (when someone wants to watch or record something with VDR). That I believe is achievable with udev rules. Maybe the whole should then be driven via udevd and not systemd. When time permits, I will try to experiment more. Marko ___ vdr mailing list vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] Making VDR run under Systemd
Hallo, the problem for the shutdown bottom "no -s option" (not parameter) is in /etc/vdr/config.d/00-vdr.conf where the line 21 concerning shutdown is commented out: #--shutdown=/usr/lib/vdr/vdr-shutdown.wrapper I uncommented it and it worked for me with the power-off-buttom on the remote control. Perhaps this will help you. VDR 2.4.2 on linux mate 20.4 Regards gbruno Am 12.09.21 um 11:46 schrieb Marko Mäkelä: 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 vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr ___ vdr mailing list vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr