From 555fe68a018e193193f916c5e7c888c0a386e9fe Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 14 Jan 2015 12:17:39 +0100 Subject: [PATCH] Added the channel name to log messages that reference a channel --- CONTRIBUTORS | 1 + HISTORY | 2 ++ channels.c | 16 ++++++++-------- device.c | 4 ++-- dvbdevice.c | 12 ++++++------ menu.c | 8 ++++---- vdr.c | 6 +++--- 7 files changed, 26 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cb32846c..bc5c13db 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3302,6 +3302,7 @@ Dietmar Spingler a CAM needs to receive the TS for reporting a problem that led to a fix with EMM pids not being properly reset for CAMs that need to receive the TS + for suggesting to add the channel name to log messages that reference a channel Stefan Schallenberg for adding the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement() diff --git a/HISTORY b/HISTORY index 0b9bb424..a7959423 100644 --- a/HISTORY +++ b/HISTORY @@ -8369,3 +8369,5 @@ Video Disk Recorder Revision History (like device or frontend numbers) is within the first 15 characters of the string, because only these are displayed in thread listings. Plugin authors may want to do the same. +- Added the channel name to log messages that reference a channel (suggested by + Dietmar Spingler). diff --git a/channels.c b/channels.c index de655bec..b91df6dc 100644 --- a/channels.c +++ b/channels.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 3.6 2015/01/04 15:02:21 kls Exp $ + * $Id: channels.c 3.7 2015/01/14 12:15:03 kls Exp $ */ #include "channels.h" @@ -221,7 +221,7 @@ bool cChannel::SetTransponderData(int Source, int Frequency, int Srate, const ch nameSource = NULL; shortNameSource = NULL; if (Number() && !Quiet) { - dsyslog("changing transponder data of channel %d from %s to %s", Number(), *OldTransponderData, *TransponderDataToString()); + dsyslog("changing transponder data of channel %d (%s) from %s to %s", Number(), name, *OldTransponderData, *TransponderDataToString()); modification |= CHANNELMOD_TRANSP; Channels.SetModified(); } @@ -233,7 +233,7 @@ void cChannel::SetId(int Nid, int Tid, int Sid, int Rid) { if (nid != Nid || tid != Tid || sid != Sid || rid != Rid) { if (Number()) { - dsyslog("changing id of channel %d from %d-%d-%d-%d to %d-%d-%d-%d", Number(), nid, tid, sid, rid, Nid, Tid, Sid, Rid); + dsyslog("changing id of channel %d (%s) from %d-%d-%d-%d to %d-%d-%d-%d", Number(), name, nid, tid, sid, rid, Nid, Tid, Sid, Rid); modification |= CHANNELMOD_ID; Channels.SetModified(); Channels.UnhashChannel(this); @@ -278,7 +278,7 @@ void cChannel::SetPortalName(const char *PortalName) { if (!isempty(PortalName) && strcmp(portalName, PortalName) != 0) { if (Number()) { - dsyslog("changing portal name of channel %d from '%s' to '%s'", Number(), portalName, PortalName); + dsyslog("changing portal name of channel %d (%s) from '%s' to '%s'", Number(), name, portalName, PortalName); modification |= CHANNELMOD_NAME; Channels.SetModified(); } @@ -368,7 +368,7 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, c q += IntArrayToString(q, Spids, 10, SLangs); *q = 0; if (Number()) - dsyslog("changing pids of channel %d from %d+%d=%d:%s:%s:%d to %d+%d=%d:%s:%s:%d", Number(), vpid, ppid, vtype, OldApidsBuf, OldSpidsBuf, tpid, Vpid, Ppid, Vtype, NewApidsBuf, NewSpidsBuf, Tpid); + dsyslog("changing pids of channel %d (%s) from %d+%d=%d:%s:%s:%d to %d+%d=%d:%s:%s:%d", Number(), name, vpid, ppid, vtype, OldApidsBuf, OldSpidsBuf, tpid, Vpid, Ppid, Vtype, NewApidsBuf, NewSpidsBuf, Tpid); vpid = Vpid; ppid = Ppid; vtype = Vtype; @@ -427,7 +427,7 @@ void cChannel::SetCaIds(const int *CaIds) IntArrayToString(OldCaIdsBuf, caids, 16); IntArrayToString(NewCaIdsBuf, CaIds, 16); if (Number()) - dsyslog("changing caids of channel %d from %s to %s", Number(), OldCaIdsBuf, NewCaIdsBuf); + dsyslog("changing caids of channel %d (%s) from %s to %s", Number(), name, OldCaIdsBuf, NewCaIdsBuf); for (int i = 0; i <= MAXCAIDS; i++) { // <= to copy the terminating 0 caids[i] = CaIds[i]; if (!CaIds[i]) @@ -444,7 +444,7 @@ void cChannel::SetCaDescriptors(int Level) modification |= CHANNELMOD_CA; Channels.SetModified(); if (Number() && Level > 1) - dsyslog("changing ca descriptors of channel %d", Number()); + dsyslog("changing ca descriptors of channel %d (%s)", Number(), name); } } @@ -470,7 +470,7 @@ void cChannel::SetLinkChannels(cLinkChannels *LinkChannels) } char buffer[((linkChannels ? linkChannels->Count() : 0) + (LinkChannels ? LinkChannels->Count() : 0)) * 6 + 256]; // 6: 5 digit channel number plus blank, 256: other texts (see below) plus reserve char *q = buffer; - q += sprintf(q, "linking channel %d from", Number()); + q += sprintf(q, "linking channel %d (%s) from", Number(), name); if (linkChannels) { for (cLinkChannel *lc = linkChannels->First(); lc; lc = linkChannels->Next(lc)) { lc->Channel()->SetRefChannel(NULL); diff --git a/device.c b/device.c index 7da1b290..3d57611d 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 3.18 2015/01/14 11:06:13 kls Exp $ + * $Id: device.c 3.19 2015/01/14 12:02:44 kls Exp $ */ #include "device.h" @@ -696,7 +696,7 @@ bool cDevice::MaySwitchTransponder(const cChannel *Channel) const bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView) { if (LiveView) { - isyslog("switching to channel %d", Channel->Number()); + isyslog("switching to channel %d (%s)", Channel->Number(), Channel->Name()); cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer } for (int i = 3; i--;) { diff --git a/dvbdevice.c b/dvbdevice.c index d361127b..9321f16d 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 3.13 2015/01/14 11:06:42 kls Exp $ + * $Id: dvbdevice.c 3.14 2015/01/14 12:09:19 kls Exp $ */ #include "dvbdevice.h" @@ -771,7 +771,7 @@ static int GetRequiredDeliverySystem(const cChannel *Channel, const cDvbTranspon else if (Channel->IsTerr()) ds = Dtp->System() == DVB_SYSTEM_1 ? SYS_DVBT : SYS_DVBT2; else - esyslog("ERROR: can't determine frontend type for channel %d", Channel->Number()); + esyslog("ERROR: can't determine frontend type for channel %d (%s)", Channel->Number(), Channel->Name()); return ds; } @@ -823,7 +823,7 @@ bool cDvbTuner::SetFrontend(void) } } else { - esyslog("ERROR: no DiSEqC parameters found for channel %d", channel.Number()); + esyslog("ERROR: no DiSEqC parameters found for channel %d (%s)", channel.Number(), channel.Name()); return false; } } @@ -961,7 +961,7 @@ void cDvbTuner::Action(void) lastDiseqc = NULL; lastSource = 0; if (time(NULL) - lastTimeoutReport > 60) { // let's not get too many of these - isyslog("frontend %d/%d timed out while tuning to channel %d, tp %d", adapter, frontend, channel.Number(), channel.Transponder()); + isyslog("frontend %d/%d timed out while tuning to channel %d (%s), tp %d", adapter, frontend, channel.Number(), channel.Name(), channel.Transponder()); lastTimeoutReport = time(NULL); } continue; @@ -979,7 +979,7 @@ void cDvbTuner::Action(void) } else if (Status & FE_HAS_LOCK) { if (LostLock) { - isyslog("frontend %d/%d regained lock on channel %d, tp %d", adapter, frontend, channel.Number(), channel.Transponder()); + isyslog("frontend %d/%d regained lock on channel %d (%s), tp %d", adapter, frontend, channel.Number(), channel.Name(), channel.Transponder()); LostLock = false; } tunerStatus = tsLocked; @@ -988,7 +988,7 @@ void cDvbTuner::Action(void) } else if (tunerStatus == tsLocked) { LostLock = true; - isyslog("frontend %d/%d lost lock on channel %d, tp %d", adapter, frontend, channel.Number(), channel.Transponder()); + isyslog("frontend %d/%d lost lock on channel %d (%s), tp %d", adapter, frontend, channel.Number(), channel.Name(), channel.Transponder()); tunerStatus = tsTuned; Timer.Set(lockTimeout); lastTimeoutReport = 0; diff --git a/menu.c b/menu.c index c96af5ed..e5d7e098 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 3.25 2015/01/13 09:40:59 kls Exp $ + * $Id: menu.c 3.26 2015/01/14 12:10:58 kls Exp $ */ #include "menu.h" @@ -4756,7 +4756,7 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause) int Priority = Timer ? Timer->Priority() : Pause ? Setup.PausePriority : Setup.DefaultPriority; cDevice *device = cDevice::GetDevice(channel, Priority, false); if (device) { - dsyslog("switching device %d to channel %d", device->DeviceNumber() + 1, channel->Number()); + dsyslog("switching device %d to channel %d (%s)", device->DeviceNumber() + 1, channel->Number(), channel->Name()); if (!device->SwitchChannel(channel, false)) { ShutdownHandler.RequestEmergencyExit(); return false; @@ -4771,7 +4771,7 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause) } } else if (!Timer || !Timer->Pending()) { - isyslog("no free DVB device to record channel %d!", ch); + isyslog("no free DVB device to record channel %d (%s)!", ch, channel->Name()); Skins.Message(mtError, tr("No free DVB device to record!")); } } @@ -4866,7 +4866,7 @@ void cRecordControls::ChannelDataModified(cChannel *Channel) if (RecordControls[i]) { if (RecordControls[i]->Timer() && RecordControls[i]->Timer()->Channel() == Channel) { if (RecordControls[i]->Device()->ProvidesTransponder(Channel)) { // avoids retune on devices that don't really access the transponder - isyslog("stopping recording due to modification of channel %d", Channel->Number()); + isyslog("stopping recording due to modification of channel %d (%s)", Channel->Number(), Channel->Name()); RecordControls[i]->Stop(); // This will restart the recording, maybe even from a different // device in case conditional access has changed. diff --git a/vdr.c b/vdr.c index dfd37725..53d8bacc 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 3.13 2015/01/11 13:36:28 kls Exp $ + * $Id: vdr.c 3.14 2015/01/14 12:11:41 kls Exp $ */ #include @@ -955,7 +955,7 @@ int main(int argc, char *argv[]) if (Channel->Number() == cDevice::CurrentChannel() && cDevice::PrimaryDevice()->HasDecoder()) { if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring()) { if (cDevice::ActualDevice()->ProvidesTransponder(Channel)) { // avoids retune on devices that don't really access the transponder - isyslog("retuning due to modification of channel %d", Channel->Number()); + isyslog("retuning due to modification of channel %d (%s)", Channel->Number(), Channel->Name()); Channels.SwitchTo(Channel->Number()); } } @@ -1032,7 +1032,7 @@ int main(int argc, char *argv[]) if (!Device->IsTunedToTransponder(Timer->Channel())) { if (Device == cDevice::ActualDevice() && !Device->IsPrimaryDevice()) cDevice::PrimaryDevice()->StopReplay(); // stop transfer mode - dsyslog("switching device %d to channel %d", Device->DeviceNumber() + 1, Timer->Channel()->Number()); + dsyslog("switching device %d to channel %d (%s)", Device->DeviceNumber() + 1, Timer->Channel()->Number(), Timer->Channel()->Name()); if (Device->SwitchChannel(Timer->Channel(), false)) Device->SetOccupied(TIMERDEVICETIMEOUT); }