diff -ruN vdr-2.0.2-org/device.h vdr-2.0.3/device.h --- vdr-2.0.2-org/device.h 2013-09-04 21:45:47.000000000 +0200 +++ vdr-2.0.3/device.h 2013-09-04 21:48:17.000000000 +0200 @@ -24,6 +24,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 @@ -333,6 +335,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.0.2-org/dvbdevice.c vdr-2.0.3/dvbdevice.c --- vdr-2.0.2-org/dvbdevice.c 2013-09-04 21:45:47.000000000 +0200 +++ vdr-2.0.3/dvbdevice.c 2013-09-04 21:50:21.183000090 +0200 @@ -285,6 +285,7 @@ private: static cMutex bondMutex; enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked }; + bool SendDiseqc; int frontendType; const cDvbDevice *device; mutable int fd_frontend; @@ -301,6 +302,7 @@ mutable cMutex mutex; cCondVar locked; cCondVar newSet; + dvb_diseqc_master_cmd diseqc_cmd; cDvbTuner *bondedTuner; bool bondedMaster; bool SetFrontendType(const cChannel *Channel); @@ -333,12 +335,16 @@ int GetSignalQuality(void) const; bool SetIdle(bool Idle); bool IsIdle(void) const { return isIdle; } + 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; @@ -666,6 +672,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) @@ -889,6 +924,10 @@ 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: @@ -1656,6 +1695,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.0.2-org/dvbdevice.h vdr-2.0.3/dvbdevice.h --- vdr-2.0.2-org/dvbdevice.h 2013-09-04 21:45:47.000000000 +0200 +++ vdr-2.0.3/dvbdevice.h 2013-09-04 21:48:17.000000000 +0200 @@ -243,6 +243,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