mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
134 lines
3.8 KiB
Diff
134 lines
3.8 KiB
Diff
Description: This patch is needed for the rotor plugin.
|
|
Author: Thomas Bergwinkl <Bergwinkl.Thomas@vr-web.de>
|
|
Origin: extracted from the rotor plugin 0.1.4-vdr1.5
|
|
|
|
Index: b/device.h
|
|
===================================================================
|
|
--- a/device.h
|
|
+++ b/device.h
|
|
@@ -24,6 +24,8 @@
|
|
#include "spu.h"
|
|
#include "thread.h"
|
|
#include "tools.h"
|
|
+#include <asm/types.h>
|
|
+#include <linux/dvb/frontend.h>
|
|
|
|
#define MAXDEVICES 16 // the maximum number of devices in the system
|
|
#define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
|
|
@@ -337,6 +339,7 @@
|
|
virtual bool HasProgramme(void) const;
|
|
///< Returns true if the device is currently showing any programme to
|
|
///< the user, either through replaying or live.
|
|
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd) {return false;}
|
|
|
|
// PID handle facilities
|
|
|
|
Index: b/dvbdevice.c
|
|
===================================================================
|
|
--- a/dvbdevice.c
|
|
+++ b/dvbdevice.c
|
|
@@ -283,6 +283,7 @@
|
|
private:
|
|
static cMutex bondMutex;
|
|
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
|
|
+ bool SendDiseqc;
|
|
int frontendType;
|
|
const cDvbDevice *device;
|
|
int fd_frontend;
|
|
@@ -299,6 +300,7 @@
|
|
cMutex mutex;
|
|
cCondVar locked;
|
|
cCondVar newSet;
|
|
+ dvb_diseqc_master_cmd diseqc_cmd;
|
|
cDvbTuner *bondedTuner;
|
|
bool bondedMaster;
|
|
bool SetFrontendType(const cChannel *Channel);
|
|
@@ -325,12 +327,16 @@
|
|
bool Locked(int TimeoutMs = 0);
|
|
int GetSignalStrength(void) const;
|
|
int GetSignalQuality(void) const;
|
|
+ bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
|
|
+private:
|
|
+ int GetCurrentDeliverySystem(void);
|
|
};
|
|
|
|
cMutex cDvbTuner::bondMutex;
|
|
|
|
cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend)
|
|
{
|
|
+ SendDiseqc = false;
|
|
frontendType = SYS_UNDEFINED;
|
|
device = Device;
|
|
fd_frontend = Fd_Frontend;
|
|
@@ -653,6 +659,35 @@
|
|
return -1;
|
|
}
|
|
|
|
+int cDvbTuner::GetCurrentDeliverySystem()
|
|
+{
|
|
+ dtv_property Frontend[1];
|
|
+ memset(&Frontend, 0, sizeof(Frontend));
|
|
+ dtv_properties CmdSeq;
|
|
+ memset(&CmdSeq, 0, sizeof(CmdSeq));
|
|
+ CmdSeq.props = Frontend;
|
|
+ Frontend[0].cmd = DTV_DELIVERY_SYSTEM;
|
|
+ Frontend[0].u.data = 0;
|
|
+ if (ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq) < 0) {
|
|
+ esyslog("ERROR: frontend %d/%d: %m", adapter, frontend);
|
|
+ return SYS_UNDEFINED;
|
|
+ }
|
|
+ return Frontend[0].u.data;
|
|
+}
|
|
+
|
|
+bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
|
|
+{
|
|
+ cMutexLock MutexLock(&mutex);
|
|
+ int frontendType = GetCurrentDeliverySystem();
|
|
+ if ((frontendType != SYS_DVBS && frontendType != SYS_DVBS2) || SendDiseqc)
|
|
+ return false;
|
|
+ diseqc_cmd=cmd;
|
|
+ SendDiseqc=true;
|
|
+ newSet.Broadcast();
|
|
+ return true;
|
|
+}
|
|
+
|
|
+
|
|
static unsigned int FrequencyToHz(unsigned int f)
|
|
{
|
|
while (f && f < 1000000)
|
|
@@ -874,6 +909,10 @@
|
|
if (GetFrontendStatus(NewStatus))
|
|
Status = NewStatus;
|
|
cMutexLock MutexLock(&mutex);
|
|
+ if (SendDiseqc) {
|
|
+ CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd));
|
|
+ SendDiseqc=false;
|
|
+ }
|
|
int WaitTime = 1000;
|
|
switch (tunerStatus) {
|
|
case tsIdle:
|
|
@@ -1571,6 +1610,11 @@
|
|
return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
|
|
}
|
|
|
|
+bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
|
|
+{
|
|
+ return dvbTuner->SendDiseqcCmd(cmd);
|
|
+}
|
|
+
|
|
void cDvbDevice::SetTransferModeForDolbyDigital(int Mode)
|
|
{
|
|
setTransferModeForDolbyDigital = Mode;
|
|
Index: b/dvbdevice.h
|
|
===================================================================
|
|
--- a/dvbdevice.h
|
|
+++ b/dvbdevice.h
|
|
@@ -196,6 +196,7 @@
|
|
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
|
|
public:
|
|
virtual bool HasLock(int TimeoutMs = 0) const;
|
|
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
|
|
|
|
// PID handle facilities
|
|
|