Re: [vdr] Making VDR run under Systemd

2021-10-21 Thread Marko Mäkelä

Thu, Oct 21, 2021 at 02:06:37AM +0300, glenvt18 wrote:
I'm not sure VDR is "idle" while a recording is paused. What is the log 
output?


I can only see a clue "trying device number 2 instead":

Oct 20 21:37:56 raspberrypi vdr: [3878] DVB API version is 0x050B (VDR was 
built with 0x050A)
Oct 20 21:37:56 raspberrypi vdr: [3878] frontend 0/0 provides DVB-T with QPSK,QAM16,QAM64 
("Realtek RTL2832 (DVB-T)")
Oct 20 21:37:57 raspberrypi kernel: [257117.778208] mn88473 3-0018: downloading 
firmware from file 'dvb-demod-mn88473-01.fw'
Oct 20 21:37:57 raspberrypi vdr: [3878] frontend 0/1 provides DVB-T,DVB-T2,DVB-C with 
QPSK,QAM16,QAM32,QAM64,QAM128,QAM256 ("Panasonic MN88473")
Oct 20 21:37:58 raspberrypi vdr: [3878] found 1 DVB device
Oct 20 21:37:58 raspberrypi vdr: [3878] initializing plugin: rpihddevice 
(1.0.4): HD output device for Raspberry Pi
Oct 20 21:37:58 raspberrypi vdr: [3878] rpihddevice: HwInit() done, display 
size is 1920x1080
Oct 20 21:37:58 raspberrypi vdr: [3878] setting primary device to 1
Oct 20 21:37:58 raspberrypi vdr: [3878] device 1 has no MPEG decoder
Oct 20 21:37:58 raspberrypi vdr: [3878] trying device number 2 instead
Oct 20 21:37:58 raspberrypi vdr: [3878] setting primary device to 2
Oct 20 21:37:58 raspberrypi vdr: [3878] setting current skin to "lcars"
Oct 20 21:37:58 raspberrypi vdr: [3878] loading 
/var/lib/vdr/themes/lcars-default.theme
Oct 20 21:37:58 raspberrypi vdr: [3878] starting plugin: rpihddevice
Oct 20 21:37:58 raspberrypi lircd-0.9.4c[3811]: Notice: accepted new client on 
/var/run/lirc/lircd
Oct 20 21:37:58 raspberrypi vdr: [3878] switching to channel 1 T-8438-8193-1501 
(Yle TV1 HD (T))
Oct 20 21:37:58 raspberrypi lircd-0.9.4c[3811]: Info: [lirc] protocol is enabled
Oct 20 21:37:58 raspberrypi vdr: [3911] SVDRP raspberrypi opening port 6419/tcp
Oct 20 21:37:58 raspberrypi vdr: [3911] SVDRP raspberrypi listening on port 
6419/tcp
Oct 20 21:37:58 raspberrypi vdr: [3907] rpihddevice: loading 
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf ...
Oct 20 21:37:58 raspberrypi vdr: [3907] rpihddevice: loading 
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf ...
Oct 20 21:38:01 raspberrypi vdr: [3878] retuning due to modification of channel 
1 (Yle TV1 HD (T))
Oct 20 21:38:01 raspberrypi vdr: [3878] switching to channel 1 T-8438-8193-1501 
(Yle TV1 HD (T))
Oct 20 21:40:00 raspberrypi vdr: [3911] SVDRP raspberrypi < 127.0.0.1:52142 
client connection accepted
Oct 20 21:40:08 raspberrypi vdr: [3878] replay 
/var/lib/video/XXX/2019-01-05.19.07.19-0.rec
Oct 20 21:40:08 raspberrypi vdr: [3878] loading 
/var/lib/video/XXX/2019-01-05.19.07.19-0.rec/marks
Oct 20 21:40:08 raspberrypi vdr: [3947] resuming replay at index 807 
(0:00:32.07)
Oct 20 21:40:13 raspberrypi vdr: [3911] SVDRP raspberrypi < 127.0.0.1:52142 
connection closed
Oct 20 21:41:55 raspberrypi vdr: [3878] stopping plugin: rpihddevice
Oct 20 21:41:55 raspberrypi lircd-0.9.4c[3811]: Info: removed client
Oct 20 21:41:55 raspberrypi vdr: [3878] saved setup to /var/lib/vdr/setup.conf

If I remember, there is a softhddevice's command/option called 
"suspend" or "detach", or whatever, which stops live TV. That

causes idle state too.


I remember (co-)developing such a feature for softdevice (without the 
"hd" part). Apart from saving power, another motivation was to reduce 
the probability of crashes, because reception errors of the DVB-T stream 
used to cause that back then.


