From: leslie Date: Sun, 7 Mar 2010 02:29:34 +0000 (+0800) Subject: sc-conax: fix ua handling / card init X-Git-Tag: upstream/620~86 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=31105684a93c07440d6d53929816d191d8f290bf;p=sasc-ng.git sc-conax: fix ua handling / card init --- diff --git a/systems/sc-conax/sc-conax.c b/systems/sc-conax/sc-conax.c index f0facec..08334ce 100644 --- a/systems/sc-conax/sc-conax.c +++ b/systems/sc-conax/sc-conax.c @@ -167,10 +167,9 @@ struct stdent { unsigned int pbm[2]; }; -class cSmartCardConax : public cSmartCard, private cProviders { +class cSmartCardConax : public cSmartCard, private cIdSet { private: int sysId, cardVer, currency; - bool emmInitDone; unsigned char ua[ADDR_SIZE]; // int GetLen(void); @@ -202,7 +201,6 @@ cSmartCardConax::cSmartCardConax(void) :cSmartCard(&cardCfg,msgs) { sysId=0; cardVer=0; currency=0; - emmInitDone=false; memset(ua,0,sizeof(ua)); } @@ -221,6 +219,8 @@ bool cSmartCardConax::Init(void) static const unsigned char cnxHist[] = { '0','B','0','0' }; // XXX is this always true ? sysId=0; cardVer=0; currency=0; + memset(ua,0,sizeof(ua)); + ResetIdSet(); if(atr->histLen<4 || memcmp(atr->hist, cnxHist, atr->histLen)) { PRINTF(L_SC_INIT,"doesn't look like a Conax card"); return false; @@ -235,12 +235,12 @@ bool cSmartCardConax::Init(void) unsigned char buff[MAX_LEN]; int l; if(!IsoWrite(ins26,hostVer) || !Status() || (l=GetLen())<=0) { - PRINTF(L_SC_ERROR,"card init failed (1)"); + PRINTF(L_SC_ERROR,"card caid request failed"); return false; } insca[4]=l; if(!IsoRead(insca,buff) || !Status()) { - PRINTF(L_SC_ERROR,"card init failed (2)"); + PRINTF(L_SC_ERROR,"card caid read failed"); return false; } for(int i=0; i0) { infoStr.Printf("Subscriptions:\n"); @@ -327,7 +357,6 @@ bool cSmartCardConax::Init(void) PRINTF(L_SC_ERROR,"getting PPV entitlements failed"); */ - emmInitDone=false; infoStr.Finish(); return true; } @@ -398,64 +427,9 @@ bool cSmartCardConax::Decode(const cEcmInfo *ecm, const unsigned char *data, uns bool cSmartCardConax::Update(int pid, int caid, const unsigned char *data) { static unsigned char ins84[] = { 0xdd,0x84,0x00,0x00,0x00 }; - static unsigned char insca[] = { 0xdd,0xca,0x00,0x00,0x00 }; - static unsigned char ins82[] = { 0xdd,0x82,0x00,0x00,0x11 }; - static unsigned char ins82Data[] = { 0x11,0x0f,0x01,0xb0,0x0f,0xff,0xff,0xfb,0x00,0x00,0x09,0x04,0x0b,0x00,0x00,0x00,0x2b }; - unsigned char buff[MAX_LEN]; - if(!emmInitDone) { - ins82Data[14]=(pid>>8)&0xFF; - ins82Data[15]=pid&0xFF; - int l; - if(!IsoWrite(ins82,ins82Data) || !Status() || (l=GetLen())<=0) return false; - insca[4]=l; - if(!IsoRead(insca,buff) || !Status()) return false; - if(buff[0]!=0x22 || buff[1]+2!=l) { - PRINTF(L_SC_ERROR,"bad card reply on EMM init"); - return false; - } - - LBSTARTF(L_SC_INIT); - LBPUT("set filter"); - Clear(); - for(int i=2; i0) { buff[0]=0x12; buff[1]=l;