[Pcsclite-cvs-commit] CVS Drivers/ccid/src

CVS User rousseau ludovic.rousseau@free.fr
Mon, 02 May 2005 09:21:57 +0000


Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv24235

Modified Files:
	ifdhandler.c 
Log Message:
IFDHSetProtocolParameters(): check if the baud rate is present in the
baud rates list only if the list is present. Otherwise we use the old
behavior.


--- /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c	2005/04/27 14:08:35	1.70
+++ /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c	2005/05/02 09:21:56	1.71
@@ -17,7 +17,7 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */
 
-/* $Id: ifdhandler.c,v 1.70 2005/04/27 14:08:35 rousseau Exp $ */
+/* $Id: ifdhandler.c,v 1.71 2005/05/02 09:21:56 rousseau Exp $ */
 
 #include <stdio.h>
 #include <string.h>
@@ -480,10 +480,15 @@
 				* ATR_DEFAULT_D / ATR_DEFAULT_F);
 
 			/* if the card does not try to lower the default speed */
-			if (card_baudrate > default_baudrate)
+			if ((card_baudrate > default_baudrate)
+				/* and the reader is fast enough */
+				&& (card_baudrate <= ccid_desc->dwMaxDataRate))
 			{
-				if (find_baud_rate(card_baudrate,
-					ccid_desc->arrayOfSupportedDataRates))
+				/* the reader has no baud rates table */
+				if ((NULL == ccid_desc->arrayOfSupportedDataRates)
+					/* or explicitely support it */
+					|| find_baud_rate(card_baudrate,
+						ccid_desc->arrayOfSupportedDataRates))
 				{
 					pps[1] |= 0x10; /* PTS1 presence */
 					pps[2] = atr.ib[0][ATR_INTERFACE_BYTE_TA].value;