From: leslie Date: Mon, 9 Jun 2008 09:42:15 +0000 (+0800) Subject: cardclient-CCcam: configuarble camd socket path X-Git-Tag: 0.9.1~71 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=6d4299e7ed4f5551049c47c5183f9a0b6451508b;p=sasc-ng.git cardclient-CCcam: configuarble camd socket path --- diff --git a/README.CCcam b/README.CCcam index 0cd686a..743b948 100644 --- a/README.CCcam +++ b/README.CCcam @@ -25,9 +25,10 @@ Note the patch makes a small change to vdr-sc so I can get the card number. 4) Your cardclient.cfg file needs an entry like this... -cccam:127.0.0.1:9000:0/0123/F000 +cccam:127.0.0.1:9000:0/0000/0000:/var/emu/chroot%d/tmp/camd.socket -(note that CCcam interface will offer to serve any ECMs) +Note: with that CCcam will offer to serve any ECMs. +Note: socketpath might need to be adjusted to your system. 5) Now it gets tricky, read some docs on the internet about chroot. diff --git a/examples/cardclient.conf.example b/examples/cardclient.conf.example index f72df6a..afdc685 100644 --- a/examples/cardclient.conf.example +++ b/examples/cardclient.conf.example @@ -46,3 +46,11 @@ newcamd:hostname:port:emm/caid/mask:username:password:cfgKey # NOTE: hostname & port will be ignore. GBOX must be runnning on the local # machine. For convinience you should choose localhost:8004 gbox:hostname:port:emm/caid/mask +# +# ccam client +# +# NOTE: hostname will be ignore. CCcam must be runnning on the local machine +# 'socket' is the name of the camd socket file. For multiple cards add %d +# into the string. This will be replaced with the number 0-3. +# e.g. /var/emu/chroot%d/tmp/camd.socket +cccam:hostname:port:emm/caid/mask:socket diff --git a/systems/cardclient/cccam.c b/systems/cardclient/cccam.c index c490ded..81bebe9 100644 --- a/systems/cardclient/cccam.c +++ b/systems/cardclient/cccam.c @@ -31,8 +31,6 @@ #define LIST_ONLY 0x03 /* CA application should clear the list when an 'ONLY' CAPMT object is received, and start working with the object */ -static char *socketPath="/var/emu/chroot%d/tmp/camd.socket"; - // -- cCCcamCard --------------------------------------------------------------- class cCCcamCard : public cMutex { @@ -169,6 +167,7 @@ private: cCCcamCard card[4]; int pmtversion; int failedcw; + char *socketpath; protected: virtual bool Login(void); virtual void Action(void); @@ -179,28 +178,33 @@ public: virtual bool ProcessECM(const cEcmInfo *ecm, const unsigned char *data, unsigned char *Cw, int cardnum); }; -static cCardClientLinkReg __ncd("CCcam"); +static cCardClientLinkReg __ncd("cccam"); cCardClientCCcam::cCardClientCCcam(const char *Name) :cCardClient(Name) ,cThread("CCcam listener") ,so(DEFAULT_CONNECT_TIMEOUT,2,3600,true) { - pmtversion=0; - for(int i=0; i<4; i++) card[i].Setup(i,socketPath); + pmtversion=0; socketpath=0; } cCardClientCCcam::~cCardClientCCcam() { Cancel(3); + free(socketpath); } bool cCardClientCCcam::Init(const char *config) { cMutexLock lock(this); int num=0; - if(!ParseStdConfig(config,&num)) return false; - return true; + char path[256]; + if(!ParseStdConfig(config,&num) + || sscanf(&config[num],":%255[^:]",path)!=1) return false; + PRINTF(L_CC_CORE,"%s: socket=%s",name,path); + socketpath=strdup(path); + for(int i=0; i<4; i++) card[i].Setup(i,socketpath); + return Immediate() ? Login() : true; } bool cCardClientCCcam::Login(void)