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

rousseau@quantz.debian.org rousseau@quantz.debian.org
Tue, 27 Jan 2004 15:49:53 +0100


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

Modified Files:
	handler_test.c 
Log Message:
add support for T=1 protocol in SendPci.Protocol


Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- handler_test.c	29 Oct 2003 21:30:33 -0000	1.4
+++ handler_test.c	27 Jan 2004 14:49:51 -0000	1.5
@@ -90,6 +90,7 @@
 char cases = 0;
 char tpdu = FALSE;
 char apdu = FALSE;
+char t1 = FALSE;
 
 /* getopt(3) */
 extern char *optarg;
@@ -107,6 +108,7 @@
 	printf("  -4 : test CASE 4 APDU\n");
 	printf("  -A : use APDU\n");
 	printf("  -T : use TPDU\n");
+	printf("  -Z : use T=1 instead of default T=0\n");
 	printf("  libname : driver to load\n");
 	printf("  channel : channel to use (for a serial driver)\n\n");
 	printf("example: %s /usr/lib/pcsc/drivers/serial/libGemPC410.so 2\n",
@@ -126,7 +128,7 @@
 	char *driver;
 	int opt;
 
-	while ((opt = getopt(argc, argv, "ft:1234AT")) != EOF)
+	while ((opt = getopt(argc, argv, "ft:1234ATZ")) != EOF)
 	{
 		switch (opt)
 		{
@@ -158,6 +160,11 @@
 				printf("Use TPDU\n");
 				break;
 
+			case 'Z':
+				t1 = TRUE;
+				printf("Use T=1\n");
+				break;
+
 			default:
 				printf ("caractère: %c (0x%02X)\n", opt, opt);
 				help(argv[0]);
@@ -181,7 +188,7 @@
 	else
 	{
 		// channel
-		if (argc - optind > 1)
+		if (argc - optind >= 1)
 			channel = atoi(argv[optind]);
 	}
 
@@ -248,6 +255,8 @@
 	pcsc_error(rv);
 
 	memset(&SendPci, 0, sizeof(SendPci));
+	SendPci.Protocol = t1;
+
 	memset(&RecvPci, 0, sizeof(RecvPci));
 
 	/* Select applet */
@@ -667,7 +676,7 @@
 			break;
 
 		default:
-			DEBUG2("IFD: undocumented error: %d", rv);
+			DEBUG2("IFD: undocumented error: %X", rv);
 	}
 } /* pcsc_error */