mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Implemented power save mode for cDvbDevice
This commit is contained in:
parent
e7ea087a6e
commit
f3972e4795
@ -2572,6 +2572,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
|
||||
for making a device always being kept occupied if a timer is in VPS margin or needs the
|
||||
transponder
|
||||
for suggesting to enable unused devices to be put into a power save mode
|
||||
for a patch that was used to implement power save mode for cDvbDevice
|
||||
|
||||
Werner Färber <w.faerber@gmx.de>
|
||||
for reporting a bug in handling the cPluginManager::Active() result when pressing
|
||||
|
4
HISTORY
4
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
|
||||
transponder (thanks to Markus Ehrnsperger).
|
||||
|
||||
2024-07-06:
|
||||
2024-07-08:
|
||||
|
||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||
- Fixed a possible access of a deleted object in the EIT scanner.
|
||||
@ -9935,3 +9935,5 @@ Video Disk Recorder Revision History
|
||||
- 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.
|
||||
- Implemented power save mode for cDvbDevice (based on a patch from Markus
|
||||
Ehrnsperger).
|
||||
|
42
dvbdevice.c
42
dvbdevice.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.c 5.3 2022/12/05 14:04:10 kls Exp $
|
||||
* $Id: dvbdevice.c 5.4 2024/07/08 09:34:33 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbdevice.h"
|
||||
@ -593,6 +593,7 @@ public:
|
||||
bool GetSignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
|
||||
int GetSignalStrength(void) const;
|
||||
int GetSignalQuality(void) const;
|
||||
void SetPowerSaveMode(bool On);
|
||||
};
|
||||
|
||||
cMutex cDvbTuner::bondMutex;
|
||||
@ -859,6 +860,8 @@ void cDvbTuner::ClearEventQueue(void) const
|
||||
|
||||
bool cDvbTuner::GetFrontendStatus(fe_status_t &Status) const
|
||||
{
|
||||
if (fd_frontend == -1)
|
||||
return false;
|
||||
ClearEventQueue();
|
||||
Status = (fe_status_t)0; // initialize here to fix buggy drivers
|
||||
while (1) {
|
||||
@ -876,6 +879,8 @@ bool cDvbTuner::GetFrontendStatus(fe_status_t &Status) const
|
||||
|
||||
bool cDvbTuner::GetSignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per, int *Status) const
|
||||
{
|
||||
if (fd_frontend == -1)
|
||||
return false;
|
||||
ClearEventQueue();
|
||||
fe_status_t FeStatus = (fe_status_t)0; // initialize here to fix buggy drivers
|
||||
dtv_property Props[MAXFRONTENDCMDS];
|
||||
@ -1226,6 +1231,8 @@ int SignalToSQI(const cChannel *Channel, int Signal, int Ber, int FeModulation,
|
||||
|
||||
int cDvbTuner::GetSignalStrength(void) const
|
||||
{
|
||||
if (fd_frontend == -1)
|
||||
return 0;
|
||||
ClearEventQueue();
|
||||
// Try DVB API 5:
|
||||
for (int i = 0; i < 1; i++) { // just a trick to break out with 'continue' ;-)
|
||||
@ -1291,6 +1298,8 @@ int cDvbTuner::GetSignalStrength(void) const
|
||||
|
||||
int cDvbTuner::GetSignalQuality(void) const
|
||||
{
|
||||
if (fd_frontend == -1)
|
||||
return 0;
|
||||
// Try DVB API 5:
|
||||
for (int i = 0; i < 1; i++) { // just a trick to break out with 'continue' ;-)
|
||||
dtv_property Props[MAXFRONTENDCMDS];
|
||||
@ -1536,6 +1545,8 @@ void cDvbTuner::ExecuteDiseqc(const cDiseqc *Diseqc, int *Frequency)
|
||||
|
||||
void cDvbTuner::ResetToneAndVoltage(void)
|
||||
{
|
||||
if (fd_frontend == -1)
|
||||
return;
|
||||
CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, bondedTuner ? SEC_VOLTAGE_OFF : SEC_VOLTAGE_13));
|
||||
CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_OFF));
|
||||
}
|
||||
@ -1768,6 +1779,30 @@ void cDvbTuner::Action(void)
|
||||
}
|
||||
}
|
||||
|
||||
void cDvbTuner::SetPowerSaveMode(bool On)
|
||||
{
|
||||
cMutexLock MutexLock(&mutex);
|
||||
if (On) {
|
||||
if (fd_frontend != -1) {
|
||||
dsyslog("closing frontend %d/%d", adapter, frontend);
|
||||
tunerStatus = tsIdle;
|
||||
dvbFrontend->Close();
|
||||
fd_frontend = -1;
|
||||
channel = cChannel();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fd_frontend == -1) {
|
||||
dsyslog("opening frontend %d/%d", adapter, frontend);
|
||||
fd_frontend = dvbFrontend->Open();
|
||||
lastUncValue = 0;
|
||||
lastUncDelta = 0;
|
||||
lastUncChange = 0;
|
||||
lnbPowerTurnedOn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- cDvbSourceParam -------------------------------------------------------
|
||||
|
||||
class cDvbSourceParam : public cSourceParam {
|
||||
@ -2300,6 +2335,11 @@ bool cDvbDevice::MaySwitchTransponder(const cChannel *Channel) const
|
||||
return BondingOk(Channel, true) && cDevice::MaySwitchTransponder(Channel);
|
||||
}
|
||||
|
||||
void cDvbDevice::SetPowerSaveMode(bool On)
|
||||
{
|
||||
dvbTuner->SetPowerSaveMode(On);
|
||||
}
|
||||
|
||||
bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
||||
{
|
||||
if (dvbTuner->ProvidesFrontend(Channel, true)) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.h 4.7 2020/06/27 10:24:46 kls Exp $
|
||||
* $Id: dvbdevice.h 5.1 2024/07/08 09:34:33 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBDEVICE_H
|
||||
@ -244,6 +244,7 @@ public:
|
||||
virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
|
||||
virtual bool IsTunedToTransponder(const cChannel *Channel) const;
|
||||
virtual bool MaySwitchTransponder(const cChannel *Channel) const;
|
||||
virtual void SetPowerSaveMode(bool On);
|
||||
protected:
|
||||
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user