[Pcsclite-cvs-commit] PCSC/src debuglog.c,1.14,1.15 dyn_win32.c,1.5,1.6 hotplug_libusb.c,1.9,1.10 hotplug_linux.c,1.14,1.15 ifdwrapper.c,1.4,1.5 pcscdaemon.c,1.30,1.31 testpcsc.c,1.3,1.4 tokenfactory.c,1.12,1.13 winscard.c,1.17,1.18 winscard_clnt.c,1.13,1.14 winscard_msg.c,1.8,1.9 winscard_scf.c,1.3,1.4
aet-guest@quantz.debian.org
aet-guest@quantz.debian.org
Mon, 08 Sep 2003 10:50:53 +0200
Update of /cvsroot/pcsclite/PCSC/src
In directory quantz:/tmp/cvs-serv22133
Modified Files:
debuglog.c dyn_win32.c hotplug_libusb.c hotplug_linux.c
ifdwrapper.c pcscdaemon.c testpcsc.c tokenfactory.c winscard.c
winscard_clnt.c winscard_msg.c winscard_scf.c
Log Message:
AIX build fix, convert // comments into /* */ blocks.
Index: debuglog.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/debuglog.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- debuglog.c 7 Sep 2003 20:28:53 -0000 1.14
+++ debuglog.c 8 Sep 2003 08:50:50 -0000 1.15
@@ -30,7 +30,7 @@
#include "debuglog.h"
#include "sys_generic.h"
-// Max string size when dumping a 256 bytes longs APDU
+/* Max string size when dumping a 256 bytes longs APDU */
#define DEBUG_BUF_SIZE (256*3+30)
static char DebugBuffer[DEBUG_BUF_SIZE];
@@ -171,14 +171,15 @@
#define DEBUG_INFO_LENGTH 80
char text[DEBUG_INFO_LENGTH];
- // use a negative number to UNset
- // typically use ~DEBUG_CATEGORY_APDU
+ /* use a negative number to UNset
+ * typically use ~DEBUG_CATEGORY_APDU
+ */
if (dbginfo < 0)
debug_category &= dbginfo;
else
debug_category |= dbginfo;
- // set to empty string
+ /* set to empty string */
text[0] = '\0';
if (debug_category & DEBUG_CATEGORY_APDU)
Index: dyn_win32.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/dyn_win32.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dyn_win32.c 7 Sep 2003 20:28:53 -0000 1.5
+++ dyn_win32.c 8 Sep 2003 08:50:50 -0000 1.6
@@ -29,7 +29,9 @@
if (*pvLHandle == NULL)
{
- //DebugLogB("DYN_LoadLibrary: dlerror() reports %s", dlerror());
+#if 0
+ DebugLogB("DYN_LoadLibrary: dlerror() reports %s", dlerror());
+#endif
return SCARD_F_UNKNOWN_ERROR;
}
@@ -45,7 +47,9 @@
if (ret)
{
- //DebugLogB("DYN_CloseLibrary: dlerror() reports %s", dlerror());
+#if 0
+ DebugLogB("DYN_CloseLibrary: dlerror() reports %s", dlerror());
+#endif
return SCARD_F_UNKNOWN_ERROR;
}
@@ -70,7 +74,9 @@
if (*pvFHandle == NULL)
{
- //DebugLogB("DYN_GetAddress: dlerror() reports %s", dlerror());
+#if 0
+ DebugLogB("DYN_GetAddress: dlerror() reports %s", dlerror());
+#endif
rv = SCARD_F_UNKNOWN_ERROR;
}
else
Index: hotplug_libusb.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/hotplug_libusb.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- hotplug_libusb.c 7 Sep 2003 18:06:58 -0000 1.9
+++ hotplug_libusb.c 8 Sep 2003 08:50:50 -0000 1.10
@@ -35,14 +35,14 @@
#include "sys_generic.h"
#include "parser.h"
-// PCSCLITE_HP_DROPDIR is defined using ./configure --enable-usbdropdir=foobar
#define PCSCLITE_MANUKEY_NAME "ifdVendorID"
#define PCSCLITE_PRODKEY_NAME "ifdProductID"
#define PCSCLITE_NAMEKEY_NAME "ifdFriendlyName"
#define PCSCLITE_LIBRKEY_NAME "CFBundleExecutable"
-// PCSCLITE_MAX_READERS is defined in pcsclite.h
+
+/* PCSCLITE_MAX_READERS is defined in pcsclite.h */
#define PCSCLITE_MAX_DRIVERS 16
-#define BUS_DEVICE_STRSIZE 256
+#define BUS_DEVICE_STRSIZE 256
#define PCSCLITE_HP_BASE_PORT 0x200000
#define READER_ABSENT 0
@@ -78,7 +78,6 @@
*/
static struct _readerTracker
{
-// short plugged;
char status;
char bus_device[BUS_DEVICE_STRSIZE]; /* device name */
@@ -123,32 +122,32 @@
currFP->d_name, "/Contents/Info.plist");
fullPath[FILENAME_MAX - 1] = '\0';
- // while we find a nth ifdVendorID in Info.plist
+ /* while we find a nth ifdVendorID in Info.plist */
while (LTPBundleFindValueWithKey(fullPath, PCSCLITE_MANUKEY_NAME,
keyValue, alias) == 0)
{
driverTracker[listCount].bundleName = strdup(currFP->d_name);
- // Get ifdVendorID
+ /* Get ifdVendorID */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_MANUKEY_NAME,
keyValue, alias);
if (rv == 0)
driverTracker[listCount].manuID = strtol(keyValue, 0, 16);
- // get ifdProductID
+ /* get ifdProductID */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_PRODKEY_NAME,
keyValue, alias);
if (rv == 0)
driverTracker[listCount].productID =
strtol(keyValue, 0, 16);
- // get ifdFriendlyName
+ /* get ifdFriendlyName */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_NAMEKEY_NAME,
keyValue, alias);
if (rv == 0)
driverTracker[listCount].readerName = strdup(keyValue);
- // get CFBundleExecutable
+ /* get CFBundleExecutable */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_LIBRKEY_NAME,
keyValue, 0);
if (rv == 0)
Index: hotplug_linux.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/hotplug_linux.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- hotplug_linux.c 7 Sep 2003 18:06:58 -0000 1.14
+++ hotplug_linux.c 8 Sep 2003 08:50:50 -0000 1.15
@@ -33,15 +33,17 @@
#include "sys_generic.h"
#include "parser.h"
-// PCSCLITE_HP_DROPDIR is defined using ./configure --enable-usbdropdir=foobar
#define PCSCLITE_USB_PATH "/proc/bus/usb"
+
#define PCSCLITE_MANUKEY_NAME "ifdVendorID"
#define PCSCLITE_PRODKEY_NAME "ifdProductID"
#define PCSCLITE_NAMEKEY_NAME "ifdFriendlyName"
#define PCSCLITE_LIBRKEY_NAME "CFBundleExecutable"
-#define PCSCLITE_HP_MAX_IDENTICAL_READERS 16
-#define PCSCLITE_HP_MAX_SIMUL_READERS 04
-#define PCSCLITE_HP_MAX_DRIVERS 20
+
+/* PCSCLITE_MAX_READERS is defined in pcsclite.h */
+#define PCSCLITE_HP_MAX_IDENTICAL_READERS 16
+#define PCSCLITE_HP_MAX_SIMUL_READERS 04
+#define PCSCLITE_HP_MAX_DRIVERS 20
extern int LTPBundleFindValueWithKey(char *, char *, char *, int);
extern PCSCLITE_MUTEX usbNotifierMutex;
@@ -92,9 +94,6 @@
}
bundleTracker[PCSCLITE_HP_MAX_DRIVERS];
-// static LONG hpManu_id, hpProd_id;
-// static int bundleArraySize;
-
LONG HPReadBundleValues()
{
@@ -129,32 +128,32 @@
currFP->d_name, "/Contents/Info.plist");
fullPath[FILENAME_MAX - 1] = '\0';
- // while we find a nth ifdVendorID in Info.plist
+ /* while we find a nth ifdVendorID in Info.plist */
while (LTPBundleFindValueWithKey(fullPath, PCSCLITE_MANUKEY_NAME,
keyValue, alias) == 0)
{
bundleTracker[listCount].bundleName = strdup(currFP->d_name);
- // Get ifdVendorID
+ /* Get ifdVendorID */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_MANUKEY_NAME,
keyValue, alias);
if (rv == 0)
bundleTracker[listCount].manuID = strtol(keyValue, 0, 16);
- // get ifdProductID
+ /* get ifdProductID */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_PRODKEY_NAME,
keyValue, alias);
if (rv == 0)
bundleTracker[listCount].productID =
strtol(keyValue, 0, 16);
- // get ifdFriendlyName
+ /* get ifdFriendlyName */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_NAMEKEY_NAME,
keyValue, alias);
if (rv == 0)
bundleTracker[listCount].readerName = strdup(keyValue);
- // get CFBundleExecutable
+ /* get CFBundleExecutable */
rv = LTPBundleFindValueWithKey(fullPath, PCSCLITE_LIBRKEY_NAME,
keyValue, 0);
if (rv == 0)
Index: ifdwrapper.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/ifdwrapper.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ifdwrapper.c 13 Aug 2002 21:15:13 -0000 1.4
+++ ifdwrapper.c 8 Sep 2003 08:50:50 -0000 1.5
@@ -796,7 +796,7 @@
DWORD, PUCHAR, PDWORD, PSCARD_IO_HEADER) = NULL;
#endif
- // log the APDU
+ /* log the APDU */
DebugLogCategory(DEBUG_CATEGORY_APDU, pucTxBuffer, dwTxLength);
/*
@@ -872,7 +872,7 @@
* END OF LOCKED REGION
*/
- // log the returned status word
+ /* log the returned status word */
DebugLogCategory(DEBUG_CATEGORY_SW, pucRxBuffer, *pdwRxLength);
if (rv == IFD_SUCCESS)
Index: pcscdaemon.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/pcscdaemon.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- pcscdaemon.c 7 Sep 2003 17:34:42 -0000 1.30
+++ pcscdaemon.c 8 Sep 2003 08:50:50 -0000 1.31
@@ -170,9 +170,11 @@
break;
case 2:
- // timeout in SHMProcessEvents(): do nothing
- // this is used to catch the Ctrl-C signal at some time when
- // nothing else happens
+ /*
+ * timeout in SHMProcessEvents(): do nothing
+ * this is used to catch the Ctrl-C signal at some time when
+ * nothing else happens
+ */
break;
case -1:
@@ -302,12 +304,13 @@
{
#ifdef USE_RUN_PID
- // read the pid file to get the old pid and test if the old pcscd is
- // still running
-
+ /* read the pid file to get the old pid and test if the old pcscd is
+ * still running
+ */
FILE *f;
- // pids are only 15 bits but 4294967296 (32 bits in case of a new
- // system use it) is on 10 bytes
+ /* pids are only 15 bits but 4294967296
+ * (32 bits in case of a new system use it) is on 10 bytes
+ */
#define PID_ASCII_SIZE 11
char pid_ascii[PID_ASCII_SIZE];
int pid;
@@ -326,7 +329,7 @@
return 1;
}
else
- // the old pcscd is dead. make some cleanup
+ /* the old pcscd is dead. make some cleanup */
clean_temp_files();
}
else
@@ -495,14 +498,15 @@
void signal_trap(int sig)
{
- // the signal handler is called several times for the same Ctrl-C
+ /* the signal handler is called several times for the same Ctrl-C */
if (AraKiri == 0)
{
DebugLogA("Preparing for suicide");
AraKiri = 1;
- // if still in the init/loading phase the AraKiri will not be
- // seen by the main event loop
+ /* if still in the init/loading phase the AraKiri will not be
+ * seen by the main event loop
+ */
if (Init)
{
DebugLogA("Suicide during init");
Index: testpcsc.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/testpcsc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testpcsc.c 7 Sep 2003 18:06:58 -0000 1.3
+++ testpcsc.c 8 Sep 2003 08:50:50 -0000 1.4
@@ -1,4 +1,3 @@
-
/******************************************************************
MUSCLE SmartCard Development ( http://www.linuxnet.com )
@@ -29,7 +28,6 @@
SCARDCONTEXT hContext;
SCARD_READERSTATE_A rgReaderStates[1];
unsigned long dwReaderLen, dwState, dwProt, dwAtrLen;
- // unsigned long dwSendLength, dwRecvLength;
unsigned long dwPref, dwReaders;
char *pcReaders, *mszReaders;
unsigned char pbAtr[MAX_ATR_SIZE];
@@ -37,8 +35,9 @@
long rv;
int i, p, iReader;
int iList[16];
-
- // int t = 0;
+#ifdef REPEAT_TEST
+ int t = 0;
+#endif
printf("\nMUSCLE PC/SC Lite Test Program\n\n");
Index: tokenfactory.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/tokenfactory.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- tokenfactory.c 7 Sep 2003 20:36:48 -0000 1.12
+++ tokenfactory.c 8 Sep 2003 08:50:50 -0000 1.13
@@ -325,7 +325,7 @@
} /* if .bundle */
} /* while readdir */
#ifdef WIN32
- // This is part of a Do..While loop (see above)
+ /* This is part of a Do..While loop (see above) */
while (FindNextFile(hFind, &findData) != 0);
#endif
Index: winscard.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- winscard.c 7 Sep 2003 18:06:58 -0000 1.17
+++ winscard.c 8 Sep 2003 08:50:50 -0000 1.18
@@ -402,7 +402,7 @@
rv = RFCheckReaderEventState(rContext, hCard);
switch(rv)
{
- // avoid deadlock
+ /* avoid deadlock */
case SCARD_W_RESET_CARD:
break;
@@ -410,12 +410,12 @@
DebugLogA("SCardReconnect: card removed");
return SCARD_W_REMOVED_CARD;
- // invalid EventStatus
+ /* invalid EventStatus */
case SCARD_E_INVALID_VALUE:
DebugLogA("SCardReconnect: invalid EventStatus");
return SCARD_F_INTERNAL_ERROR;
- // invalid hCard, but hCard was widely used some lines above :(
+ /* invalid hCard, but hCard was widely used some lines above :( */
case SCARD_E_INVALID_HANDLE:
DebugLogA("SCardReconnect: invalid handle");
return SCARD_F_INTERNAL_ERROR;
Index: winscard_clnt.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_clnt.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- winscard_clnt.c 7 Sep 2003 18:06:58 -0000 1.13
+++ winscard_clnt.c 8 Sep 2003 08:50:50 -0000 1.14
@@ -84,7 +84,6 @@
/*
* Thread safety functions
*/
-// static LONG SCardSetupThreadSafety ( );
static LONG SCardLockThread();
static LONG SCardUnlockThread();
@@ -1882,17 +1881,6 @@
return SCARD_S_SUCCESS;
}
}
-
-/*
- * This function sets up the mutex when the first call to EstablishContext
- * is made by the first thread
- */
-
-/*
- * LONG SCardSetupThreadSafety() {
- *
- * #ifdef USE_THREAD_SAFETY return 0; #else return 0; #endif }
- */
/*
* This function locks a mutex so another thread must wait to use this
Index: winscard_msg.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_msg.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- winscard_msg.c 7 Sep 2003 20:28:53 -0000 1.8
+++ winscard_msg.c 8 Sep 2003 08:50:50 -0000 1.9
@@ -249,7 +249,7 @@
}
if (selret == 0)
- // timeout
+ /* timeout */
return 2;
/*
Index: winscard_scf.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_scf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- winscard_scf.c 7 Sep 2003 18:06:58 -0000 1.3
+++ winscard_scf.c 8 Sep 2003 08:50:50 -0000 1.4
@@ -42,10 +42,10 @@
#define PCSC_SCF_MAX_ATR_BUFFER_LENGTH 32
#define PCSC_SCF_MAX_RECV_LEN 265
-//Global session to manage Readers, Card events.
+/* Global session to manage Readers, Card events. */
static SCF_Session_t g_hSession = NULL;
-//Have to define this because they are defined in pcsclite.h as externs
+/* Have to define this because they are defined in pcsclite.h as externs */
SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci;
static struct _psTransmitMap {
@@ -55,7 +55,7 @@
} psTransmitMap[PCSCLITE_MAX_CONTEXTS];
-//Channel Map to manage Card Connections.
+/* Channel Map to manage Card Connections. */
static struct _psChannelMap {
SCARDHANDLE PCSC_hCard;
SCARDCONTEXT hContext;
@@ -67,14 +67,14 @@
int ReaderIndice;
} psChannelMap[PCSCLITE_MAX_CONTEXTS];
-//Context Map to manage contexts and sessions.
+/* Context Map to manage contexts and sessions. */
static struct _psContextMap {
SCARDCONTEXT hContext;
SCF_Session_t hSession;
DWORD contextBlockStatus;
} psContextMap[PCSCLITE_MAX_CONTEXTS];
-//Reader Map to handle Status and GetStatusChange.
+/* Reader Map to handle Status and GetStatusChange. */
static struct _psReaderMap {
SCF_Terminal_t hTerminal;
LPSTR ReaderName;
@@ -86,14 +86,14 @@
} psReaderMap[PCSC_SCF_MAX_READERS];
-//LPSTR ReaderLists = NULL;
-
#ifdef USE_THREAD_SAFETY
static PCSCLITE_MUTEX clientMutex = PTHREAD_MUTEX_INITIALIZER;
-//Mutex for the Smardcard Event Handling, different from client Mutex
-//because event reporting from the ocfserver is done using a single thread,
-//so to get lock on the clientMutex may affect the performance of the ocf server.
+/*
+ * Mutex for the Smardcard Event Handling, different from client Mutex
+ * because event reporting from the ocfserver is done using a single thread,
+ * so to get lock on the clientMutex may affect the performance of the ocf server.
+ */
static PCSCLITE_MUTEX EventMutex = PTHREAD_MUTEX_INITIALIZER;
#endif
@@ -319,8 +319,8 @@
(SCARD_SHARE_DIRECT != dwShareMode) ){
return SCARD_E_INVALID_VALUE;
}
- //TODO Which Protocols have to be supported
- /*Ignoring protocols for now*/
+ /* TODO Which Protocols have to be supported */
+ /* Ignoring protocols for now */
/* Make sure this handle has been opened */
rv = getNewHandle(hContext,szReader,phCard,dwShareMode);
@@ -370,9 +370,9 @@
return SCARD_E_INVALID_HANDLE;
}
- //TODO Take Care of the Disposition...
- /*Resetting the card for SCARD_RESET_CARD |
- SCARD_UNPOWER_CARD | SCARD_EJECT_CARD */
+ /* TODO Take Care of the Disposition... */
+ /* Resetting the card for SCARD_RESET_CARD |
+ SCARD_UNPOWER_CARD | SCARD_EJECT_CARD */
if(SCARD_LEAVE_CARD != dwDisposition) {
/*must acquire the lock to reset card*/
status = SCF_Card_lock(psChannelMap[retIndice].SCF_hCard, 0);
@@ -529,11 +529,11 @@
if(rv != SCARD_S_SUCCESS)
return rv;
- //TODO Take Care of the Disposition...
+ /* TODO Take Care of the Disposition... */
if(SCARD_LEAVE_CARD != dwDisposition) {
status = SCF_Card_reset(psChannelMap[retIndice].SCF_hCard);
if(SCF_STATUS_SUCCESS == status) {
- //reset the isReset for this card
+ /* reset the isReset for this card */
SYS_USleep(10);
SCardEventLock();
psChannelMap[retIndice].isReset = 0;
@@ -560,8 +560,7 @@
if(SCARD_S_SUCCESS != isOCFServerRunning())
return SCARD_E_NO_SERVICE;
- //TODO ....
-
+ /* TODO */
return SCARD_S_SUCCESS;
}
@@ -705,8 +704,6 @@
return the first available reader
*/
if ( cReaders == 0 ) {
- // while (1) {
-
for(i=0;i<PCSC_SCF_MAX_READERS;i++) {
if(psReaderMap[i].ReaderName)
return SCARD_S_SUCCESS;
@@ -839,7 +836,7 @@
currReader->dwEventState |= SCARD_STATE_CHANGED;
dwBreakFlag = 1;
}
- //TO DO ....
+ /* TODO */
if ( 0 && dwState & SCARD_SWALLOWED ) {
if ( currReader->dwCurrentState & SCARD_STATE_MUTE ) {
currReader->dwEventState |= SCARD_STATE_MUTE;
@@ -907,7 +904,7 @@
}
/* Declare all the break conditions */
- //TO DO think about this
+ /* TODO think about this */
if ( psContextMap[retIndice].contextBlockStatus ==
BLOCK_STATUS_RESUME ) {
break;
@@ -917,7 +914,7 @@
if ( ( dwBreakFlag == 1 ) && ( j == 0 ) ) {
break;
}
- } while ( 1 ); // end of do
+ } while ( 1 ); /* end of do */
if ( psContextMap[retIndice].contextBlockStatus ==
BLOCK_STATUS_RESUME ) {
@@ -931,8 +928,7 @@
LONG SCardControl( SCARDHANDLE hCard, LPCBYTE pbSendBuffer, DWORD cbSendLength,
LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength ) {
- //TODO .....
-
+ /* TODO */
return SCARD_S_SUCCESS;
}
@@ -963,8 +959,8 @@
(*pcbRecvLength < 2))
return SCARD_E_INSUFFICIENT_BUFFER;
- //TODO which protocols to support
- //if(pioSendPci && pioSendPci->dwProtocol) {
+ /* TODO which protocols to support */
+ /* if(pioSendPci && pioSendPci->dwProtocol) { */
retIndice = SCardGetHandleIndice(hCard);
if((pbSendBuffer[1] == 0xC0) &&
psTransmitMap[retIndice].isResponseCached) {
@@ -1011,8 +1007,8 @@
}
}
- //TO DO fill the received Pci ...
- //For now just filling the send pci protocol.
+ /* TODO fill the received Pci ... */
+ /* For now just filling the send pci protocol. */
if(pioRecvPci && pioSendPci)
pioRecvPci->dwProtocol = pioSendPci->dwProtocol;
@@ -1217,7 +1213,6 @@
if ( retIndice == -1 ) {
return SCARD_E_INVALID_HANDLE;
}
- //else
SCardEventLock();
SCF_Session_close(psChannelMap[retIndice].hSession);
psChannelMap[retIndice].PCSC_hCard = 0;
@@ -1416,7 +1411,7 @@
if ( retIndice == -1 ) {
return SCARD_E_INVALID_HANDLE;
} else {
- //Free all handles for this context.
+ /* Free all handles for this context. */
for(i=0;i<PCSCLITE_MAX_CONTEXTS;i++) {
if(psChannelMap[i].hContext == hContext) {
SCardRemoveHandle(psChannelMap[i].PCSC_hCard);
@@ -1442,8 +1437,6 @@
if ( retIndice == -1 ) {
return NULL;
}
- //else
-
return(psContextMap[retIndice].hSession);
}
@@ -1502,34 +1495,44 @@
SCF_Status_t status;
- //struct _psReaderMap *readerMap;
- //readerMap = (struct _psReaderMap *) cbdata;
+#if 0
+ struct _psReaderMap *readerMap;
+ readerMap = (struct _psReaderMap *) cbdata;
+#endif
ReaderIndice = (int) cbdata;
SCardEventLock();
switch (eventType) {
case SCF_EVENT_CARDINSERTED:
case SCF_EVENT_CARDPRESENT:
- //printf("card present dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#if 0
+ printf("card present dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#endif
psReaderMap[ReaderIndice].dwCurrentState &= (~(SCARD_STATE_UNKNOWN | SCARD_STATE_UNAVAILABLE | SCARD_STATE_EMPTY));
psReaderMap[ReaderIndice].dwCurrentState |= SCARD_STATE_PRESENT;
- // printf("card present post dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
- // TO DO get the ATR... filled
+#if 0
+ printf("card present post dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#endif
+ /* TODO get the ATR... filled */
status = SCF_Terminal_getCard(psReaderMap[ReaderIndice].hTerminal,
&hCard);
if(SCF_STATUS_SUCCESS == status) {
- //printf("Setting ATR...\n");
+#if 0
+ printf("Setting ATR...\n");
+#endif
PCSC_SCF_getATR(hCard, psReaderMap[ReaderIndice].bAtr,
&psReaderMap[ReaderIndice].dwAtrLength);
- //printf("Atrlen = %d\n",psReaderMap[ReaderIndice].dwAtrLength);
+#if 0
+ printf("Atrlen = %d\n",psReaderMap[ReaderIndice].dwAtrLength);
+#endif
}
- //else
- //printf("getcard failed ret = %x\n", status);
SCF_Card_close(hCard);
break;
case SCF_EVENT_CARDREMOVED:
case SCF_EVENT_CARDABSENT:
- //printf("card absent dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#if 0
+ printf("card absent dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#endif
psReaderMap[ReaderIndice].dwCurrentState &= (~(SCARD_STATE_PRESENT |
SCARD_STATE_EXCLUSIVE |
SCARD_STATE_INUSE |
@@ -1544,11 +1547,12 @@
psChannelMap[i].haveLock = FALSE;
}
}
- //printf("card absent dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
-
+#if 0
+ printf("card absent dwState = %x\n", psReaderMap[ReaderIndice].dwCurrentState);
+#endif
break;
case SCF_EVENT_TERMINALCLOSED:
- //TODO ....
+ /* TODO .... */
break;
case SCF_EVENT_CARDRESET:
for(i=0;i<PCSCLITE_MAX_CONTEXTS;i++) {
@@ -1667,9 +1671,11 @@
return SCARD_W_REMOVED_CARD;
case SCF_STATUS_TIMEOUT:
return SCARD_E_TIMEOUT;
- // case SCF_STATUS_DOUBLELOCK:
- //TODO
+#if 0
+ case SCF_STATUS_DOUBLELOCK:
+ /* TODO */
break;
+#endif
case SCF_STATUS_CARDLOCKED:
return SCARD_E_SHARING_VIOLATION;
case SCF_STATUS_NOSPACE:
@@ -1705,24 +1711,8 @@
}
LONG SCardCheckDaemonAvailability() {
- LONG rv;
+ LONG rv = 1; /* assume it exists */
int fd;
-
- //fd = open( PCSCLITE_SHM_FILE, O_RDWR );
- //if ( fd < 0 ) {
-#ifdef PCSC_DEBUG
- DebugLogA("Error: Cannot open shared file\n", __FILE__, __LINE__);
-#endif
- // }
-
- /* Attempt a passive lock on the shared memory file */
- //rv = SYS_LockFile( fd );
-
- //close(fd);
-
- /* If the lock succeeds then the daemon is not there,
- otherwise if an error is returned then it is
- */
if ( rv == 0 ) {
return SCARD_E_NO_SERVICE;