Maybe I could check if something similar could be done in rpihddevice.

Still, in my opinion, when a recording is being watched and nothing is 
being simultaneously recorded or streamed, there should normally be no 
reason to keep any tuners powered.



BTW. Do you use both DVB-T and DVB-T2?


Yes, some transponders are DVB-T and some are DVB-T2, and I think that 
all free-to-view DVB-T2 channels are also available via DVB-T. I do not 
know when that transition period will end here. Wikipedia says that it 
was supposed to complete by April 2020 already. The first DVB-T2 
transponders were introduced in 2011.



And I've never tried the patch with VDR > 2.4.6.


The patch applied without glitches, only some line number differences.  
In VDR 2.5, the EPG works for me. In 2.4, I think I never got it to 
cover the DVB-T2 transponders.


Best regards,

Marko

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


Re: [vdr] Making VDR run under Systemd

2021-10-20 Thread glenvt18
I'm not sure VDR is "idle" while a recording is paused. What is the log
output?

I myself don't use a standalone VDR (using softhddevice etc.). I use it
only as a streaming server. When you start VDR as a server, it enters
idle mode after a configured timeout. It might be different for a
standalone VDR. If I remember, there is a softhddevice's command/option
called "suspend" or "detach", or whatever, which stops live TV. That
causes idle state too.

BTW. Do you use both DVB-T and DVB-T2?

And I've never tried the patch with VDR > 2.4.6.

