[Pcsclite-cvs-commit] HandlerTest/Host handler_test.c,1.13,1.14
   
    rousseau@haydn.debian.org
     
    rousseau@haydn.debian.org
       
    
    
        -  Previous message: [Pcsclite-cvs-commit] PCSC/src tokenfactory.c,1.21,1.22
-  Next message: [Pcsclite-cvs-commit] Drivers/ccid/src ccid.c,1.7,1.8 ccid.h,1.7,1.8 ccid_ifdhandler.h,1.9,1.10 ccid_serial.c,1.13,1.14 ccid_serial.h,1.4,1.5 ccid_usb.c,1.26,1.27 ccid_usb.h,1.8,1.9 commands.c,1.20,1.21 commands.h,1.8,1.9 ifdhandler.c,1.34,1.35
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
  
Update of /cvsroot/pcsclite/HandlerTest/Host
In directory haydn:/tmp/cvs-serv6393
Modified Files:
	handler_test.c 
Log Message:
check the version of the IFDHandler and only use IFDHControl() with an
v3.0 API driver
Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- handler_test.c	22 Jun 2004 11:35:12 -0000	1.13
+++ handler_test.c	8 Jul 2004 16:57:24 -0000	1.14
@@ -79,6 +79,7 @@
 	  			   PSCARD_IO_HEADER);
 	RESPONSECODE (*IFDHControl)(DWORD, DWORD, PUCHAR, DWORD, PUCHAR, DWORD, PDWORD);
 	RESPONSECODE (*IFDHICCPresence)(DWORD);
+	int version;
 };
 
 struct f_t f = { NULL, NULL, NULL, NULL, NULL };
@@ -234,12 +235,21 @@
 	DLSYM(IFDHControl)
 
 	f.IFDHCreateChannelByName = dlsym(lib_handle, "IFDHCreateChannelByName");
-	if (f.IFDHCreateChannelByName == NULL && device_name)
+	if (f.IFDHCreateChannelByName == NULL)
 	{
-		printf("IFDHCreateChannelByName not defined by the driver and device_name set\n");
-		return 1;
+		f.version = IFD_HVERSION_2_0;
+
+		/* API v2.0 does not have IFDHCreateChannelByName */
+		if (device_name)
+		{
+			printf("IFDHCreateChannelByName not defined by the driver and device_name set\n");
+			return 1;
+		}
 	}
+	else
+		f.version = IFD_HVERSION_3_0;
 
+	printf("%s:%d\n", __FILE__, __LINE__);
 	ret = handler_test(LUN, channel, device_name);
 	dlclose(lib_handle);
 
@@ -289,6 +299,7 @@
 
 #define IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE     SCARD_CTL_CODE(1)
 
+	if (f.version >= IFD_HVERSION_3_0)
 	{
 		unsigned char cmd[] = "\x02";
 		unsigned char res[100];
    
    
        
	-  Previous message: [Pcsclite-cvs-commit] PCSC/src tokenfactory.c,1.21,1.22
-  Next message: [Pcsclite-cvs-commit] Drivers/ccid/src ccid.c,1.7,1.8 ccid.h,1.7,1.8 ccid_ifdhandler.h,1.9,1.10 ccid_serial.c,1.13,1.14 ccid_serial.h,1.4,1.5 ccid_usb.c,1.26,1.27 ccid_usb.h,1.8,1.9 commands.c,1.20,1.21 commands.h,1.8,1.9 ifdhandler.c,1.34,1.35
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]