diff -Nur old/device.h new/device.h --- old/device.h 2009-05-02 15:16:20.000000000 +0300 +++ new/device.h 2009-05-25 22:36:04.640136000 +0300 @@ -24,6 +24,7 @@ #include "spu.h" #include "thread.h" #include "tools.h" +#include #define MAXDEVICES 16 // the maximum number of devices in the system #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device @@ -274,6 +275,7 @@ virtual bool HasProgramme(void); ///< 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 -Nur old/dvbdevice.c new/dvbdevice.c --- old/dvbdevice.c 2009-05-03 16:49:41.000000000 +0300 +++ new/dvbdevice.c 2009-05-25 22:42:51.139443000 +0300 @@ -71,6 +71,7 @@ class cDvbTuner : public cThread { private: enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked }; + bool SendDiseqc; int fd_frontend; int cardIndex; int tuneTimeout; @@ -83,6 +84,7 @@ cMutex mutex; cCondVar locked; cCondVar newSet; + dvb_diseqc_master_cmd diseqc_cmd; bool GetFrontendStatus(fe_status_t &Status, int TimeoutMs = 0); bool SetFrontend(void); virtual void Action(void); @@ -91,12 +93,14 @@ virtual ~cDvbTuner(); bool IsTunedTo(const cChannel *Channel) const; void Set(const cChannel *Channel, bool Tune); + bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd); bool Locked(int TimeoutMs = 0); }; cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_delivery_system FrontendType) { fd_frontend = Fd_Frontend; + SendDiseqc = false; cardIndex = CardIndex; frontendType = FrontendType; tuneTimeout = 0; @@ -163,6 +167,17 @@ return tunerStatus >= tsLocked; } +bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd) +{ + cMutexLock MutexLock(&mutex); + if ((!SYS_DVBS & !SYS_DVBS2) || SendDiseqc) + return false; + diseqc_cmd = cmd; + SendDiseqc = true; + newSet.Broadcast(); + return true; +} + bool cDvbTuner::GetFrontendStatus(fe_status_t &Status, int TimeoutMs) { if (TimeoutMs) { @@ -341,6 +356,10 @@ if (GetFrontendStatus(NewStatus, 10)) Status = NewStatus; cMutexLock MutexLock(&mutex); + if (SendDiseqc) { + CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd)); + SendDiseqc = false; + } switch (tunerStatus) { case tsIdle: break; @@ -1009,6 +1028,11 @@ return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false; } +bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd) +{ + return dvbTuner->SendDiseqcCmd(cmd); +} + int cDvbDevice::GetAudioChannelDevice(void) { if (HasDecoder()) { diff -Nur old/dvbdevice.h new/dvbdevice.h --- old/dvbdevice.h 2009-05-02 13:44:40.000000000 +0300 +++ new/dvbdevice.h 2009-05-25 22:43:32.045127000 +0300 @@ -74,6 +74,7 @@ virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView); public: virtual bool HasLock(int TimeoutMs = 0); + virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd); // PID handle facilities