On Wed, Oct 20, 2021 at 10:04:26PM +0300, Marko Mäkelä wrote:
> Mon, Oct 18, 2021 at 11:44:32PM +0300, glenvt18 wrote:
> > What is the output of
> > 
> >lsof | grep frontend
> > 
> > when VDR is in the "idle" state?
> 
> I produced some output from /proc/$(pgrep vdr)/fd which I think might be
> more helpful. The last-but-one "ls" output was "too soon" after I started
> and paused the recording, so VDR was still in normal mode.
> 
> In case you wonder, the connection between lircd and vdr did not work last
> time I tried, and probably also not this time. That is why I used telnet to
> the SVDRP port.
> 
> The last "ls" command was when VDR was expected to be idle (after 1-minute
> timeout, instead of the 15-minute timeout of your patch). I ran the command
> once more after a while, and the output remained identical.
> 
> Note that this USB DVB-T stick has two frontends for the same aerial
> connector. I think that one is for DVB-T and another for DVB-T2. You can see
> that "frontend1" was replaced with "frontend0" in the not-quite-idle mode.
> 
> I am happy to try a revised patch, and I can also use GDB ("thread apply all
> backtrace" and such) if that is needed.
> 
> This was the latest commit 0d50ec57f50375c8fda92d117e348dd8fd5a77a9
> ("Version 2.5.6") from http://git.tvdr.de/vdr.git with only your patch on
> top (and the 15-minute timeout changed to 1 minute).
> 
> Best regards,
> 
>   Marko
> 
> pi@raspberrypi:~ $ sudo service lircd start
> pi@raspberrypi:~ $ pgrep lircd
> 3811
> pi@raspberrypi:~ $ sudo ls -l /proc/3811/fd
> yhteensä 0
> lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
> lrwx-- 1 root root 64 loka  20 21:37 1 -> socket:[47310]
> lrwx-- 1 root root 64 loka  20 21:37 2 -> socket:[47310]
> lrwx-- 1 root root 64 loka  20 21:37 3 -> socket:[49360]
> lrwx-- 1 root root 64 loka  20 21:37 4 -> socket:[47311]
> lrwx-- 1 root root 64 loka  20 21:37 5 -> /run/lirc/lircd.pid
> lr-x-- 1 root root 64 loka  20 21:37 6 -> 
> /sys/devices/platform/soc/3f98.usb/usb1/1-1/1-1.5/rc/rc0/protocols
> lr-x-- 1 root root 64 loka  20 21:37 7 -> 
> /sys/devices/platform/soc/3f98.usb/usb1/1-1/1-1.5/rc/rc0/protocols
> pi@raspberrypi:~ $ sudo service vdr start
> pi@raspberrypi:~ $ sudo lsof /dev/dvb/adapter0/*
> COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
> vdr 3878  vdr7u   CHR  212,3  0t0 42703 
> /dev/dvb/adapter0/frontend0
> pi@raspberrypi:~ $ sudo ls -l /proc/3878/fd
> yhteensä 0
> lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
> lrwx-- 1 root root 64 loka  20 21:37 1 -> socket:[48975]
> lrwx-- 1 root root 64 loka  20 21:37 10 -> socket:[49006]
> lrwx-- 1 root root 64 loka  20 21:37 11 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 12 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 13 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 14 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 15 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 16 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 17 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 18 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 2 -> socket:[48975]
> lrwx-- 1 root root 64 loka  20 21:37 3 -> socket:[48980]
> lrwx-- 1 root root 64 loka  20 21:37 4 -> /dev/dvb/adapter0/frontend1
> lrwx-- 1 root root 64 loka  20 21:37 5 -> /dev/vchiq
> lrwx-- 1 root root 64 loka  20 21:37 6 -> socket:[49005]
> lrwx-- 1 root root 64 loka  20 21:37 7 -> /dev/dvb/adapter0/demux0
> lrwx-- 1 root root 64 loka  20 21:37 8 -> /dev/dvb/adapter0/demux0
> lr-x-- 1 root root 64 loka  20 21:37 9 -> /dev/dvb/adapter0/dvr0
> pi@raspberrypi:~ $ telnet localhost 6419
> Trying ::1...
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 raspberrypi SVDRP VideoDiskRecorder 2.5.6; Wed Oct 20 21:40:00 2021; UTF-8
> hitk menu
> 250 Key "menu" accepted
> hitk 4
> 250 Key "4" accepted
> hitk red
> 250 Key "red" accepted
> hitk pause
> 250 Key "pause" accepted
> quit
> 221 raspberrypi closing connection
> Connection closed by foreign host.
> pi@raspberrypi:~ $ date
> ke 20.10.2021 21.40.45 +0300
> pi@raspberrypi:~ $ sudo ls -l /proc/3878/fd
> yhteensä 0
> lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
> lrwx-- 1 root root 

Re: [vdr] Making VDR run under Systemd

2021-10-20 Thread Marko Mäkelä

Mon, Oct 18, 2021 at 11:44:32PM +0300, glenvt18 wrote:

What is the output of

   lsof | grep frontend

when VDR is in the "idle" state?


I produced some output from /proc/$(pgrep vdr)/fd which I think might be 
more helpful. The last-but-one "ls" output was "too soon" after I 
started and paused the recording, so VDR was still in normal mode.


In case you wonder, the connection between lircd and vdr did not work 
last time I tried, and probably also not this time. That is why I used 
telnet to the SVDRP port.


The last "ls" command was when VDR was expected to be idle (after 
1-minute timeout, instead of the 15-minute timeout of your patch). I ran 
the command once more after a while, and the output remained identical.


Note that this USB DVB-T stick has two frontends for the same aerial 
connector. I think that one is for DVB-T and another for DVB-T2. You can 
see that "frontend1" was replaced with "frontend0" in the not-quite-idle 
mode.


I am happy to try a revised patch, and I can also use GDB ("thread apply 
all backtrace" and such) if that is needed.


This was the latest commit 0d50ec57f50375c8fda92d117e348dd8fd5a77a9 
("Version 2.5.6") from http://git.tvdr.de/vdr.git with only your patch 
on top (and the 15-minute timeout changed to 1 minute).


Best regards,

Marko

pi@raspberrypi:~ $ sudo service lircd start
pi@raspberrypi:~ $ pgrep lircd
3811
pi@raspberrypi:~ $ sudo ls -l /proc/3811/fd
yhteensä 0
lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
lrwx-- 1 root root 64 loka  20 21:37 1 -> socket:[47310]
lrwx-- 1 root root 64 loka  20 21:37 2 -> socket:[47310]
lrwx-- 1 root root 64 loka  20 21:37 3 -> socket:[49360]
lrwx-- 1 root root 64 loka  20 21:37 4 -> socket:[47311]
lrwx-- 1 root root 64 loka  20 21:37 5 -> /run/lirc/lircd.pid
lr-x-- 1 root root 64 loka  20 21:37 6 -> 
/sys/devices/platform/soc/3f98.usb/usb1/1-1/1-1.5/rc/rc0/protocols
lr-x-- 1 root root 64 loka  20 21:37 7 -> 
/sys/devices/platform/soc/3f98.usb/usb1/1-1/1-1.5/rc/rc0/protocols
pi@raspberrypi:~ $ sudo service vdr start
pi@raspberrypi:~ $ sudo lsof /dev/dvb/adapter0/*
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
vdr 3878  vdr7u   CHR  212,3  0t0 42703 /dev/dvb/adapter0/frontend0
pi@raspberrypi:~ $ sudo ls -l /proc/3878/fd
yhteensä 0
lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
lrwx-- 1 root root 64 loka  20 21:37 1 -> socket:[48975]
lrwx-- 1 root root 64 loka  20 21:37 10 -> socket:[49006]
lrwx-- 1 root root 64 loka  20 21:37 11 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 12 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 13 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 14 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 15 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 16 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 17 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 18 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 2 -> socket:[48975]
lrwx-- 1 root root 64 loka  20 21:37 3 -> socket:[48980]
lrwx-- 1 root root 64 loka  20 21:37 4 -> /dev/dvb/adapter0/frontend1
lrwx-- 1 root root 64 loka  20 21:37 5 -> /dev/vchiq
lrwx-- 1 root root 64 loka  20 21:37 6 -> socket:[49005]
lrwx-- 1 root root 64 loka  20 21:37 7 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 8 -> /dev/dvb/adapter0/demux0
lr-x-- 1 root root 64 loka  20 21:37 9 -> /dev/dvb/adapter0/dvr0
pi@raspberrypi:~ $ telnet localhost 6419
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 raspberrypi SVDRP VideoDiskRecorder 2.5.6; Wed Oct 20 21:40:00 2021; UTF-8
hitk menu
250 Key "menu" accepted
hitk 4
250 Key "4" accepted
hitk red
250 Key "red" accepted
hitk pause
250 Key "pause" accepted
quit
221 raspberrypi closing connection
Connection closed by foreign host.
pi@raspberrypi:~ $ date
ke 20.10.2021 21.40.45 +0300
pi@raspberrypi:~ $ sudo ls -l /proc/3878/fd
yhteensä 0
lr-x-- 1 root root 64 loka  20 21:37 0 -> /dev/null
lrwx-- 1 root root 64 loka  20 21:37 1 -> socket:[48975]
lrwx-- 1 root root 64 loka  20 21:37 10 -> socket:[49006]
lrwx-- 1 root root 64 loka  20 21:37 13 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 14 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 15 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 16 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 17 -> /dev/dvb/adapter0/demux0
lrwx-- 1 root root 64 loka  20 21:37 2 -> socket:[48975]
lrwx-- 1 root root 64 loka  20 21:37 3 -> socket:[48980]
lrwx-- 1 root root 64 loka  20 21:37 4 -> /dev/dvb/adapter0/frontend1
lrwx-- 1 root root 64 loka  20 21:37 5 -> /dev/vchiq
lrwx-- 1 root root 64 loka  20 21:37 6 -> socket:[49005]
lr-x-- 1 root 

Re: [vdr] Making VDR run under Systemd

2021-10-18 Thread glenvt18
What is the output of

lsof | grep frontend

when VDR is in the "idle" state?

On Sun, Oct 17, 2021 at 10:52:11PM +0300, Marko Mäkelä wrote:
> Tue, Oct 12, 2021 at 07:21:10PM +0300, glenvt18 wrote:
> > Here you can find an updated version of the patch:
> > https://github.com/glenvt18/vdr/commits/vdr-2.4.6
> 
> Thank you. I just conducted some tests with my uncalibrated Agilent power
> supply. The USB cable of such low quality that the Raspberry Pi complained
> several times about undervoltage.
> 
> I measured the following current draw at 5 volts, in ascending order:
> 
> 81 mA: Raspberry Pi 2B shut down
> 200 mA: Raspberry Pi 2B powered up, no Ethernet plugged in
> 240 mA: Ethernet cable plugged in (HDMI cable makes no difference)
> 320 mA: Ethernet + USB DVB stick plugged in
> 440 mA: compiling VDR with "make -j4" (all CPU cores busy)
> 550 mA: VDR playing back a recording
> 530 mA: recording paused in VDR
> 510 mA: EPG scan running
> 600 mA: VDR displaying live DVB-T2
> 
> https://github.com/glenvt18/vdr/commit/b368f67d00d0b466ae36028efb9336e81f77dba8
> applied cleanly on the latest VDR source. I changed the PowerdownTimeoutM
> from 15 to 1 minute to speed up my testing.
> 
> The patch only had a minimal impact. After 1 or 2 minutes of the playback of
> a recording being paused, the power consumption dropped from 530 mA to 500
> mA.
> 
> I noticed that VDR is consuming about 5% of the CPU power according to
> "top". Could it not be made more event-based? It might be interesting to
> check with "powertop" how many wakeups per second there are, and with "perf
> record" and "perf replay" (or simply "perf top") where the CPU cycles are
> being spent when the playback of a recording is paused.
> 
> The bulk of the the power consumption ought to be caused by the USB DVB
> stick not being in fully idle state. After all, utilizing all 4 CPU cores
> during the "make -j4" minutes showed a pretty stable power consumption of
> 440 mA for several minutes, which is much less than when the VDR process was
> running.
> 
> Here is a summary of the power consumption measured at 5 volts.
> 
> 1.2 W (240 mA)  mostly idle Raspberry Pi 2B (Ethernet plugged in)
> 1.6 W (320 mA)  USB DVB stick plugged in, VDR not running
> 2.5 W (500 mA)  lowest power consumption achieved with VDR
> 3.0 W (600 mA)  VDR displaying live TV
> 
> My conclusion is that I will configure udev so that VDR will automatically
> start up or shut down when the USB stick is plugged in or removed. In that
> way, the power consumption of the system will only be more than doubled when
> VDR is actually in use.
> 
> I am planning to install the most recent Raspberry Pi and to document the
> minimal changes on top of that.
> 
> Best regards,
> 
>   Marko
> 
> ___
> vdr mailing list
> vdr@linuxtv.org
> https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

-- 
glenvt18

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


Re: [vdr] Making VDR run under Systemd

2021-10-17 Thread Marko Mäkelä

Tue, Oct 12, 2021 at 07:21:10PM +0300, glenvt18 wrote:

Here you can find an updated version of the patch:
https://github.com/glenvt18/vdr/commits/vdr-2.4.6


Thank you. I just conducted some tests with my uncalibrated Agilent 
power supply. The USB cable of such low quality that the Raspberry Pi 
complained several times about undervoltage.


I measured the following current draw at 5 volts, in ascending order:

81 mA: Raspberry Pi 2B shut down
200 mA: Raspberry Pi 2B powered up, no Ethernet plugged in
240 mA: Ethernet cable plugged in (HDMI cable makes no difference)
320 mA: Ethernet + USB DVB stick plugged in
440 mA: compiling VDR with "make -j4" (all CPU cores busy)
550 mA: VDR playing back a recording
530 mA: recording paused in VDR
510 mA: EPG scan running
600 mA: VDR displaying live DVB-T2

https://github.com/glenvt18/vdr/commit/b368f67d00d0b466ae36028efb9336e81f77dba8
applied cleanly on the latest VDR source. I changed the PowerdownTimeoutM
from 15 to 1 minute to speed up my testing.

The patch only had a minimal impact. After 1 or 2 minutes of the 
playback of a recording being paused, the power consumption dropped from 
530 mA to 500 mA.


I noticed that VDR is consuming about 5% of the CPU power according to 
"top". Could it not be made more event-based? It might be interesting to 
check with "powertop" how many wakeups per second there are, and with 
"perf record" and "perf replay" (or simply "perf top") where the CPU 
cycles are being spent when the playback of a recording is paused.


The bulk of the the power consumption ought to be caused by the USB DVB 
stick not being in fully idle state. After all, utilizing all 4 CPU 
cores during the "make -j4" minutes showed a pretty stable power 
consumption of 440 mA for several minutes, which is much less than when 
the VDR process was running.


Here is a summary of the power consumption measured at 5 volts.

1.2 W (240 mA)  mostly idle Raspberry Pi 2B (Ethernet plugged in)
1.6 W (320 mA)  USB DVB stick plugged in, VDR not running
2.5 W (500 mA)  lowest power consumption achieved with VDR
3.0 W (600 mA)  VDR displaying live TV

My conclusion is that I will configure udev so that VDR will 
automatically start up or shut down when the USB stick is plugged in or 
removed. In that way, the power consumption of the system will only be 
more than doubled when VDR is actually in use.


I am planning to install the most recent Raspberry Pi and to document 
the minimal changes on top of that.


Best regards,

Marko

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


Re: [vdr] Making VDR run under Systemd

2021-10-13 Thread Marko Mäkelä

Mon, Oct 11, 2021 at 04:02:43PM +0100, Richard F wrote:

Powersaving for DVB receivers - try the attached patch from glenvt18


Thank you. I will test it later once I have hooked up the Raspberry Pi 
to my laboratory power supply so that I can observe the total power 
consumption.


While "uhubctl -a off" would cause an optimal mouse to power off its 
LED, it will not completely cut the power. I tested this by plugging in 
a mobile phone to the USB port. It indicated that charging is available.


One impact of "uhubctl -a off" is that any plug/unplug events for the 
affected ports will be disabled, and "lsusb" will reflect the state as 
it was before the invocation.


I just confirmed with a laboratory power supply that my USB DVB-T/T2/C 
stick is consuming 61 mA at 5 volts. If I remember correctly, USB 
devices are allowed to drain up to 100 mA without any negotiation, so it 
should not be out-of-spec. Those additional 0.35 watts should be a 
significant portion of the total power consumption. I did not measure 
yet, but I hope it to be in the range of 2 to 3 watts.


For my use case, I think that I will only configure udev events for 
inserting or removing the stick. No shutdown command would be configured 
in VDR. I would abruptly shut down VDR and lircd by unplugging the 
adapter. They would observe the abrupt loss of DVB hardware, followed by 
a terminating signal sent by systemd or udevd.


Best regards,

Marko

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


Re: [vdr] Making VDR run under Systemd

2021-10-12 Thread glenvt18
Hi.

Here you can find an updated version of the patch:
https://github.com/glenvt18/vdr/commits/vdr-2.4.6

On Mon, Oct 11, 2021 at 04:02:43PM +0100, Richard F wrote:
> Mon, Sep 13, 2021 at 08:51:05PM +0200, Martin Wache wrote:
> > So, back to the plan with the Raspberry Pi 2B. One problem that I wanted
> > to solve is the power consumption of the DVB-T dongle when it is not in
> > use. I found https://github.com/mvp/uhubctl which can switch off power
> > on individual USB ports. I wrote a VDR shutdown script that does the
> > following:
> > 
> > sudo service lircd stop
> > uhubctl -p ... -a off
> > sudo service vdr stop
> > 
> > I did not refine the uhubctl invocation yet. The physical port could
> > vary.
> > 
> > An easy way to start up VDR could be a udev rule that would start up the
> > lircd and vdr services when the USB DVB stick is plugged in. Obviously,
> > if we power off the port during VDR shutdown, the adapter would have to
> > be plugged into a different port.
> > 
> > A simpler option for the occasional use of VDR might be to simply write
> > udev rules that will start up lircd and vdr when the DVB adapter is
> > plugged in, and shut down the services when the adapter is removed. 
> > That would be too risky if recording timers are being used.
> > 
> > I am not yet sure whether powering off the USB port makes any
> > difference, because the plastic case of the DVB stick feels slightly
> > warm to the touch even when the port is supposedly powered off. It might
> > be that some internal heat produced by the Rasberry is being dissipated
> > via the USB port. The metal frame of the USB jacks feels a bit warm too.
> > 
> > I think that I must measure the input power of the Raspberry Pi as well
> > as the voltage on the USB port when it is supposedly powered off.
> > 
> > Marko
> 
> Powersaving for DVB receivers - try the attached patch from glenvt18
> 
> 
> This has worked for me for a few years without noticeable problems on both
> USB and PCI cards.  I'm still on V2.20 by the way.  There's a little bit of
> log chatter as it powers up/down receivers when VDR scans the EPG etc, but
> you can filter that   I reckoned it saved around 3W at the mains for a
> 2-receiver server setup when I tested it back in 2016 - which adds up over
> time.
> 
> usbhubctl is a bit of a sledgehammer !
> 
> HTH
> 
> Richard
> 

> From 656cce97750882fd945d9ba76c47cb93a74c3059 Mon Sep 17 00:00:00 2001
> From: glenvt18 
> Date: Tue, 24 May 2016 00:39:01 +0300
> Subject: [PATCH] Device power saving feature
> 
> ---
>  config.c|  9 ++
>  config.h|  3 ++
>  device.c| 96 
> +++--
>  device.h| 29 +++
>  dvbdevice.c | 39 +
>  dvbdevice.h |  7 +
>  eitscan.c   |  7 -
>  menu.c  |  9 +-
>  vdr.c   |  6 
>  9 files changed, 201 insertions(+), 4 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 9c6b71e..e196353 100644
> --- a/config.c
> +++ b/config.c
> @@ -395,6 +395,9 @@ cSetup::cSetup(void)
>PositionerSpeed = 15;
>PositionerSwing = 650;
>PositionerLastLon = 0;
> +  PowerdownEnabled = 0;
> +  PowerdownTimeoutM = 15;
> +  PowerdownWakeupH = 4;
>SetSystemTime = 0;
>TimeSource = 0;
>TimeTransponder = 0;
> @@ -617,6 +620,9 @@ bool cSetup::Parse(const char *Name, const char *Value)
>else if (!strcasecmp(Name, "PositionerSpeed")) PositionerSpeed= 
> atoi(Value);
>else if (!strcasecmp(Name, "PositionerSwing")) PositionerSwing= 
> atoi(Value);
>else if (!strcasecmp(Name, "PositionerLastLon"))   PositionerLastLon  = 
> atoi(Value);
> +  else if (!strcasecmp(Name, "PowerdownEnabled"))PowerdownEnabled   = 
> atoi(Value);
> +  else if (!strcasecmp(Name, "PowerdownTimeoutM"))   PowerdownTimeoutM  = 
> atoi(Value);
> +  else if (!strcasecmp(Name, "PowerdownWakeupH"))PowerdownWakeupH   = 
> atoi(Value);
>else if (!strcasecmp(Name, "SetSystemTime"))   SetSystemTime  = 
> atoi(Value);
>else if (!strcasecmp(Name, "TimeSource"))  TimeSource = 
> cSource::FromString(Value);
>else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder= 
> atoi(Value);
> @@ -743,6 +749,9 @@ bool cSetup::Save(void)
>Store("PositionerSpeed",PositionerSpeed);
>Store("PositionerSwing",PositionerSwing);
>Store("PositionerLastLon",  PositionerLastLon);
> +  Store("PowerdownEnabled",   PowerdownEnabled);
> +  Store("PowerdownTimeoutM",  PowerdownTimeoutM);
> +  Store("PowerdownWakeupH",   PowerdownWakeupH);
>Store("SetSystemTime",  SetSystemTime);
>Store("TimeSource", cSource::ToString(TimeSource));
>Store("TimeTransponder",TimeTransponder);
> diff --git a/config.h b/config.h
> index d1bae04..dbe84bb 100644
> --- a/config.h
> +++ b/config.h
> @@ -273,6 +273,9 @@ public:
>int PositionerSpeed;
>int PositionerSwing;
>int PositionerLastLon;
> +  int 

Re: [vdr] Making VDR run under Systemd

2021-10-11 Thread Richard F

Mon, Sep 13, 2021 at 08:51:05PM +0200, Martin Wache wrote:
So, back to the plan with the Raspberry Pi 2B. One problem that I 
wanted to solve is the power consumption of the DVB-T dongle when it 
is not in use. I found https://github.com/mvp/uhubctl which can switch 
off power on individual USB ports. I wrote a VDR shutdown script that 
does the following:


sudo service lircd stop
uhubctl -p ... -a off
sudo service vdr stop

I did not refine the uhubctl invocation yet. The physical port could 
vary.


An easy way to start up VDR could be a udev rule that would start up 
the lircd and vdr services when the USB DVB stick is plugged in. 
Obviously, if we power off the port during VDR shutdown, the adapter 
would have to be plugged into a different port.


A simpler option for the occasional use of VDR might be to simply 
write udev rules that will start up lircd and vdr when the DVB adapter 
is plugged in, and shut down the services when the adapter is 
removed.  That would be too risky if recording timers are being used.


I am not yet sure whether powering off the USB port makes any 
difference, because the plastic case of the DVB stick feels slightly 
warm to the touch even when the port is supposedly powered off. It 
might be that some internal heat produced by the Rasberry is being 
dissipated via the USB port. The metal frame of the USB jacks feels a 
bit warm too.


I think that I must measure the input power of the Raspberry Pi as 
well as the voltage on the USB port when it is supposedly powered off.


Marko


Powersaving for DVB receivers - try the attached patch from glenvt18 



This has worked for me for a few years without noticeable problems on 
both USB and PCI cards.  I'm still on V2.20 by the way.  There's a 
little bit of log chatter as it powers up/down receivers when VDR scans 
the EPG etc, but you can filter that   I reckoned it saved around 3W at 
the mains for a 2-receiver server setup when I tested it back in 2016 - 
which adds up over time.


usbhubctl is a bit of a sledgehammer !

HTH

Richard

>From 656cce97750882fd945d9ba76c47cb93a74c3059 Mon Sep 17 00:00:00 2001
From: glenvt18 
Date: Tue, 24 May 2016 00:39:01 +0300
Subject: [PATCH] Device power saving feature

---
 config.c|  9 ++
 config.h|  3 ++
 device.c| 96 +++--
 device.h| 29 +++
 dvbdevice.c | 39 +
 dvbdevice.h |  7 +
 eitscan.c   |  7 -
 menu.c  |  9 +-
 vdr.c   |  6 
 9 files changed, 201 insertions(+), 4 deletions(-)

diff --git a/config.c b/config.c
index 9c6b71e..e196353 100644
--- a/config.c
+++ b/config.c
@@ -395,6 +395,9 @@ cSetup::cSetup(void)
   PositionerSpeed = 15;
   PositionerSwing = 650;
   PositionerLastLon = 0;
+  PowerdownEnabled = 0;
+  PowerdownTimeoutM = 15;
+  PowerdownWakeupH = 4;
   SetSystemTime = 0;
   TimeSource = 0;
   TimeTransponder = 0;
@@ -617,6 +620,9 @@ bool cSetup::Parse(const char *Name, const char *Value)
   else if (!strcasecmp(Name, "PositionerSpeed")) PositionerSpeed= 
atoi(Value);
   else if (!strcasecmp(Name, "PositionerSwing")) PositionerSwing= 
atoi(Value);
   else if (!strcasecmp(Name, "PositionerLastLon"))   PositionerLastLon  = 
atoi(Value);
+  else if (!strcasecmp(Name, "PowerdownEnabled"))PowerdownEnabled   = 
atoi(Value);
+  else if (!strcasecmp(Name, "PowerdownTimeoutM"))   PowerdownTimeoutM  = 
atoi(Value);
+  else if (!strcasecmp(Name, "PowerdownWakeupH"))PowerdownWakeupH   = 
atoi(Value);
   else if (!strcasecmp(Name, "SetSystemTime"))   SetSystemTime  = 
atoi(Value);
   else if (!strcasecmp(Name, "TimeSource"))  TimeSource = 
cSource::FromString(Value);
   else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder= 
atoi(Value);
@@ -743,6 +749,9 @@ bool cSetup::Save(void)
   Store("PositionerSpeed",PositionerSpeed);
   Store("PositionerSwing",PositionerSwing);
   Store("PositionerLastLon",  PositionerLastLon);
+  Store("PowerdownEnabled",   PowerdownEnabled);
+  Store("PowerdownTimeoutM",  PowerdownTimeoutM);
+  Store("PowerdownWakeupH",   PowerdownWakeupH);
   Store("SetSystemTime",  SetSystemTime);
   Store("TimeSource", cSource::ToString(TimeSource));
   Store("TimeTransponder",TimeTransponder);
diff --git a/config.h b/config.h
index d1bae04..dbe84bb 100644
--- a/config.h
+++ b/config.h
@@ -273,6 +273,9 @@ public:
   int PositionerSpeed;
   int PositionerSwing;
   int PositionerLastLon;
+  int PowerdownEnabled;
+  int PowerdownTimeoutM;
+  int PowerdownWakeupH;
   int SetSystemTime;
   int TimeSource;
   int TimeTransponder;
diff --git a/device.c b/device.c
index 4db7cc2..1c29677 100644
--- a/device.c
+++ b/device.c
@@ -104,6 +104,9 @@ cDevice::cDevice(void)
   dvbSubtitleConverter = NULL;
   autoSelectPreferredSubtitleLanguage = true;
 
+  idleTimerExpires = time(NULL) + Setup.PowerdownTimeoutM * 60;
+  wakeupTimerExpires = 0;
+
   for 

Re: [vdr] Making VDR run under Systemd

2021-10-10 Thread Marko Mäkelä

Hi all, hi Martin!

Mon, Sep 13, 2021 at 08:51:05PM +0200, Martin Wache wrote:

Yes good times! :-)


I think that softdevice (without HD in the name) was quite an 
achievement for the hardware that was available about 20 years ago.


Today, I made a little progress on this. First, I was thinking to set up 
an unused IBM Thinkpad X60 for VDR. In the end, I found out that 
softhddevice depends on a number of X11 libraries.


I also found some forum posts that suggested that it is not expected to 
work with Wayland. If I understood correctly, Wayland helps reduce the 
CPU overhead, as long as there is some GPU support for compositing RGBA 
buffers, and it could simplify the rendering path.


In the end, I decided that one 32-bit CPU core (2 with hyperthreading) 
and a 1024×768 screen panel would likely not be a good match for HDTV.


So, back to the plan with the Raspberry Pi 2B. One problem that I wanted 
to solve is the power consumption of the DVB-T dongle when it is not in 
use. I found https://github.com/mvp/uhubctl which can switch off power 
on individual USB ports. I wrote a VDR shutdown script that does the 
following:


sudo service lircd stop
uhubctl -p ... -a off
sudo service vdr stop

I did not refine the uhubctl invocation yet. The physical port could 
vary.


An easy way to start up VDR could be a udev rule that would start up the 
lircd and vdr services when the USB DVB stick is plugged in. Obviously, 
if we power off the port during VDR shutdown, the adapter would have to 
be plugged into a different port.


A simpler option for the occasional use of VDR might be to simply write 
udev rules that will start up lircd and vdr when the DVB adapter is 
plugged in, and shut down the services when the adapter is removed.  
That would be too risky if recording timers are being used.


I am not yet sure whether powering off the USB port makes any 
difference, because the plastic case of the DVB stick feels slightly 
warm to the touch even when the port is supposedly powered off. It might 
be that some internal heat produced by the Rasberry is being dissipated 
via the USB port. The metal frame of the USB jacks feels a bit warm too.


I think that I must measure the input power of the Raspberry Pi as well 
as the voltage on the USB port when it is supposedly powered off.


Marko

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


Re: [vdr] Making VDR run under Systemd

2021-09-13 Thread Martin Wache

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

2021-09-13 Thread Marko Mäkelä

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

2021-09-13 Thread g.bruno

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


[vdr] Making VDR run under Systemd

2021-09-12 Thread 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