void LG::InitSerial(const char *device) { ssize_t r = 0; if (fd != -1) return; dsyslog("lgcontrol: open: %s\n", device); fd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK); if (fd < 0) { dsyslog("lgcontrol: Cannot open: %s\n", device); return; } tcflush(fd, TCIOFLUSH); struct termios tios; memset(&tios, 0, sizeof(tios)); cfsetispeed(&tios, baudrate); cfsetospeed(&tios, baudrate); tios.c_cflag = CS8 | CLOCAL | CREAD; tios.c_iflag = IGNPAR | IGNBRK | IXANY; tios.c_lflag = ISIG; tios.c_cc[VMIN] = 0; tios.c_cc[VTIME] = 0; tcsetattr(fd, TCSANOW, &tios); tcflush(fd, TCIOFLUSH); r=write(fd, "\r", 1); r=r; }
void I18nInitialize(const char *LocaleDir) { I18nLocaleDir = LocaleDir; LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE)); LanguageNames.Append(strdup(SkipContext(LanguageName))); LanguageCodes.Append(strdup(LanguageCodeList[0])); textdomain("vdr"); bindtextdomain("vdr", I18nLocaleDir); cFileNameList Locales(I18nLocaleDir, true); if (Locales.Size() > 0) { char *OldLocale = strdup(setlocale(LC_MESSAGES, NULL)); for (int i = 0; i < Locales.Size(); i++) { cString FileName = cString::sprintf("%s/%s/LC_MESSAGES/vdr.mo", *I18nLocaleDir, Locales[i]); if (access(FileName, F_OK) == 0) { // found a locale with VDR texts if (NumLocales < I18N_MAX_LANGUAGES - 1) { SetEnvLanguage(Locales[i]); const char *TranslatedLanguageName = gettext(LanguageName); if (TranslatedLanguageName != LanguageName) { NumLocales++; if (strstr(OldLocale, Locales[i]) == OldLocale) CurrentLanguage = LanguageLocales.Size(); LanguageLocales.Append(strdup(Locales[i])); LanguageNames.Append(strdup(TranslatedLanguageName)); const char *Code = gettext(LanguageCode); for (const char **lc = LanguageCodeList; *lc; lc++) { if (ContainsCode(*lc, Code)) { Code = *lc; break; } } LanguageCodes.Append(strdup(Code)); } } else { esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!"); break; } } } SetEnvLanguage(LanguageLocales[CurrentLanguage]); free(OldLocale); dsyslog("found %d locales in %s", NumLocales - 1, *I18nLocaleDir); } // Prepare any known language codes for which there was no locale: for (const char **lc = LanguageCodeList; *lc; lc++) { bool Found = false; for (int i = 0; i < LanguageCodes.Size(); i++) { if (strcmp(*lc, LanguageCodes[i]) == 0) { Found = true; break; } } if (!Found) { dsyslog("no locale for language code '%s'", *lc); LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE)); LanguageNames.Append(strdup(*lc)); LanguageCodes.Append(strdup(*lc)); } } }
OM_uint32 ntlm_gss_inquire_cred( OM_uint32 *minor_status, gss_cred_id_t cred_handle, gss_name_t *name, OM_uint32 *lifetime, int *cred_usage, gss_OID_set *mechanisms) { OM_uint32 status = 0; ntlm_gss_cred_id_t ntlm_cred_handle = NULL; gss_name_t ret_name = NULL; dsyslog("Entering inquire_cred\n"); ntlm_cred_handle = (ntlm_gss_cred_id_t) cred_handle; if (ntlm_cred_handle && ntlm_cred_handle->name && name) { status = gss_duplicate_name( minor_status, ntlm_cred_handle->name, &ret_name); if (status == 0) { *name = ret_name; } } dsyslog("Leaving inquire_cred\n"); return (status); }
bool cServerConnection::ProvidesChannel(const cChannel *Channel, int Priority) { cDevice *device = CheckDevice(Channel, Priority, false); if (!device || (StreamdevServerSetup.SuspendMode != smAlways && !device->IsTunedToTransponder(Channel) && UsedByLiveTV(device))) { // no device available or the device is in use for live TV and suspend mode doesn't allow us to switch it: // maybe a device would be free if THIS connection did turn off its streams? Detach(); device = CheckDevice(Channel, Priority, false); Attach(); if (device && StreamdevServerSetup.SuspendMode != smAlways && !device->IsTunedToTransponder(Channel) && UsedByLiveTV(device)) { // now we would have to switch away live tv...let's see if live tv // can be handled by another device const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel()); cDevice *newdev = current ? CheckDevice(current, 0, true, device) : NULL; if (newdev) { dsyslog("streamdev: Providing channel %d (%s) at priority %d requires moving live TV to device %d (PrimaryDevice=%d, ActualDevice=%d)", Channel->Number(), Channel->Name(), Priority, newdev->CardIndex(), cDevice::PrimaryDevice()->CardIndex(), cDevice::ActualDevice()->CardIndex()); } else { device = NULL; dsyslog("streamdev: Not providing channel %d (%s) at priority %d - live TV not suspended", Channel->Number(), Channel->Name(), Priority); } } else if (!device) dsyslog("streamdev: No device provides channel %d (%s) at priority %d", Channel->Number(), Channel->Name(), Priority); } return device; }
void mailfor(char *name) { struct utmp *utp = &utmp[nutmp]; char utname[UT_NAMESIZE+1]; const char *errstr; char *cp; off_t offset; dsyslog(LOG_DEBUG, "mail for '%s'", name); if (!(cp = strchr(name, '@'))) return; *cp++ = '\0'; cp[strcspn(cp, " \t\n")] = '\0'; offset = strtonum(cp, 0, LLONG_MAX, &errstr); if (errstr) { syslog(LOG_ERR, "'%s' is %s", cp + 1, errstr); return; } while (--utp >= utmp) { memcpy(utname, utp->ut_name, UT_NAMESIZE); utname[UT_NAMESIZE] = '\0'; dsyslog(LOG_DEBUG, "check %s against %s", name, utname); if (!strncmp(utname, name, UT_NAMESIZE)) notify(utp, offset); } }
void cGlobals::ListCustomTokens(void) { for (map<string, string>::iterator it = customStringTokens.begin(); it != customStringTokens.end(); it++) { dsyslog("skindesigner: custom string token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str()); } for (map<string, int>::iterator it = customIntTokens.begin(); it != customIntTokens.end(); it++) { dsyslog("skindesigner: custom int token \"%s\" = \"%d\"", (it->first).c_str(), it->second); } }
void ReportEpgBugFixStats(bool Force) { if (Setup.EPGBugfixLevel > 0) { static time_t LastReport = 0; time_t now = time(NULL); if (now - LastReport > 3600 || Force) { LastReport = now; struct tm tm_r; struct tm *ptm = localtime_r(&now, &tm_r); if (ptm->tm_hour != 5) return; } else return; bool GotHits = false; char buffer[1024]; for (int i = 0; i < MAXEPGBUGFIXSTATS; i++) { const char *delim = " "; tEpgBugFixStats *p = &EpgBugFixStats[i]; if (p->hits) { bool PrintedStats = false; char *q = buffer; *buffer = 0; for (int c = 0; c < p->n; c++) { cChannel *channel = Channels.GetByChannelID(p->channelIDs[c], true); if (channel) { if (!GotHits) { dsyslog("====================="); dsyslog("EPG bugfix statistics"); dsyslog("====================="); dsyslog("IF SOMEBODY WHO IS IN CHARGE OF THE EPG DATA FOR ONE OF THE LISTED"); dsyslog("CHANNELS READS THIS: PLEASE TAKE A LOOK AT THE FUNCTION cEvent::FixEpgBugs()"); dsyslog("IN VDR/epg.c TO LEARN WHAT'S WRONG WITH YOUR DATA, AND FIX IT!"); dsyslog("====================="); dsyslog("Fix Hits Channels"); GotHits = true; } if (!PrintedStats) { q += snprintf(q, sizeof(buffer) - (q - buffer), "%-3d %-4d", i, p->hits); PrintedStats = true; } q += snprintf(q, sizeof(buffer) - (q - buffer), "%s%s", delim, channel->Name()); delim = ", "; if (q - buffer > 80) { q += snprintf(q, sizeof(buffer) - (q - buffer), "%s...", delim); break; } } } if (*buffer) dsyslog("%s", buffer); } p->hits = p->n = 0; } if (GotHits) dsyslog("====================="); } }
void cTransfer::Action(void) { int PollTimeouts = 0; uchar *p = NULL; int Result = 0; while (Running()) { int Count; uchar *b = ringBuffer->Get(Count); if (b) { if (ringBuffer->Available() > TRANSFERBUFSIZE * 9 / 10) { // If the buffer runs full, we have no chance of ever catching up // since the data comes in at the same rate as it goes out (it's "live"). // So let's clear the buffer instead of suffering from permanent // overflows. dsyslog("clearing transfer buffer to avoid overflows"); DeviceClear(); ringBuffer->Clear(); remux->Clear(); PlayPes(NULL, 0); p = NULL; continue; } Count = remux->Put(b, Count); if (Count) ringBuffer->Del(Count); } if (!p) p = remux->Get(Result); if (p) { cPoller Poller; if (DevicePoll(Poller, 100)) { PollTimeouts = 0; int w = PlayPes(p, Result); if (w > 0) { p += w; Result -= w; remux->Del(w); if (Result <= 0) p = NULL; } else if (w < 0 && FATALERRNO) LOG_ERROR; } else { PollTimeouts++; if (PollTimeouts == POLLTIMEOUTS_BEFORE_DEVICECLEAR) { dsyslog("clearing device because of consecutive poll timeouts"); DeviceClear(); ringBuffer->Clear(); remux->Clear(); PlayPes(NULL, 0); p = NULL; } } } } }
void cExtRecInfo::Debug(void) { dsyslog("skindesigner: extRecInfo xml: %s", xml.c_str()); dsyslog("skindesigner: : res_width %d, res_height %d, res %s, aspectratio %s, codec %s, format %s, framerate %s, interlace %s, hd %s, widescreen %s", resWidth, resHeight, resString.c_str(), aspectratio.c_str(), codec.c_str(), format.c_str(), framerate.c_str(), interlace.c_str(), isHD ? "true": "false", isWideScreen ? "true" : "false"); int numTrack = 1; for (vector<tAudioTrack>::iterator it = tracks.begin(); it != tracks.end(); it++) { dsyslog("skindesigner: audio track %d, codec %s, bitrate %s, language: %s", numTrack++, (*it).codec.c_str(), (*it).bitrate.c_str(), (*it).language.c_str()); } }
int cSkins::QueueMessage(eMessageType Type, const char *s, int Seconds, int Timeout) { if (Type == mtStatus) { dsyslog("cSkins::QueueMessage() called with mtStatus - ignored!"); return kNone; } if (isempty(s)) { if (!cThread::IsMainThread()) { queueMessageMutex.Lock(); for (cSkinQueuedMessage *m = SkinQueuedMessages.Last(); m; m = SkinQueuedMessages.Prev(m)) { if (m->threadId == cThread::ThreadId() && m->state == 0) m->state = 2; // done } queueMessageMutex.Unlock(); } else dsyslog("cSkins::QueueMessage() called with empty message from main thread - ignored!"); return kNone; } int k = kNone; if (Timeout > 0) { if (cThread::IsMainThread()) { dsyslog("cSkins::QueueMessage() called from main thread with Timeout = %d - ignored!", Timeout); return k; } cSkinQueuedMessage *m = new cSkinQueuedMessage(Type, s, Seconds, Timeout); queueMessageMutex.Lock(); SkinQueuedMessages.Add(m); m->mutex.Lock(); queueMessageMutex.Unlock(); if (m->condVar.TimedWait(m->mutex, Timeout * 1000)) k = m->key; else k = -1; // timeout, nothing has been displayed m->state = 2; // done m->mutex.Unlock(); } else { queueMessageMutex.Lock(); // Check if there is a waiting message w/o timeout for this thread: if (Timeout == -1) { for (cSkinQueuedMessage *m = SkinQueuedMessages.Last(); m; m = SkinQueuedMessages.Prev(m)) { if (m->threadId == cThread::ThreadId()) { if (m->state == 0 && m->timeout == -1) m->state = 2; // done break; } } } // Add the new message: SkinQueuedMessages.Add(new cSkinQueuedMessage(Type, s, Seconds, Timeout)); queueMessageMutex.Unlock(); } return k; }
void *cThread::StartThread(cThread *Thread) { if (Thread->description) dsyslog("%s thread started (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self()); Thread->Action(); if (Thread->description) dsyslog("%s thread ended (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self()); Thread->running = false; Thread->active = false; return NULL; }
void cStatusTest::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) { char buffer[25]; struct tm tm_r; dsyslog("status: cStatusTest::OsdProgramme"); strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r)); dsyslog("%5s %s", buffer, PresentTitle); dsyslog("%5s %s", "", PresentSubtitle); strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r)); dsyslog("%5s %s", buffer, FollowingTitle); dsyslog("%5s %s", "", FollowingSubtitle); }
static int sem_wait_timeout(sem_t *sem,int timeout) { int i; dsyslog(LOG_INFO,"sem_wait_timeout: timeout=%d\n",timeout); for (i = 0; i < timeout; i++) { if (sem_trywait(sem) != 0) return 0; usleep(1000); } dsyslog(LOG_INFO,"timeout waiting for transmitter\n",timeout); return 1; }
void cGlobals::Debug(void) { dsyslog("skindesigner: GLOBAL VARIABLES"); for (map <string, tColor>::iterator col = colors.begin(); col != colors.end(); col++) { dsyslog("skindesigner: Color \"%s\": %x", (col->first).c_str(), col->second); } for (map <string, int>::iterator myInt = intVars.begin(); myInt != intVars.end(); myInt++) { dsyslog("skindesigner: Integer Variable \"%s\": %d", (myInt->first).c_str(), myInt->second); } for (map <string, double>::iterator myDouble = doubleVars.begin(); myDouble != doubleVars.end(); myDouble++) { dsyslog("skindesigner: Double Variable \"%s\": %f", (myDouble->first).c_str(), myDouble->second); } for (map <string, string>::iterator myStr = stringVars.begin(); myStr != stringVars.end(); myStr++) { dsyslog("skindesigner: String Variable \"%s\": \"%s\"", (myStr->first).c_str(), (myStr->second).c_str()); } for (map <string, string>::iterator font = fonts.begin(); font != fonts.end(); font++) { dsyslog("skindesigner: Font \"%s\": \"%s\"", (font->first).c_str(), (font->second).c_str()); } for (map <string, map< string, string > >::iterator trans = translations.begin(); trans != translations.end(); trans++) { dsyslog("skindesigner: Translation Token %s", (trans->first).c_str()); map< string, string > tokenTrans = trans->second; for (map< string, string >::iterator transTok = tokenTrans.begin(); transTok != tokenTrans.end(); transTok++) { dsyslog("skindesigner: language %s, translation %s", (transTok->first).c_str(), (transTok->second).c_str()); } } }
// returns ack if received before timeout // returns 0 if timeout static int waitforack(int timeout) { int i; dsyslog(LOG_INFO,"waitforack: timeout %d\n",timeout); for (i = 0; i < timeout; i++){ if (sem_trywait(&sem_ack) == 0){ dsyslog(LOG_INFO,"received ACK/NAK\n"); return ack; } usleep(1000); } return 0; }
/*ARGSUSED*/ OM_uint32 ntlm_gss_release_name( OM_uint32 *minor_status, gss_name_t *input_name) { OM_uint32 status = 0; dsyslog("Entering release_name\n"); status = gss_release_name(minor_status, input_name); dsyslog("Leaving release_name\n"); return (status); }
/*ARGSUSED*/ OM_uint32 ntlm_gss_compare_name( OM_uint32 *minor_status, const gss_name_t name1, const gss_name_t name2, int *name_equal) { OM_uint32 status = GSS_S_COMPLETE; dsyslog("Entering compare_name\n"); status = gss_compare_name(minor_status, name1, name2, name_equal); dsyslog("Leaving compare_name\n"); return (status); }
void ReportEpgBugFixStats(bool Reset) { if (Setup.EPGBugfixLevel > 0) { bool GotHits = false; char buffer[1024]; for (int i = 0; i < MAXEPGBUGFIXSTATS; i++) { const char *delim = "\t"; tEpgBugFixStats *p = &EpgBugFixStats[i]; if (p->hits) { bool PrintedStats = false; char *q = buffer; *buffer = 0; for (int c = 0; c < p->n; c++) { cChannel *channel = Channels.GetByChannelID(p->channelIDs[c], true); if (channel) { if (!GotHits) { dsyslog("====================="); dsyslog("EPG bugfix statistics"); dsyslog("====================="); dsyslog("IF SOMEBODY WHO IS IN CHARGE OF THE EPG DATA FOR ONE OF THE LISTED"); dsyslog("CHANNELS READS THIS: PLEASE TAKE A LOOK AT THE FUNCTION cEvent::FixEpgBugs()"); dsyslog("IN VDR/epg.c TO LEARN WHAT'S WRONG WITH YOUR DATA, AND FIX IT!"); dsyslog("====================="); dsyslog("Fix\tHits\tChannels"); GotHits = true; } if (!PrintedStats) { q += snprintf(q, sizeof(buffer) - (q - buffer), "%d\t%d", i, p->hits); PrintedStats = true; } q += snprintf(q, sizeof(buffer) - (q - buffer), "%s%s", delim, channel->Name()); delim = ", "; if (q - buffer > 80) { q += snprintf(q, sizeof(buffer) - (q - buffer), "%s...", delim); break; } } } if (*buffer) dsyslog("%s", buffer); } if (Reset) p->hits = p->n = 0; } if (GotHits) dsyslog("====================="); } }
cDevice *cServerConnection::GetDevice(const cChannel *Channel, int Priority) { // turn off the streams of this connection Detach(); // This call may detach receivers of the device it returns cDevice *device = cDevice::GetDevice(Channel, Priority, false); if (device && !device->IsTunedToTransponder(Channel) && UsedByLiveTV(device)) { // now we would have to switch away live tv...let's see if live tv // can be handled by another device #if VDRVERSNUM >= 10516 cDevice::SetAvoidDevice(device); if (!Channels.SwitchTo(cDevice::CurrentChannel())) { if (StreamdevServerSetup.SuspendMode == smAlways) { Channels.SwitchTo(Channel->Number()); Skins.QueueMessage(mtInfo, tr("Streaming active")); } else { dsyslog("streamdev: GetDevice: Live TV not suspended"); device = NULL; } } #else const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel()); cDevice *newdev = current ? CheckDevice(current, 0, true, device) : NULL; if (newdev) { dsyslog("streamdev: GetDevice: Trying to move live TV to device %d", newdev->CardIndex()); newdev->SwitchChannel(current, true); } else if (StreamdevServerSetup.SuspendMode == smAlways) { Channels.SwitchTo(Channel->Number()); Skins.QueueMessage(mtInfo, tr("Streaming active")); } else { dsyslog("streamdev: GetDevice: Live TV not suspended"); device = NULL; } #endif } if (!device) { // can't switch - continue the current stream Attach(); dsyslog("streamdev: GetDevice failed for channel %d (%s) at priority %d (PrimaryDevice=%d, ActualDevice=%d)", Channel->Number(), Channel->Name(), Priority, cDevice::PrimaryDevice()->CardIndex(), cDevice::ActualDevice()->CardIndex()); } return device; }
OM_uint32 srp_gss_release_cred(OM_uint32 *minor_status, gss_cred_id_t *cred_handle) { OM_uint32 status = 0; OM_uint32 min = 0; srp_gss_cred_id_t srp_cred = NULL; dsyslog("Entering srp_gss_release_cred\n"); if (minor_status == NULL || cred_handle == NULL) { return (GSS_S_CALL_INACCESSIBLE_WRITE); } *minor_status = 0; if (*cred_handle == GSS_C_NO_CREDENTIAL) { return (GSS_S_COMPLETE); } srp_cred = (srp_gss_cred_id_t) *cred_handle; if (srp_cred->srp_mech_oid) { if (srp_cred->srp_mech_oid->elements) { gssalloc_free(srp_cred->srp_mech_oid->elements); } gssalloc_free(srp_cred->srp_mech_oid); } if (srp_cred->name) { gss_release_name(&min, &srp_cred->name); } if (srp_cred->password) { gss_release_buffer(&min, srp_cred->password); gssalloc_free(srp_cred->password); } gssalloc_free(srp_cred); *cred_handle = NULL; dsyslog("Leaving srp_gss_release_cred\n"); return (status); }
bool cChannel::SetTransponderData(int Source, int Frequency, int Srate, const char *Parameters, bool Quiet) { if (strchr(Parameters, ':')) { esyslog("ERROR: parameter string '%s' contains ':'", Parameters); return false; } // Workarounds for broadcaster stupidity: // Some providers broadcast the transponder frequency of their channels with two different // values (like 12551 and 12552), so we need to allow for a little tolerance here if (abs(frequency - Frequency) <= 1) Frequency = frequency; // Sometimes the transponder frequency is set to 0, which is just wrong if (Frequency == 0) return false; // Sometimes the symbol rate is off by one if (abs(srate - Srate) <= 1) Srate = srate; if (source != Source || frequency != Frequency || srate != Srate || strcmp(parameters, Parameters)) { cString OldTransponderData = TransponderDataToString(); source = Source; frequency = Frequency; srate = Srate; parameters = Parameters; schedule = NULL; if (Number() && !Quiet) { dsyslog("changing transponder data of channel %d from %s to %s", Number(), *OldTransponderData, *TransponderDataToString()); modification |= CHANNELMOD_TRANSP; Channels.SetModified(); } } return true; }
void cBlockDevice::CheckIfRootDevice(void) { #ifdef RBMINI /** the internal usb stick is on usb bus nr. 2 and is device nr. 4 */ dsyslog("setup: checking if \"/dev/sd%c\" is the internal usb-stick: %i\n", letter_, internal_); char buf[256]; std::string path = std::string("/sys/block/sd") + letter_ + "/device"; if (readlink(path.c_str(), buf, 256) != -1) { if (strncmp(buf, "../../devices/platform/cnxt1/usb2/2-1/2-1.2/2-1.2:1.0/host1/target1:0:0/1:0:0:0", 44) == 0) internal_ = true; } else esyslog("Error reading target of \"%s\": error \"%s\"", path.c_str(), strerror(errno)); #else internal_ = false; char buf[256]; //std::string path = std::string("/sys/block/sd") + _ + "/device"; if (readlink("/dev/root", buf, sizeof(buf)) == -1) esyslog("This device does not have /dev/root. Cannot find the root device"); else if (buf[2] == letter_) { isyslog("Device sd%c is the root device", letter_); internal_ = true; } #endif }
bool cSchedules::Read(FILE *f) { bool OwnFile = f == NULL; if (OwnFile) { if (epgDataFileName && access(epgDataFileName, R_OK) == 0) { dsyslog("reading EPG data from %s", epgDataFileName); if ((f = fopen(epgDataFileName, "r")) == NULL) { LOG_ERROR; return false; } } else return false; } LOCK_CHANNELS_WRITE; LOCK_SCHEDULES_WRITE; bool result = cSchedule::Read(f, Schedules); if (OwnFile) fclose(f); if (result) { // Initialize the channels' schedule pointers, so that the first WhatsOn menu will come up faster: for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) Schedules->GetSchedule(Channel); } return result; }
void cShutdownHandler::CheckManualStart(int ManualStart) { time_t Delta = Setup.NextWakeupTime ? Setup.NextWakeupTime - time(NULL) : 0; if (!Setup.NextWakeupTime || abs(Delta) > ManualStart) { // Apparently the user started VDR manually dsyslog("assuming manual start of VDR"); // Set inactive after MinUserInactivity SetUserInactiveTimeout(); } else { // Set inactive from now on dsyslog("scheduled wakeup time in %ld minutes, assuming automatic start of VDR", Delta / 60); SetUserInactive(); } }
bool cRemote::PutMacro(eKeys Key) // returns true it opens a menu // returns false if it is a command that has no menu { const cKeyMacro *km = KeyMacros.Get(Key); if (km) { keyMacroPlugin = km->Plugin(); if(km->Command()) { dsyslog("Executing keymacros.conf-command: \"%s\"\n", km->Command()); SystemExec(km->Command()); return false; } else { cMutexLock MutexLock(&mutex); for (int i = km->NumKeys(); --i > 0; ) { if (!Put(km->Macro()[i], true)) return true; } } } else if (Key == kTT) Skins.Message(mtError, tr("Teletext not available!")); else if (Key == kPiP) Skins.Message(mtError, tr("PiP not available!")); return true; }
void cPinStatusMonitor::TimerCreation(cTimer* Timer, const cEvent* Event) { int fsk = 0; if (!Timer || !Event || !Timer->Channel()) return; dsyslog("Timer creation, event '%s', protection mode (%d)", Event->Title(), cPinPlugin::autoProtectionMode); switch (cPinPlugin::autoProtectionMode) { case cPinPlugin::apmAlways: fsk = 1; break; case cPinPlugin::apmNever: fsk = 0; break; case cPinPlugin::apmIntelligent: { //dsyslog("Checking protection for channel '%s' at (%ld))", // Timer->Channel()->Name(), Event->StartTime()); fsk = (cPinPlugin::getObject())->channelProtected( Timer->Channel()->Name(), Event->StartTime()) || (cPinPlugin::getObject())->broadcastProtected(Event->Title()); break; } } Timer->SetFskProtection(fsk); }
void cChannel::SetName(const char *Name, const char *ShortName, const char *Provider) { if (!isempty(Name)) { bool nn = strcmp(name, Name) != 0; bool ns = strcmp(shortName, ShortName) != 0; bool np = strcmp(provider, Provider) != 0; if (nn || ns || np) { if (Number()) { dsyslog("changing name of channel %d from '%s,%s;%s' to '%s,%s;%s'", Number(), name, shortName, provider, Name, ShortName, Provider); modification |= CHANNELMOD_NAME; Channels.SetModified(); } if (nn) { name = strcpyrealloc(name, Name); nameSource = NULL; } if (ns) { shortName = strcpyrealloc(shortName, ShortName); shortNameSource = NULL; } if (np) provider = strcpyrealloc(provider, Provider); } } }
cReceiver::cReceiver(int Ca, int Priority, int Pid1, int Pid2, const int *Pids1, const int *Pids2, const int *Pids3) { device = NULL; ca = Ca; priority = Priority; numPids = 0; if (Pid1) pids[numPids++] = Pid1; if (Pid2 && (Pid1!=Pid2)) pids[numPids++] = Pid2; if (Pids1) { while (*Pids1 && numPids < MAXRECEIVEPIDS) pids[numPids++] = *Pids1++; } if (Pids2) { while (*Pids2 && numPids < MAXRECEIVEPIDS) pids[numPids++] = *Pids2++; } if (Pids3) { while (*Pids3 && numPids < MAXRECEIVEPIDS) pids[numPids++] = *Pids3++; } if (numPids >= MAXRECEIVEPIDS) dsyslog("too many PIDs in cReceiver"); }
void cSectionHandler::Action(void) { while (Running()) { Lock(); if (waitForLock) SetStatus(true); int NumFilters = filterHandles.Count(); pollfd pfd[NumFilters]; for (cFilterHandle *fh = filterHandles.First(); fh; fh = filterHandles.Next(fh)) { int i = fh->Index(); pfd[i].fd = fh->handle; pfd[i].events = POLLIN; pfd[i].revents = 0; } int oldStatusCount = statusCount; Unlock(); if (poll(pfd, NumFilters, 1000) > 0) { bool DeviceHasLock = device->HasLock(); if (!DeviceHasLock) cCondWait::SleepMs(100); for (int i = 0; i < NumFilters; i++) { if (pfd[i].revents & POLLIN) { cFilterHandle *fh = NULL; LOCK_THREAD; if (statusCount != oldStatusCount) break; for (fh = filterHandles.First(); fh; fh = filterHandles.Next(fh)) { if (pfd[i].fd == fh->handle) break; } if (fh) { // Read section data: unsigned char buf[4096]; // max. allowed size for any EIT section int r = device->ReadFilter(fh->handle, buf, sizeof(buf)); if (!DeviceHasLock) continue; // we do the read anyway, to flush any data that might have come from a different transponder if (r > 3) { // minimum number of bytes necessary to get section length int len = (((buf[1] & 0x0F) << 8) | (buf[2] & 0xFF)) + 3; if (len == r) { // Distribute data to all attached filters: int pid = fh->filterData.pid; int tid = buf[0]; for (cFilter *fi = filters.First(); fi; fi = filters.Next(fi)) { if (fi->Matches(pid, tid)) fi->Process(pid, tid, buf, len); } } else if (time(NULL) - lastIncompleteSection > 10) { // log them only every 10 seconds dsyslog("read incomplete section - len = %d, r = %d", len, r); lastIncompleteSection = time(NULL); } } } } } } } }
bool cSchedules::Read(FILE *f) { cSchedulesLock SchedulesLock(true, 1000); cSchedules *s = (cSchedules *)Schedules(SchedulesLock); if (s) { bool OwnFile = f == NULL; if (OwnFile) { if (epgDataFileName && access(epgDataFileName, R_OK) == 0) { dsyslog("reading EPG data from %s", epgDataFileName); if ((f = fopen(epgDataFileName, "r")) == NULL) { LOG_ERROR; return false; } } else return false; } bool result = cSchedule::Read(f, s); if (OwnFile) fclose(f); if (result) { // Initialize the channels' schedule pointers, so that the first WhatsOn menu will come up faster: for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) s->GetSchedule(Channel); } return result; } return false; }