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

CVS User rousseau ludovic.rousseau@free.fr
Wed, 27 Apr 2005 13:35:19 +0000


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

Modified Files:
	ccid_serial.c 
Log Message:
OpenSerialByName(): inhibit the Plug-n-Play string by setting the RTS
signal to low. Mainly useful for the GemPC Card (PCMCIA)


--- /cvsroot/pcsclite/Drivers/ccid/src/ccid_serial.c	2005/04/27 12:09:26	1.37
+++ /cvsroot/pcsclite/Drivers/ccid/src/ccid_serial.c	2005/04/27 13:35:19	1.38
@@ -20,7 +20,7 @@
  */
 
 /*
- * $Id: ccid_serial.c,v 1.37 2005/04/27 12:09:26 rousseau Exp $
+ * $Id: ccid_serial.c,v 1.38 2005/04/27 13:35:19 rousseau Exp $
  */
 
 #include <stdio.h>
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#include <sys/ioctl.h>
 #include <PCSC/ifdhandler.h>
 
 #include "defs.h"
@@ -548,6 +549,30 @@
 		return STATUS_UNSUCCESSFUL;
 	}
 
+	/* Set RTS signal to low to prevent the smart card reader
+	 * from sending its plug and play string. */
+	{
+		int flags;
+
+		if (ioctl(serialDevice[reader].fd, TIOCMGET, &flags) < 0)
+		{
+			DEBUG_CRITICAL2("Get RS232 signals state failed: %s",
+				strerror(errno));
+		}
+		else
+		{
+			flags &= ~TIOCM_RTS;
+			if (ioctl(serialDevice[reader].fd, TIOCMSET, &flags) < 0)
+			{
+				DEBUG_CRITICAL2("Set RTS to low failed: %s", strerror(errno));
+			}
+			else
+			{
+				DEBUG_COMM("Plug-n-Play inhibition successful");
+			}
+		}
+	}
+
 	/* set channel used */
 	serialDevice[reader].device = strdup(dev_name);