Fixed to nag about any malfunctioning firmware only once.

This commit is contained in:
Rolf Ahrenberg 2015-01-26 00:21:55 +02:00
parent 37e151b3e3
commit 73ed299ed9
7 changed files with 31 additions and 8 deletions

View File

@ -242,7 +242,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++);
cSatipServer *tmp = new cSatipServer(addrP, r, desc);
if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
info("Adding server '%s|%s|%s'%s%s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? " providing CI" : "", tmp->HasQuirk() ? " (malfunctioning firmware!)" : "");
serversM.Add(tmp);
}
else
@ -254,7 +254,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
else {
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
info("Adding server '%s|%s|%s'%s%s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? " providing CI" : "", tmp->HasQuirk() ? " (malfunctioning firmware!)" : "");
serversM.Add(tmp);
}
else
@ -325,6 +325,13 @@ bool cSatipDiscover::IsServerQuirk(cSatipServer *serverP, int quirkP)
return serversM.IsQuirk(serverP, quirkP);
}
bool cSatipDiscover::HasServerCI(cSatipServer *serverP)
{
debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
return serversM.HasCI(serverP);
}
cString cSatipDiscover::GetServerAddress(cSatipServer *serverP)
{
debug16("%s", __PRETTY_FUNCTION__);

View File

@ -81,6 +81,7 @@ public:
cString GetServerString(cSatipServer *serverP);
void UseServer(cSatipServer *serverP, int transponderP, bool onOffP);
bool IsServerQuirk(cSatipServer *serverP, int quirkP);
bool HasServerCI(cSatipServer *serverP);
cString GetServerAddress(cSatipServer *serverP);
cString GetServerList(void);
int NumProvidedSystems(void);

View File

@ -73,6 +73,7 @@ cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char
modelM((modelP && *modelP) ? modelP : "DVBS-1"),
descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"),
quirkM(eSatipQuirkNone),
hasCiM(false),
createdM(time(NULL)),
lastSeenM(0)
{
@ -94,12 +95,10 @@ cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char
strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400
)
quirkM |= eSatipQuirkForceLock;
if (quirkM != eSatipQuirkNone)
info("Malfunctioning '%s' server detected! Please, fix the firmware.", *descriptionM);
}
// These devices support the X_PMT protocol extension
if (strstr(*descriptionM, "OctopusNet")) // Digital Devices OctopusNet
quirkM |= eSatipQuirkUseXCI;
hasCiM = true;
char *s, *p = strdup(*modelM);
char *r = strtok_r(p, ",", &s);
while (r) {
@ -300,6 +299,18 @@ bool cSatipServers::IsQuirk(cSatipServer *serverP, int quirkP)
return result;
}
bool cSatipServers::HasCI(cSatipServer *serverP)
{
bool result = false;
for (cSatipServer *s = First(); s; s = Next(s)) {
if (s == serverP) {
result = s->HasCI();
break;
}
}
return result;
}
void cSatipServers::Cleanup(uint64_t intervalMsP)
{
for (cSatipServer *s = First(); s; s = Next(s)) {

View File

@ -56,6 +56,7 @@ private:
cString descriptionM;
cSatipFrontends frontendsM[eSatipFrontendCount];
int quirkM;
bool hasCiM;
time_t createdM;
cTimeMs lastSeenM;
@ -65,7 +66,6 @@ public:
eSatipQuirkSessionId = 0x01,
eSatipQuirkPlayPids = 0x02,
eSatipQuirkForceLock = 0x04,
eSatipQuirkUseXCI = 0x08,
eSatipQuirkMask = 0x0F
};
cSatipServer(const char *addressP, const char *modelP, const char *descriptionP);
@ -84,6 +84,8 @@ public:
const char *Model(void) { return *modelM; }
const char *Description() { return *descriptionM; }
bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); }
bool HasQuirk(void) { return !!quirkM; }
bool HasCI(void) { return hasCiM; }
void Update(void) { lastSeenM.Set(); }
uint64_t LastSeen(void) { return lastSeenM.Elapsed(); }
time_t Created(void) { return createdM; }
@ -99,6 +101,7 @@ public:
cSatipServer *Update(cSatipServer *serverP);
void Use(cSatipServer *serverP, int transponderP, bool onOffP);
bool IsQuirk(cSatipServer *serverP, int quirkP);
bool HasCI(cSatipServer *serverP);
void Cleanup(uint64_t intervalMsP = 0);
cString GetAddress(cSatipServer *serverP);
cString GetString(cSatipServer *serverP);

View File

@ -104,7 +104,7 @@ cSatipServerInfo::cSatipServerInfo(cSatipServer *serverP)
addressM(serverP ? serverP->Address() : "---"),
modelM(serverP ? serverP->Model() : "---"),
descriptionM(serverP ? serverP->Description() : "---"),
ciExtensionM(serverP && serverP->Quirk(cSatipServer::eSatipQuirkUseXCI) ? trVDR("yes") : trVDR("no")),
ciExtensionM(serverP && serverP->HasCI() ? trVDR("yes") : trVDR("no")),
createdM(serverP ? serverP->Created() : 0)
{
SetMenuCategory(mcSetupPlugins);

View File

@ -394,7 +394,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) &&
!isempty(*streamAddrM) && (streamIdM > 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
bool useci = (SatipConfig.GetCIExtension() && currentServerM.IsQuirk(cSatipServer::eSatipQuirkUseXCI));
bool useci = (SatipConfig.GetCIExtension() && currentServerM.HasCI());
bool usedummy = currentServerM.IsQuirk(cSatipServer::eSatipQuirkPlayPids);
if (forceP || usedummy) {
if (pidsM.Size())

View File

@ -90,6 +90,7 @@ public:
cSatipTunerServer& operator= (const cSatipTunerServer &objP) { serverM = objP.serverM; transponderM = objP.transponderM; return *this; }
bool IsValid(void) { return !!serverM; }
bool IsQuirk(int quirkP) { return (serverM && cSatipDiscover::GetInstance()->IsServerQuirk(serverM, quirkP)); }
bool HasCI(void) { return (serverM && cSatipDiscover::GetInstance()->HasServerCI(serverM)); }
void Use(bool onOffP) { if (serverM) cSatipDiscover::GetInstance()->UseServer(serverM, transponderM, onOffP); }
void Set(cSatipServer *serverP, const int transponderP) { serverM = serverP; transponderM = transponderP; }
void Reset(void) { serverM = NULL; transponderM = 0; }