diff -ruN vdr-2.1.4_29/device.h vdr-2.1.4_30/device.h --- vdr-2.1.4_29/device.h 2014-01-26 14:57:30.112611716 +0100 +++ vdr-2.1.4_30/device.h 2014-01-26 15:00:34.455241207 +0100 @@ -25,6 +25,8 @@ #include "spu.h" #include "thread.h" #include "tools.h" +#include +#include #define MAXDEVICES 16 // the maximum number of devices in the system #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device @@ -344,6 +346,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 diff -ruN vdr-2.1.4_29/dvbdevice.c vdr-2.1.4_30/dvbdevice.c --- vdr-2.1.4_29/dvbdevice.c 2014-01-26 14:57:30.076613547 +0100 +++ vdr-2.1.4_30/dvbdevice.c 2014-01-26 15:00:34.459241003 +0100 @@ -285,6 +285,7 @@ private: static cMutex bondMutex; enum eTunerStatus { tsIdle, tsSet, tsPositioning, tsTuned, tsLocked }; + bool SendDiseqc; int frontendType; const cDvbDevice *device; int fd_frontend; @@ -304,6 +305,7 @@ cMutex mutex; cCondVar locked; cCondVar newSet; + dvb_diseqc_master_cmd diseqc_cmd; cDvbTuner *bondedTuner; bool bondedMaster; bool SetFrontendType(const cChannel *Channel); @@ -332,12 +334,16 @@ const cPositioner *Positioner(void) const { return positioner; } 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; @@ -664,6 +670,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) @@ -917,6 +952,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: @@ -1641,6 +1680,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; diff -ruN vdr-2.1.4_29/dvbdevice.h vdr-2.1.4_30/dvbdevice.h --- vdr-2.1.4_29/dvbdevice.h 2014-01-16 12:45:35.000000000 +0100 +++ vdr-2.1.4_30/dvbdevice.h 2014-01-26 15:00:34.459241003 +0100 @@ -241,6 +241,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