[Pcsclite-cvs-commit] HandlerTest/Host handler_test.c,1.5,1.6

rousseau@quantz.debian.org rousseau@quantz.debian.org
Thu, 29 Jan 2004 15:19:08 +0100


Update of /cvsroot/pcsclite/HandlerTest/Host
In directory quantz:/tmp/cvs-serv29670

Modified Files:
	handler_test.c 
Log Message:
add support of IFDHCreateChannelByName


Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- handler_test.c	27 Jan 2004 14:49:51 -0000	1.5
+++ handler_test.c	29 Jan 2004 14:19:05 -0000	1.6
@@ -35,6 +35,10 @@
 #define LUN 0
 #define ENV_LIBNAME "LIB"
 
+/* define DEVICE_NAME if yo want to use
+ * IFDHCreateChannelByName instead of IFDHCreateChannel */
+/* #define DEVICE_NAME "usb:08e6/3437" */
+
 #ifndef TRUE
 #define TRUE 1
 #define FALSE 0
@@ -65,6 +69,7 @@
 
 struct f_t {
 	RESPONSECODE (*IFDHCreateChannel)(DWORD, DWORD);
+	RESPONSECODE (*IFDHCreateChannelByName)(DWORD, PUCHAR);
 	RESPONSECODE (*IFDHCloseChannel)(DWORD);
 	//RESPONSECODE IFDHGetCapabilities ( DWORD, DWORD, PDWORD, PUCHAR );
 	//RESPONSECODE IFDHSetCapabilities ( DWORD, DWORD, DWORD, PUCHAR );
@@ -203,6 +208,7 @@
 	}
 
 	DLSYM(IFDHCreateChannel)
+	DLSYM(IFDHCreateChannelByName)
 	DLSYM(IFDHCloseChannel)
 	DLSYM(IFDHPowerICC)
 	DLSYM(IFDHTransmitToICC)
@@ -228,6 +234,17 @@
 	int time;
 	int start, end;
 
+#ifdef DEVICE_NAME
+	rv = f.IFDHCreateChannelByName(lun, DEVICE_NAME);
+
+	if (rv != IFD_SUCCESS)
+	{
+		printf("IFDHCreateChannelByName: %d\n", rv);
+		printf("\nAre you sure a CCID reader is connected?\n");
+		printf("and that you have read/write permission on the device?\n");
+		return 1;
+	}
+#else
 	rv = f.IFDHCreateChannel(lun, channel);
 
 	if (rv != IFD_SUCCESS)
@@ -237,6 +254,7 @@
 		printf("and that you have read/write permission on the device?\n");
 		return 1;
 	}
+#endif
 
 	rv = f.IFDHICCPresence(LUN);
 	pcsc_error(rv);