[Pcsclite-cvs-commit] r6785 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Thu Oct 24 14:04:14 UTC 2013


Author: rousseau
Date: 2013-10-24 14:04:14 +0000 (Thu, 24 Oct 2013)
New Revision: 6785

Modified:
   trunk/PCSC/src/configfile.l
Log:
CHANNELID and DEVICENAME are both optional but not at the same time

If the driver uses DEVICENAME you can ignore/unset CHANNELID.
If the driver uses CHANNELID you can ignore/unset DEVICENAME.
But you shall configure at least one of the two parameters.


Modified: trunk/PCSC/src/configfile.l
===================================================================
--- trunk/PCSC/src/configfile.l	2013-10-24 09:46:35 UTC (rev 6784)
+++ trunk/PCSC/src/configfile.l	2013-10-24 14:04:14 UTC (rev 6785)
@@ -178,12 +178,14 @@
 		pcPrevious = NULL;
 	}
 
-	if (pcFriendlyname != NULL &&
-		pcLibpath != NULL && pcChannelid != NULL && badError != 1)
+	/* CHANNELID and DEVICENAME are both optional but not at the same time */
+	if (pcFriendlyname && pcLibpath && badError != 1
+		&& (pcChannelid || pcDevicename))
 	{
 		int channelId;
 		static char* defaultDeviceName = (char *)"";
 
+		Log2(PCSC_LOG_DEBUG, "Add reader: %s", pcFriendlyname);
 		if (0 == reader_list_size)
 		{
 			/* one real reader and one end marker */
@@ -204,7 +206,10 @@
 		if (NULL == pcDevicename)
 			pcDevicename = defaultDeviceName;
 
-		channelId = strtoul(pcChannelid, NULL, 0);
+		if (pcChannelid)
+			channelId = strtoul(pcChannelid, NULL, 0);
+		else
+			channelId = 0;
 		reader_list[reader_list_size-2].pcFriendlyname = strdup(pcFriendlyname);
 		reader_list[reader_list_size-2].pcDevicename = strdup(pcDevicename);
 		reader_list[reader_list_size-2].pcLibpath = strdup(pcLibpath),
@@ -220,7 +225,8 @@
 		free(pcLibpath);
 		pcLibpath = NULL;
 
-		free(pcChannelid);
+		if (pcChannelid)
+			free(pcChannelid);
 		pcChannelid = NULL;
 	}
 




More information about the Pcsclite-cvs-commit mailing list