diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/CAPMT.cpp vdr-plugin-dvbapi-2.2.0-481~5fdb21e/CAPMT.cpp --- vdr-plugin-dvbapi-2.2.0-476~02d064a/CAPMT.cpp 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/CAPMT.cpp 2015-05-01 22:27:50.000000000 +0000 @@ -184,3 +184,58 @@ //sending data SockHandler->Write(caPMT, toWrite); } + +void CAPMT::UpdateEcmInfo(int adapter_index, int sid, uint16_t caid, uint16_t pid, uint32_t prid, uint32_t ecmtime, char *cardsystem, char *reader, char *from, char *protocol, int8_t hops) +{ + cMutexLock lock(&mutex); + vector::iterator it; + + if (!pmt.empty()) + { + for (it = pmt.begin(); it != pmt.end(); ++it) + { + if (it->sid == sid && it->adapter == adapter_index) + { + DEBUGLOG("%s: PMTO update, adapter=%d, SID=%04X", __FUNCTION__, adapter_index, sid); + it->caid = caid; + it->pid = pid; + it->prid = prid; + it->ecmtime = ecmtime; + it->cardsystem = cardsystem; + it->reader = reader; + it->from = from; + it->protocol = protocol; + it->hops = hops; + break; + } + } + } +} + +bool CAPMT::FillEcmInfo(sDVBAPIEcmInfo *ecminfo) +{ + cMutexLock lock(&mutex); + vector::iterator it; + + if (!pmt.empty()) + { + for (it = pmt.begin(); it != pmt.end(); ++it) + { + if (it->sid == ecminfo->sid) + { + DEBUGLOG("%s: PMTO match - fill, adapter=%d, SID=%04X", __FUNCTION__, it->adapter, it->sid); + ecminfo->caid = it->caid; + ecminfo->pid = it->pid; + ecminfo->prid = it->prid; + ecminfo->ecmtime = it->ecmtime; + ecminfo->cardsystem = it->cardsystem; + ecminfo->reader = it->reader; + ecminfo->from = it->from; + ecminfo->protocol = it->protocol; + ecminfo->hops = it->hops; + return true; + } + } + } + return false; +} diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/CAPMT.h vdr-plugin-dvbapi-2.2.0-481~5fdb21e/CAPMT.h --- vdr-plugin-dvbapi-2.2.0-476~02d064a/CAPMT.h 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/CAPMT.h 2015-05-01 22:27:50.000000000 +0000 @@ -35,6 +35,8 @@ #define LIST_ADD 0x04 #define LIST_UPDATE 0x05 +struct sDVBAPIEcmInfo; + using namespace std; struct pmtobj @@ -44,6 +46,17 @@ int adapter; char pilen[2]; unsigned char* data; + + //ecminfo + uint16_t caid; + uint16_t pid; + uint32_t prid; + uint32_t ecmtime; + cString cardsystem; + cString reader; + cString from; + cString protocol; + int8_t hops; }; class CAPMT @@ -65,6 +78,8 @@ return pmt.empty(); } void SendAll(); + void UpdateEcmInfo(int adapter_index, int sid, uint16_t caid, uint16_t pid, uint32_t prid, uint32_t ecmtime, char *cardsystem, char *reader, char *from, char *protocol, int8_t hops); + bool FillEcmInfo(sDVBAPIEcmInfo *ecminfo); }; extern CAPMT *capmt; diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/debian/changelog vdr-plugin-dvbapi-2.2.0-481~5fdb21e/debian/changelog --- vdr-plugin-dvbapi-2.2.0-476~02d064a/debian/changelog 2015-04-25 10:49:38.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/debian/changelog 2015-05-01 22:27:56.000000000 +0000 @@ -1,18 +1,31 @@ -vdr-plugin-dvbapi (2.2.0-476~02d064a-utopic) utopic; urgency=medium +vdr-plugin-dvbapi (2.2.0-481~5fdb21e-utopic) utopic; urgency=medium - * [02d064a9daa2d95cbb5fb5a141852956c901a561] - Update README + * [5fdb21ecac7415896879b7ce9c855e1f92a2d079] + Compile fix for c++11 issues - Thanks area was not maintained for some time and some people - may rightly feel left out because of this. + tested with gcc-4.8.4, gcc-4.9.2 - I am trying to give credits in the related commit messages instead. + Signed-of-by: Joerg Bornkessel - * [1f253210216d583f00d32ba567d52bbb6bd8eb1f] - Filter: fix for filtering multiple data tables in single TS packet + * [85da7b20c96777de01dae3b7e62f6a3c015be259] + ECMINFO: add cardsystem name (OSCam rev 10653) - Reported-by: crow + Issue #91 + + + * [f5ae09a17003200009fe37a9a0848c43b6599667] + Add ECMINFO to service interface + + Closes #91 + + + * [6ac4bcda63b21ec47c7d97ab8c6adec332dc60b3] + Obtain ECMINFO data from OSCam (proto v2) + + + * [92039a4c202d82aa212179ea1dfa1293e12130cf] + cosmetics (indent) - -- Andrey Pavlenko Sat, 25 Apr 2015 13:49:38 +0300 + -- Andrey Pavlenko Sat, 02 May 2015 01:27:56 +0300 diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/DVBAPI.cpp vdr-plugin-dvbapi-2.2.0-481~5fdb21e/DVBAPI.cpp --- vdr-plugin-dvbapi-2.2.0-476~02d064a/DVBAPI.cpp 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/DVBAPI.cpp 2015-05-01 22:27:50.000000000 +0000 @@ -174,6 +174,13 @@ bool DVBAPI::Service(const char *Id, void *Data) { // Handle custom service requests from other plugins + if (Data == NULL) + return false; + if (strcmp(Id, "GetEcmInfo") == 0) + { + sDVBAPIEcmInfo *ecminfo = (sDVBAPIEcmInfo*) Data; + return capmt->FillEcmInfo(ecminfo); + } return false; } diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/DVBAPI.h vdr-plugin-dvbapi-2.2.0-481~5fdb21e/DVBAPI.h --- vdr-plugin-dvbapi-2.2.0-476~02d064a/DVBAPI.h 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/DVBAPI.h 2015-05-01 22:27:50.000000000 +0000 @@ -34,6 +34,21 @@ extern unsigned int AdapterIndexOffset; extern bool CheckExpiredCW; +struct sDVBAPIEcmInfo { + //in parameters + uint16_t sid; + //out parameters + uint16_t caid; + uint16_t pid; + uint32_t prid; + uint32_t ecmtime; + cString cardsystem; + cString reader; + cString from; + cString protocol; + int8_t hops; +}; + class DVBAPI : public cPlugin { private: diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/Log.h vdr-plugin-dvbapi-2.2.0-481~5fdb21e/Log.h --- vdr-plugin-dvbapi-2.2.0-476~02d064a/Log.h 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/Log.h 2015-05-01 22:27:50.000000000 +0000 @@ -24,8 +24,8 @@ //global loglevel variable extern int LogLevel; -#define ERRORLOG(a...) void( (LogLevel >= 1) ? syslog_with_tid(LOG_ERR, "DVBAPI-Error: "a) : void() ) -#define INFOLOG(a...) void( (LogLevel >= 2) ? syslog_with_tid(LOG_INFO, "DVBAPI: "a) : void() ) -#define DEBUGLOG(a...) void( (LogLevel >= 3) ? syslog_with_tid(LOG_DEBUG, "DVBAPI: "a) : void() ) +#define ERRORLOG(a...) void( (LogLevel >= 1) ? syslog_with_tid(LOG_ERR, "DVBAPI-Error: " a) : void() ) +#define INFOLOG(a...) void( (LogLevel >= 2) ? syslog_with_tid(LOG_INFO, "DVBAPI: " a) : void() ) +#define DEBUGLOG(a...) void( (LogLevel >= 3) ? syslog_with_tid(LOG_DEBUG, "DVBAPI: " a) : void() ) #endif // ___LOG_H diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/SocketHandler.cpp vdr-plugin-dvbapi-2.2.0-481~5fdb21e/SocketHandler.cpp --- vdr-plugin-dvbapi-2.2.0-476~02d064a/SocketHandler.cpp 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/SocketHandler.cpp 2015-05-01 22:27:50.000000000 +0000 @@ -285,7 +285,7 @@ continue; } request = (uint32_t *) &buff; - skip_bytes = 0; + skip_bytes = 0; if (protocol_version >= 1 && ntohl(*request) != DVBAPI_SERVER_INFO) { @@ -346,6 +346,8 @@ cRead = recv(sock, buff+6, len, MSG_DONTWAIT); buff[6+len] = 0; //terminate the string } + else if (*request == DVBAPI_ECM_INFO) + recv(sock, buff+4, 14, MSG_DONTWAIT); //read ECM info const len header only else { ERRORLOG("%s: read failed unknown command: %08x", __FUNCTION__, *request); @@ -451,6 +453,60 @@ protocol_version = ntohs(*proto_ver_ptr); DEBUGLOG("%s: Got SERVER_INFO: %s, protocol_version = %d", __FUNCTION__, &buff[6], protocol_version); } + else if (*request == DVBAPI_ECM_INFO) + { + char cardsystem[255]; + char reader[255]; + char from[255]; + char protocol[255]; + unsigned char len, hops; + int i = 4; + + uint16_t *sid_ptr = (uint16_t *) &buff[i]; //ServiceID + uint16_t sid = ntohs(*sid_ptr); + i += 2; + + uint16_t *caid_ptr = (uint16_t *) &buff[i]; //CAID + uint16_t caid = ntohs(*caid_ptr); + i += 2; + + uint16_t *pid_ptr = (uint16_t *) &buff[i]; //PID + uint16_t pid = ntohs(*pid_ptr); + i += 2; + + uint32_t *prid_ptr = (uint32_t *) &buff[i]; //ProviderID + uint32_t prid = ntohl(*prid_ptr); + i += 4; + + uint32_t *ecmtime_ptr = (uint32_t *) &buff[i]; //ECM time + uint32_t ecmtime = ntohl(*ecmtime_ptr); + i += 4; + + //cardsystem name + recv(sock, &len, 1, MSG_DONTWAIT); //string length + recv(sock, cardsystem, len, MSG_DONTWAIT); + cardsystem[len] = 0; //terminate the string + + //reader name + recv(sock, &len, 1, MSG_DONTWAIT); //string length + recv(sock, reader, len, MSG_DONTWAIT); + reader[len] = 0; //terminate the string + + //source (from) + recv(sock, &len, 1, MSG_DONTWAIT); //string length + recv(sock, from, len, MSG_DONTWAIT); + from[len] = 0; //terminate the string + + //protocol name + recv(sock, &len, 1, MSG_DONTWAIT); //string length + recv(sock, protocol, len, MSG_DONTWAIT); + protocol[len] = 0; //terminate the string + + recv(sock, &hops, 1, MSG_DONTWAIT); //hops + + DEBUGLOG("%s: Got ECM_INFO: adapter_index=%d, SID = %04X, CAID = %04X (%s), PID = %04X, ProvID = %06X, ECM time = %d ms, reader = %s, from = %s, protocol = %s, hops = %d", __FUNCTION__, adapter_index, sid, caid, cardsystem, pid, prid, ecmtime, reader, from, protocol, hops); + capmt->UpdateEcmInfo(adapter_index, sid, caid, pid, prid, ecmtime, cardsystem, reader, from, protocol, hops); + } else DEBUGLOG("%s: unknown request", __FUNCTION__); } diff -Nru vdr-plugin-dvbapi-2.2.0-476~02d064a/SocketHandler.h vdr-plugin-dvbapi-2.2.0-481~5fdb21e/SocketHandler.h --- vdr-plugin-dvbapi-2.2.0-476~02d064a/SocketHandler.h 2015-04-25 10:49:32.000000000 +0000 +++ vdr-plugin-dvbapi-2.2.0-481~5fdb21e/SocketHandler.h 2015-05-01 22:27:50.000000000 +0000 @@ -33,11 +33,12 @@ #include #include "Filter.h" -#define DVBAPI_PROTOCOL_VERSION 1 +#define DVBAPI_PROTOCOL_VERSION 2 #define DVBAPI_FILTER_DATA 0xFFFF0000 #define DVBAPI_CLIENT_INFO 0xFFFF0001 #define DVBAPI_SERVER_INFO 0xFFFF0002 +#define DVBAPI_ECM_INFO 0xFFFF0003 #define INFO_VERSION "vdr-plugin-dvbapi " VERSION " / VDR " VDRVERSION