mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Unused devices can now be put into a power save mode
This commit is contained in:
parent
749ba57dcc
commit
e7ea087a6e
@ -2571,6 +2571,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
|
|||||||
for making logging event status changes also show the previous status
|
for making logging event status changes also show the previous status
|
||||||
for making a device always being kept occupied if a timer is in VPS margin or needs the
|
for making a device always being kept occupied if a timer is in VPS margin or needs the
|
||||||
transponder
|
transponder
|
||||||
|
for suggesting to enable unused devices to be put into a power save mode
|
||||||
|
|
||||||
Werner Färber <w.faerber@gmx.de>
|
Werner Färber <w.faerber@gmx.de>
|
||||||
for reporting a bug in handling the cPluginManager::Active() result when pressing
|
for reporting a bug in handling the cPluginManager::Active() result when pressing
|
||||||
|
5
HISTORY
5
HISTORY
@ -9919,7 +9919,7 @@ Video Disk Recorder Revision History
|
|||||||
- A device is now always kept occupied if a timer is in VPS margin or needs the
|
- A device is now always kept occupied if a timer is in VPS margin or needs the
|
||||||
transponder (thanks to Markus Ehrnsperger).
|
transponder (thanks to Markus Ehrnsperger).
|
||||||
|
|
||||||
2024-06-27:
|
2024-07-06:
|
||||||
|
|
||||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||||
- Fixed a possible access of a deleted object in the EIT scanner.
|
- Fixed a possible access of a deleted object in the EIT scanner.
|
||||||
@ -9932,3 +9932,6 @@ Video Disk Recorder Revision History
|
|||||||
- Removed leftover cMenuRecordings::SetPath().
|
- Removed leftover cMenuRecordings::SetPath().
|
||||||
- The EIT scanner now checks whether there is a proper device before adding a
|
- The EIT scanner now checks whether there is a proper device before adding a
|
||||||
channel to the scan list.
|
channel to the scan list.
|
||||||
|
- Unused devices can now be put into a power save mode (suggested by Markus
|
||||||
|
Ehrnsperger). Device plugins need to implement the new function
|
||||||
|
cDevice::SetPowerSaveMode() to make this work.
|
||||||
|
11
PLUGINS.html
11
PLUGINS.html
@ -2117,6 +2117,17 @@ new cMyDeviceHook;
|
|||||||
</pre></td></tr></table><p>
|
</pre></td></tr></table><p>
|
||||||
|
|
||||||
and shall not delete this object. It will be automatically deleted when the program ends.
|
and shall not delete this object. It will be automatically deleted when the program ends.
|
||||||
|
<p>
|
||||||
|
<b>Power management</b>
|
||||||
|
<p>
|
||||||
|
A device that can be put into a power save mode can implement the function
|
||||||
|
|
||||||
|
<p><table><tr><td class="code"><pre>
|
||||||
|
virtual void SetPowerSaveMode(bool On);
|
||||||
|
</pre></td></tr></table><p>
|
||||||
|
|
||||||
|
If On is true, power save mode shall be activated, if it is false,
|
||||||
|
normal operating mode shall be restored.
|
||||||
|
|
||||||
<hr><h2><a name="Positioners">Positioners</a></h2>
|
<hr><h2><a name="Positioners">Positioners</a></h2>
|
||||||
|
|
||||||
|
17
device.c
17
device.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.c 5.13 2024/03/29 21:46:50 kls Exp $
|
* $Id: device.c 5.14 2024/07/06 11:19:21 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
@ -812,6 +812,16 @@ bool cDevice::MaySwitchTransponder(const cChannel *Channel) const
|
|||||||
return !Occupied() && !Receiving() && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid);
|
return !Occupied() && !Receiving() && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cDevice::SetPowerSaveMode(bool On)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void cDevice::SetPowerSaveIfUnused(void)
|
||||||
|
{
|
||||||
|
if (!Occupied() && !Receiving() && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid))
|
||||||
|
SetPowerSaveMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
|
bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
|
||||||
{
|
{
|
||||||
if (LiveView) {
|
if (LiveView) {
|
||||||
@ -916,6 +926,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
|
|||||||
// channel to it, for possible later decryption:
|
// channel to it, for possible later decryption:
|
||||||
if (camSlot)
|
if (camSlot)
|
||||||
camSlot->AddChannel(Channel);
|
camSlot->AddChannel(Channel);
|
||||||
|
SetPowerSaveMode(false);
|
||||||
if (SetChannelDevice(Channel, LiveView)) {
|
if (SetChannelDevice(Channel, LiveView)) {
|
||||||
// Start section handling:
|
// Start section handling:
|
||||||
if (sectionHandler) {
|
if (sectionHandler) {
|
||||||
@ -962,9 +973,11 @@ void cDevice::ForceTransferMode(void)
|
|||||||
{
|
{
|
||||||
if (!cTransferControl::ReceiverDevice()) {
|
if (!cTransferControl::ReceiverDevice()) {
|
||||||
LOCK_CHANNELS_READ;
|
LOCK_CHANNELS_READ;
|
||||||
if (const cChannel *Channel = Channels->GetByNumber(CurrentChannel()))
|
if (const cChannel *Channel = Channels->GetByNumber(CurrentChannel())) {
|
||||||
|
SetPowerSaveMode(false);
|
||||||
SetChannelDevice(Channel, false); // this implicitly starts Transfer Mode
|
SetChannelDevice(Channel, false); // this implicitly starts Transfer Mode
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cDevice::Occupied(int Priority) const
|
int cDevice::Occupied(int Priority) const
|
||||||
|
10
device.h
10
device.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.h 5.4 2024/03/29 21:46:50 kls Exp $
|
* $Id: device.h 5.5 2024/07/06 11:19:21 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DEVICE_H
|
#ifndef __DEVICE_H
|
||||||
@ -346,6 +346,14 @@ public:
|
|||||||
///< device, without disturbing any other activities. If an occupied timeout
|
///< device, without disturbing any other activities. If an occupied timeout
|
||||||
///< has been set for this device, and that timeout has not yet expired,
|
///< has been set for this device, and that timeout has not yet expired,
|
||||||
///< this function returns false.
|
///< this function returns false.
|
||||||
|
virtual void SetPowerSaveMode(bool On);
|
||||||
|
///< Puts the device into power save mode, if applicable.
|
||||||
|
///< If On is true, power save mode shall be activated, if it is false,
|
||||||
|
///< normal operating mode shall be restored.
|
||||||
|
///< The default implementation does nothing.
|
||||||
|
void SetPowerSaveIfUnused(void);
|
||||||
|
///< Sets this device into a power save mode if it is not currently used and
|
||||||
|
///< has implemented SetPowerSaveMode().
|
||||||
bool SwitchChannel(const cChannel *Channel, bool LiveView);
|
bool SwitchChannel(const cChannel *Channel, bool LiveView);
|
||||||
///< Switches the device to the given Channel, initiating transfer mode
|
///< Switches the device to the given Channel, initiating transfer mode
|
||||||
///< if necessary.
|
///< if necessary.
|
||||||
|
20
eitscan.c
20
eitscan.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: eitscan.c 5.5 2024/06/27 10:49:34 kls Exp $
|
* $Id: eitscan.c 5.6 2024/07/06 11:19:21 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "eitscan.h"
|
#include "eitscan.h"
|
||||||
@ -105,6 +105,7 @@ cEITScanner EITScanner;
|
|||||||
|
|
||||||
cEITScanner::cEITScanner(void)
|
cEITScanner::cEITScanner(void)
|
||||||
{
|
{
|
||||||
|
paused = false;
|
||||||
lastScan = 0;
|
lastScan = 0;
|
||||||
lastActivity = time(NULL);
|
lastActivity = time(NULL);
|
||||||
currentChannel = 0;
|
currentChannel = 0;
|
||||||
@ -145,8 +146,23 @@ void cEITScanner::Process(void)
|
|||||||
if (Setup.EPGScanTimeout || !lastActivity) { // !lastActivity means a scan was forced
|
if (Setup.EPGScanTimeout || !lastActivity) { // !lastActivity means a scan was forced
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
|
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
|
||||||
if (Setup.EPGPauseAfterScan && scanList->Count() == 0 && lastActivity && lastScan && now - lastScan < Setup.EPGScanTimeout * 3600)
|
if (Setup.EPGPauseAfterScan && scanList->Count() == 0 && lastActivity && lastScan && now - lastScan < Setup.EPGScanTimeout * 3600) {
|
||||||
|
if (!paused) {
|
||||||
|
dsyslog("pause EPG scan");
|
||||||
|
paused = true;
|
||||||
|
}
|
||||||
|
// Allow unused devices to go into power save mode:
|
||||||
|
for (int i = 0; i < cDevice::NumDevices(); i++) {
|
||||||
|
if (cDevice *Device = cDevice::GetDevice(i))
|
||||||
|
Device->SetPowerSaveIfUnused();
|
||||||
|
}
|
||||||
|
lastScan = time(NULL); // let's not do this too often
|
||||||
return; // pause for Setup.EPGScanTimeout hours
|
return; // pause for Setup.EPGScanTimeout hours
|
||||||
|
}
|
||||||
|
else if (paused) {
|
||||||
|
dsyslog("start EPG scan");
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
cStateKey StateKey;
|
cStateKey StateKey;
|
||||||
if (const cChannels *Channels = cChannels::GetChannelsRead(StateKey, 10)) {
|
if (const cChannels *Channels = cChannels::GetChannelsRead(StateKey, 10)) {
|
||||||
if (scanList->Count() == 0) {
|
if (scanList->Count() == 0) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: eitscan.h 2.1 2012/03/07 14:16:57 kls Exp $
|
* $Id: eitscan.h 5.1 2024/07/06 11:19:21 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EITSCAN_H
|
#ifndef __EITSCAN_H
|
||||||
@ -23,6 +23,7 @@ private:
|
|||||||
enum { ActivityTimeout = 60,
|
enum { ActivityTimeout = 60,
|
||||||
ScanTimeout = 20
|
ScanTimeout = 20
|
||||||
};
|
};
|
||||||
|
bool paused;
|
||||||
time_t lastScan, lastActivity;
|
time_t lastScan, lastActivity;
|
||||||
int currentChannel;
|
int currentChannel;
|
||||||
cScanList *scanList;
|
cScanList *scanList;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user