Merge branch 'master' of github.com:OpenELEC/OpenELEC.tv

This commit is contained in:
Stephan Raue 2012-02-25 15:16:19 +01:00
commit 8f3b69c60a
8 changed files with 323 additions and 24 deletions

View File

@ -0,0 +1,282 @@
diff -r 442eee2f550d device-hd.c
--- a/device-hd.c Sun Oct 02 21:09:13 2011 +0200
+++ b/device-hd.c Thu Oct 13 00:15:52 2011 +0200
@@ -50,12 +50,18 @@
{
if(!initial) cCondWait::SleepMs(150);
cMutexLock lock(&cafdMutex);
+// BEGIN vdr-plugin-dynamite
+ if(fd_ca < 0) return false;
+// END vdr-plugin-dynamite
return ioctl(fd_ca,CA_SET_DESCR,ca_descr)>=0;
}
bool cScDvbHdFfDevice::SetCaPid(ca_pid_t *ca_pid)
{
cMutexLock lock(&cafdMutex);
+// BEGIN vdr-plugin-dynamite
+ if(fd_ca < 0) return false;
+// END vdr-plugin-dynamite
return ioctl(fd_ca,CA_SET_PID,ca_pid)>=0;
}
diff -r 442eee2f550d device-sd.c
--- a/device-sd.c Sun Oct 02 21:09:13 2011 +0200
+++ b/device-sd.c Thu Oct 13 00:15:52 2011 +0200
@@ -59,12 +59,18 @@
bool cScDvbSdFfDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial)
{
cMutexLock lock(&cafdMutex);
+// BEGIN vdr-plugin-dynamite
+ if(fd_ca < 0) return false;
+// END vdr-plugin-dynamite
return ioctl(fd_ca,CA_SET_DESCR,ca_descr)>=0;
}
bool cScDvbSdFfDevice::SetCaPid(ca_pid_t *ca_pid)
{
cMutexLock lock(&cafdMutex);
+// BEGIN vdr-plugin-dynamite
+ if(fd_ca < 0) return false;
+// END vdr-plugin-dynamite
return ioctl(fd_ca,CA_SET_PID,ca_pid)>=0;
}
@@ -88,6 +94,9 @@
void cScDvbSdFfDevice::DumpAV(void)
{
+// BEGIN vdr-plugin-dynamite
+ if(fd_ca < 0) return;
+// END vdr-plugin-dynamite
if(LOG(L_CORE_AV7110)) {
#define CODEBASE (0x2e000404+0x1ce00)
cMutexLock lock(&cafdMutex);
diff -r 442eee2f550d device-tmpl.c
--- a/device-tmpl.c Sun Oct 02 21:09:13 2011 +0200
+++ b/device-tmpl.c Thu Oct 13 00:15:52 2011 +0200
@@ -62,6 +62,14 @@
#else
cCam *Cam(void) { return cam; }
#endif //!SASC
+// BEGIN vdr-plugin-dynamite
+private:
+ bool lateInit;
+public:
+#ifdef __DYNAMIC_DEVICE_PROBE
+ virtual bool SetIdleDevice(bool Idle, bool TestOnly);
+#endif
+// END vdr-plugin-dynamite
};
SCDEVICE::SCDEVICE(cScDevicePlugin *DevPlugin, int Adapter, int Frontend, int cafd)
@@ -75,6 +83,9 @@
:DVBDEVICE(Adapter)
#endif //APIVERSNUM >= 10711
{
+// BEGIN vdr-plugin-dynamite
+ lateInit = false;
+// END vdr-plugin-dynamite
#ifndef SASC
tsBuffer=0; hwciadapter=0;
#endif
@@ -88,10 +99,18 @@
#ifdef SASC
cam=new cCam(this,Adapter,0,devId,devplugin,softcsa,fullts);
#endif // !SASC
+// BEGIN vdr-plugin-dynamite
+ cScDevices::AddScDevice(this);
+ if (cScDevices::AutoLateInit())
+ LateInit();
+// END vdr-plugin-dynamite
}
SCDEVICE::~SCDEVICE()
{
+// BEGIN vdr-plugin-dynamite
+ cScDevices::DelScDevice(this);
+// END vdr-plugin-dynamite
#ifndef SASC
DetachAllReceivers();
Cancel(3);
@@ -139,6 +158,9 @@
void SCDEVICE::LateInit(void)
{
+ if (lateInit)
+ return;
+ lateInit = true;
int n=CardIndex();
if(DeviceNumber()!=n)
PRINTF(L_GEN_ERROR,"CardIndex - DeviceNumber mismatch! Put SC plugin first on VDR commandline!");
@@ -155,8 +177,17 @@
if(fullts) PRINTF(L_GEN_INFO,"Enabling hybrid full-ts mode on card %s",devId);
else PRINTF(L_GEN_INFO,"Using software decryption on card %s",devId);
}
- if(fd_ca2>=0) hwciadapter=cDvbCiAdapter::CreateCiAdapter(this,fd_ca2);
- cam=new cCam(this,DVB_DEV_SPEC,devId,devplugin,softcsa,fullts);
+// BEGIN vdr-plugin-dynamite
+#ifdef __DYNAMIC_DEVICE_PROBE
+ cDevice *cidev = parentDevice ? parentDevice : this;
+#else
+// cDevice *cidev = this;
+#endif
+ if(fd_ca2>=0) hwciadapter=cDvbCiAdapter::CreateCiAdapter(cidev,fd_ca2);
+ if (cidev != this)
+ fd_ca2 = -1; // will be closed by patched cDvbCiAdapter
+ cam=new cCam(cidev,DVB_DEV_SPEC,devId,devplugin,softcsa,fullts);
+// END vdr-plugin-dynamite
}
bool SCDEVICE::HasCi(void)
@@ -225,6 +256,36 @@
return false;
}
+// BEGIN vdr-plugin-dynamite
+#ifdef __DYNAMIC_DEVICE_PROBE
+bool SCDEVICE::SetIdleDevice(bool Idle, bool TestOnly)
+{
+ if (TestOnly) {
+ if (hwciadapter)
+ return hwciadapter->SetIdle(Idle, true);
+ return DVBDEVICE::SetIdleDevice(Idle, true);
+ }
+ if (hwciadapter && !hwciadapter->SetIdle(Idle, false))
+ return false;
+ if (!DVBDEVICE::SetIdleDevice(Idle, false)) {
+ if (hwciadapter)
+ hwciadapter->SetIdle(!Idle, false);
+ return false;
+ }
+ if (Idle) {
+ if (fd_ca >= 0)
+ close(fd_ca);
+ fd_ca = -1;
+ }
+ else {
+ if (fd_ca < 0)
+ fd_ca = cScDevices::DvbOpen(DEV_DVB_CA,adapter,frontend,O_RDWR);
+ }
+ return true;
+}
+#endif
+// END vdr-plugin-dynamite
+
#endif // !SASC
#undef SCDEVICE
diff -r 442eee2f550d device.c
--- a/device.c Sun Oct 02 21:09:13 2011 +0200
+++ b/device.c Thu Oct 13 00:15:52 2011 +0200
@@ -285,6 +285,58 @@
int cScDevices::budget=0;
+// BEGIN vdr-plugin-dynamite
+// dynamite fills the vdr::cDevice::device array with vdr::plugin::dynamite::cDynamicDevice
+// we have to maintain our own list of sc-devices
+int cScDevices::numScDevices = 0;
+cDevice *cScDevices::scdevice[MAXDEVICES] = { NULL };
+bool cScDevices::autoLateInit = false;
+
+int cScDevices::NumScDevices(void)
+{
+ return numScDevices;
+}
+
+cDevice *cScDevices::GetScDevice(int CardIndex)
+{
+ for (int n = 0; n < numScDevices; n++) {
+ if (scdevice[n] && (scdevice[n]->CardIndex() == CardIndex))
+ return scdevice[n];
+ }
+ return NULL;
+}
+
+void cScDevices::AddScDevice(cDevice *Device)
+{
+ if (Device == NULL)
+ return;
+ int i = 0;
+ while ((i < numScDevices) && (i < MAXDEVICES) && (scdevice[i] != Device))
+ i++;
+ if (i < MAXDEVICES) {
+ scdevice[i] = Device;
+ if (i == numScDevices)
+ numScDevices++;
+ }
+ else
+ esyslog("too many sc-devices!");
+}
+
+void cScDevices::DelScDevice(cDevice *Device)
+{
+ if (Device == NULL)
+ return;
+ int i = 0;
+ while ((i < numScDevices) && (i < MAXDEVICES)) {
+ if (scdevice[i] == Device) {
+ scdevice[i] = NULL;
+ break;
+ }
+ i++;
+ }
+}
+// END vdr-plugin-dynamite
+
void cScDevices::DvbName(const char *Name, int a, int f, char *buffer, int len)
{
snprintf(buffer,len,"%s%d/%s%d",DEV_DVB_ADAPTER,a,Name,f);
@@ -393,17 +445,22 @@
{
if(ScSetup.ForceTransfer)
SetTransferModeForDolbyDigital(2);
- for(int n=cDevice::NumDevices(); --n>=0;) {
- cDevice *dev=cDevice::GetDevice(n);
+// BEGIN vdr-plugin-dynamite
+ for(int n=NumScDevices(); --n>=0;) {
+ cDevice *dev=GetScDevice(n);
for(cScDevicePlugin *dp=devplugins.First(); dp; dp=devplugins.Next(dp))
if(dp->LateInit(dev)) break;
}
+ autoLateInit = true;
+// END vdr-plugin-dynamite
}
void cScDevices::Shutdown(void)
{
- for(int n=cDevice::NumDevices(); --n>=0;) {
- cDevice *dev=cDevice::GetDevice(n);
+// BEGIN vdr-plugin-dynamite
+ for(int n=NumScDevices(); --n>=0;) {
+ cDevice *dev=GetScDevice(n);
+// END vdr-plugin-dynamite
for(cScDevicePlugin *dp=devplugins.First(); dp; dp=devplugins.Next(dp))
if(dp->EarlyShutdown(dev)) break;
}
diff -r 442eee2f550d device.h
--- a/device.h Sun Oct 02 21:09:13 2011 +0200
+++ b/device.h Thu Oct 13 00:15:52 2011 +0200
@@ -84,6 +84,21 @@
static bool ForceBudget(int n);
static void DvbName(const char *Name, int a, int f, char *buffer, int len);
static int DvbOpen(const char *Name, int a, int f, int Mode, bool ReportError=false);
+
+// BEGIN vdr-plugin-dynamite
+// dynamite fills the vdr::cDevice::device array with vdr::plugin::dynamite::cDynamicDevice
+// we have to maintain our own list of sc-devices
+private:
+ static int numScDevices;
+ static cDevice *scdevice[MAXDEVICES];
+ static bool autoLateInit;
+public:
+ static int NumScDevices(void);
+ static cDevice *GetScDevice(int CardIndex);
+ static void AddScDevice(cDevice *Device);
+ static void DelScDevice(cDevice *Device);
+ static bool AutoLateInit() { return autoLateInit; };
+// END vdr-plugin-dynamite
};
// ----------------------------------------------------------------

View File

@ -20,7 +20,7 @@
################################################################################
PKG_NAME="vdr"
PKG_VERSION="1.7.22"
PKG_VERSION="1.7.24"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"

View File

@ -1,3 +1,16 @@
diff --git a/ci.c b/ci.c
index 59d62ef..6c5face 100644
--- a/ci.c
+++ b/ci.c
@@ -1571,6 +1571,8 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter)
cCamSlot::~cCamSlot()
{
+ if (ciAdapter && ciAdapter->assignedDevice)
+ ciAdapter->assignedDevice->SetCamSlot(NULL);
CamSlots.Del(this, false);
DeleteAllConnections();
}
diff --git a/ci.h b/ci.h
index 71bbdf9..70303d1 100644
--- a/ci.h
@ -574,9 +587,9 @@ diff --git a/dvbdevice.c b/dvbdevice.c
index 163fce3..fd3f212 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -280,12 +280,16 @@ private:
bool bondedMaster;
@@ -305,12 +305,16 @@ private:
bool bondedMasterFailed;
bool SetFrontendType(const cChannel *Channel);
cString GetBondingParams(const cChannel *Channel = NULL) const;
- void ClearEventQueue(void) const;
- bool GetFrontendStatus(fe_status_t &Status) const;
@ -591,9 +604,9 @@ index 163fce3..fd3f212 100644
+ bool OpenFrontend(void);
+ bool CloseFrontend(void);
public:
cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType);
cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend);
virtual ~cDvbTuner();
@@ -298,8 +302,11 @@ public:
@@ -323,8 +327,11 @@ public:
bool IsTunedTo(const cChannel *Channel) const;
void SetChannel(const cChannel *Channel);
bool Locked(int TimeoutMs = 0);
@ -607,15 +620,15 @@ index 163fce3..fd3f212 100644
};
cMutex cDvbTuner::bondMutex;
@@ -321,6 +328,7 @@ cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int
@@ -346,6 +353,7 @@ cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int
bondedTuner = NULL;
bondedMaster = false;
bondedMasterFailed = false;
+ isIdle = false;
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
ResetToneAndVoltage(); // must explicitly turn on LNB power
SetDescription("tuner on frontend %d/%d", adapter, frontend);
@@ -340,6 +348,8 @@ cDvbTuner::~cDvbTuner()
Start();
}
@@ -363,6 +371,8 @@ cDvbTuner::~cDvbTuner()
ExecuteDiseqc(lastDiseqc, &Frequency);
}
*/
@ -645,7 +658,7 @@ index 163fce3..fd3f212 100644
{
ClearEventQueue();
while (1) {
@@ -522,7 +534,7 @@ bool cDvbTuner::GetFrontendStatus(fe_status_t &Status) const
@@ -541,7 +553,7 @@ bool cDvbTuner::GetFrontendStatus(fe_status_t &Status) const
//#define DEBUG_SIGNALSTRENGTH
//#define DEBUG_SIGNALQUALITY
@ -654,7 +667,7 @@ index 163fce3..fd3f212 100644
{
ClearEventQueue();
uint16_t Signal;
@@ -549,7 +561,7 @@ int cDvbTuner::GetSignalStrength(void) const
@@ -568,7 +580,7 @@ int cDvbTuner::GetSignalStrength(void) const
#define LOCK_THRESHOLD 5 // indicates that all 5 FE_HAS_* flags are set
@ -663,7 +676,7 @@ index 163fce3..fd3f212 100644
{
fe_status_t Status;
if (GetFrontendStatus(Status)) {
@@ -664,6 +676,8 @@ void cDvbTuner::ResetToneAndVoltage(void)
@@ -708,6 +720,8 @@ static int GetRequiredDeliverySystem(const cChannel *Channel, const cDvbTranspon
bool cDvbTuner::SetFrontend(void)
{
@ -672,7 +685,7 @@ index 163fce3..fd3f212 100644
#define MAXFRONTENDCMDS 16
#define SETCMD(c, d) { Frontend[CmdSeq.num].cmd = (c);\
Frontend[CmdSeq.num].u.data = (d);\
@@ -809,9 +823,11 @@ void cDvbTuner::Action(void)
@@ -853,9 +867,11 @@ void cDvbTuner::Action(void)
bool LostLock = false;
fe_status_t Status = (fe_status_t)0;
while (Running()) {
@ -687,7 +700,7 @@ index 163fce3..fd3f212 100644
cMutexLock MutexLock(&mutex);
switch (tunerStatus) {
case tsIdle:
@@ -867,6 +883,42 @@ void cDvbTuner::Action(void)
@@ -911,6 +927,40 @@ void cDvbTuner::Action(void)
}
}
@ -709,8 +722,6 @@ index 163fce3..fd3f212 100644
+ fd_frontend = cDvbDevice::DvbOpen(DEV_DVB_FRONTEND, adapter, frontend, O_RDWR | O_NONBLOCK);
+ if (fd_frontend < 0)
+ return false;
+ if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
+ ResetToneAndVoltage(); // must explicitly turn on LNB power
+ isIdle = false;
+ return true;
+}
@ -730,7 +741,7 @@ index 163fce3..fd3f212 100644
// --- cDvbSourceParam -------------------------------------------------------
class cDvbSourceParam : public cSourceParam {
@@ -948,7 +1000,8 @@ const char *DeliverySystems[] = {
@@ -996,7 +1046,8 @@ const char *DeliverySystemNames[] = {
NULL
};
@ -740,7 +751,7 @@ index 163fce3..fd3f212 100644
{
adapter = Adapter;
frontend = Frontend;
@@ -967,7 +1020,7 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
@@ -1015,7 +1066,7 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
fd_ca = DvbOpen(DEV_DVB_CA, adapter, frontend, O_RDWR);
if (fd_ca >= 0)
@ -760,8 +771,8 @@ index 163fce3..fd3f212 100644
+ Device2 = Device2->SubDevice();
if (cDvbDevice *DvbDevice1 = dynamic_cast<cDvbDevice *>(Device1)) {
if (cDvbDevice *DvbDevice2 = dynamic_cast<cDvbDevice *>(Device2)) {
if (!DvbDevice2->Bond(DvbDevice1))
@@ -1157,7 +1214,10 @@ bool cDvbDevice::BondDevices(const char *Bondings)
if (!DvbDevice1->Bond(DvbDevice2))
@@ -1242,7 +1297,10 @@ bool cDvbDevice::BondDevices(const char *Bondings)
void cDvbDevice::UnBondDevices(void)
{
for (int i = 0; i < cDevice::NumDevices(); i++) {
@ -822,13 +833,15 @@ index 2072ab2..d9f6e8d 100644
static cString DvbName(const char *Name, int Adapter, int Frontend);
static int DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError = false);
private:
@@ -126,9 +126,11 @@ private:
cDvbDevice *bondedDevice;
@@ -132,11 +132,13 @@ private:
mutable bool needsDetachBondedReceivers;
bool QueryDeliverySystems(int fd_frontend);
public:
- cDvbDevice(int Adapter, int Frontend);
+ cDvbDevice(int Adapter, int Frontend, cDevice *ParentDevice = NULL);
virtual ~cDvbDevice();
int Adapter(void) const { return adapter; }
int Frontend(void) const { return frontend; }
virtual bool Ready(void);
+ virtual bool SetIdleDevice(bool Idle, bool TestOnly);
+

View File

@ -1,3 +1,7 @@
2.0.5
- update to vdr-1.7.24
- sc now works without the need to disable dynamite plugin
2.0.4
- start userspace DVB drivers before VDR

View File

@ -21,7 +21,7 @@
PKG_NAME="vdr-addon"
PKG_VERSION="2.0"
PKG_REV="4"
PKG_REV="5"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.openelec.tv"

View File

@ -66,5 +66,5 @@ if [ ! $(pidof vdr.bin) ];then
. $driver_dvb
done
LD_LIBRARY_PATH="$ADDON_DIR/lib:$LD_LIBRARY_PATH" vdr.bin $VDR_ARG &>$LOG_FILE
LANG=en_US.UTF-8 LD_LIBRARY_PATH="$ADDON_DIR/lib:$LD_LIBRARY_PATH" vdr.bin $VDR_ARG &>$LOG_FILE
fi