From ce42e42ed7a4ef206196f68f698ba6cce2b5b7de Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 12 May 2017 09:17:39 +0200 Subject: [PATCH] Added handling RI_HOST_CONTROL to the CI protocol --- HISTORY | 4 +++- ci.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 19e6cbe9..c1477b38 100644 --- a/HISTORY +++ b/HISTORY @@ -8991,7 +8991,7 @@ Video Disk Recorder Revision History current channel is listed. - Fixed a possible crash when pulling the CAM while decrypting a channel with MTD. -2017-05-09: Version 2.3.5 +2017-05-12: Version 2.3.5 - CAMs are now sent a generated EIT packet that contains a single 'present event' for the current SID, in order to avoid any parental rating dialogs. @@ -9022,3 +9022,5 @@ Video Disk Recorder Revision History - Added a Status parameter to the interface of cDevice::SignalStats() and cDvbDevice::SignalStats() (thanks to Rolf Ahrenberg). - Fixed handling line numbers in error messages when reading EPG data. +- Added handling RI_HOST_CONTROL to the CI protocol (no actual processing, but its + presence is required by some CAMs). diff --git a/ci.c b/ci.c index def1530a..41624c15 100644 --- a/ci.c +++ b/ci.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.c 4.14 2017/05/01 09:26:12 kls Exp $ + * $Id: ci.c 4.15 2017/05/12 09:13:10 kls Exp $ */ #include "ci.h" @@ -631,6 +631,7 @@ void cCiResourceManager::Process(int Length, const uint8_t *Data) uint32_t resources[] = { htonl(RI_RESOURCE_MANAGER), htonl(RI_APPLICATION_INFORMATION), htonl(RI_CONDITIONAL_ACCESS_SUPPORT), + htonl(RI_HOST_CONTROL), htonl(RI_DATE_TIME), htonl(RI_MMI) }; @@ -1080,6 +1081,39 @@ void cCiConditionalAccessSupport::SendPMT(cCiCaPmt *CaPmt) } } +// --- cCiHostControl -------------------------------------------------------- + +class cCiHostControl : public cCiSession { +public: + cCiHostControl(uint16_t SessionId, cCiTransportConnection *Tc); + virtual void Process(int Length = 0, const uint8_t *Data = NULL); + }; + +cCiHostControl::cCiHostControl(uint16_t SessionId, cCiTransportConnection* Tc) +:cCiSession(SessionId, RI_HOST_CONTROL, Tc) +{ + dbgprotocol("Slot %d: new Host Control (session id %d)\n", Tc->CamSlot()->SlotNumber(), SessionId); +} + +void cCiHostControl::Process(int Length, const uint8_t* Data) +{ + if (Data) { + int Tag = GetTag(Length, &Data); + switch (Tag) { + case AOT_TUNE: + dbgprotocol("Slot %d: <== Host Control Tune (%d)\n", Tc()->CamSlot()->SlotNumber(), SessionId()); + break; + case AOT_REPLACE: + dbgprotocol("Slot %d: <== Host Control Replace (%d)\n", Tc()->CamSlot()->SlotNumber(), SessionId()); + break; + case AOT_CLEAR_REPLACE: + dbgprotocol("Slot %d: <== Host Control Clear Replace (%d)\n", Tc()->CamSlot()->SlotNumber(), SessionId()); + break; + default: esyslog("ERROR: CAM %d: Host Control: unknown tag %06X", Tc()->CamSlot()->SlotNumber(), Tag); + } + } +} + // --- cCiDateTime ----------------------------------------------------------- class cCiDateTime : public cCiSession { @@ -1578,9 +1612,9 @@ void cCiTransportConnection::OpenSession(int Length, const uint8_t *Data) case RI_RESOURCE_MANAGER: sessions[i] = new cCiResourceManager(i, this); break; case RI_APPLICATION_INFORMATION: sessions[i] = new cCiApplicationInformation(i, this); break; case RI_CONDITIONAL_ACCESS_SUPPORT: sessions[i] = new cCiConditionalAccessSupport(i, this); break; + case RI_HOST_CONTROL: sessions[i] = new cCiHostControl(i, this); break; case RI_DATE_TIME: sessions[i] = new cCiDateTime(i, this); break; case RI_MMI: sessions[i] = new cCiMMI(i, this); break; - case RI_HOST_CONTROL: // not implemented default: esyslog("ERROR: CAM %d: unknown resource identifier: %08X (%d/%d)", camSlot->SlotNumber(), ResourceId, camSlot->SlotIndex(), tcid); } if (sessions[i])