From 99c7d018331fff7f87a1431bb53eaac724ff0088 Mon Sep 17 00:00:00 2001 From: leslie Date: Sun, 22 Mar 2009 12:59:36 +0800 Subject: [PATCH] smartcards: add single reset mode --- smartcard.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/smartcard.c b/smartcard.c index f0715f7..b592404 100644 --- a/smartcard.c +++ b/smartcard.c @@ -78,7 +78,7 @@ protected: const struct CardConfig *cfg; unsigned char sb[SB_LEN]; struct Atr atr; - bool localecho; + bool localecho, singlereset; // char devName[256]; int currMode; @@ -106,7 +106,8 @@ static const char *serModes[] = { 0,"8e2","8o2","8n2" }; cSmartCardSlot::cSmartCardSlot(void) { card=0; cfg=0; usecount=0; slotnum=-1; currMode=SM_NONE; clock=ISO_FREQ; - firstRun=true; needsReset=false; dead=false; localecho=true; + firstRun=true; needsReset=false; dead=false; + localecho=true; singlereset=false; } cSmartCardSlot::~cSmartCardSlot() @@ -223,9 +224,10 @@ void cSmartCardSlot::Action(void) else if(DeviceIsInserted()) { if(!dead) { PRINTF(L_CORE_SC,"%d: new card inserted",slotnum); + bool resetdone=false; for(int mode=SM_NONE+1 ; modeName()); @@ -1080,6 +1082,7 @@ protected: // virtual bool Reset(void); public: + cSmartCardSlotCCID(void); virtual bool IsoRead(const unsigned char *cmd, unsigned char *data); virtual bool IsoWrite(const unsigned char *cmd, const unsigned char *data); virtual int RawRead(unsigned char *data, int len, int to=0) { return -1; } @@ -1088,6 +1091,11 @@ public: static cSmartCardSlotLinkReg __scs_ccid("ccid"); +cSmartCardSlotCCID::cSmartCardSlotCCID(void) +{ + singlereset=true; +} + bool cSmartCardSlotCCID::DeviceOpen(const char *cfg) { if(!cfg || sscanf(cfg,"%255[^:]",devName)==1) { -- 2.39.5