[Pcsclite-cvs-commit] r6992 - trunk/pcsc-tools

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Thu Sep 18 12:52:37 UTC 2014


Author: rousseau
Date: 2014-09-18 12:52:37 +0000 (Thu, 18 Sep 2014)
New Revision: 6992

Modified:
   trunk/pcsc-tools/pcsc_scan.c
Log:
Use "\\?PnP?\Notification" reader only if supported

Add the special reader "\\?PnP?\Notification" only if the Plug and Play
feature is supported by the PC/SC layer (it is supported on GNU/Linux
but not on Mac OS X).

Thanks to Santiago Gimeno for the suggestion
https://github.com/santigimeno/node-pcsclite/issues/14#issuecomment-56031963


Modified: trunk/pcsc-tools/pcsc_scan.c
===================================================================
--- trunk/pcsc-tools/pcsc_scan.c	2014-09-17 13:16:12 UTC (rev 6991)
+++ trunk/pcsc-tools/pcsc_scan.c	2014-09-18 12:52:37 UTC (rev 6992)
@@ -282,15 +282,18 @@
 		rgReaderStates_t[i].dwCurrentState = SCARD_STATE_UNAWARE;
 		rgReaderStates_t[i].cbAtr = sizeof rgReaderStates_t[i].rgbAtr;
 	}
-	rgReaderStates_t[nbReaders].szReader = "\\\\?PnP?\\Notification";
-	rgReaderStates_t[nbReaders].dwCurrentState = SCARD_STATE_UNAWARE;
 
+	/* If Plug and Play is supported by the PC/SC layer */
+	if (pnp)
+	{
+		rgReaderStates_t[nbReaders].szReader = "\\\\?PnP?\\Notification";
+		rgReaderStates_t[nbReaders].dwCurrentState = SCARD_STATE_UNAWARE;
+		nbReaders++;
+	}
+
 	/* Wait endlessly for all events in the list of readers
 	 * We only stop in case of an error
 	 */
-	if (pnp)
-		nbReaders++;
-
 	rv = SCardGetStatusChange(hContext, timeout, rgReaderStates_t, nbReaders);
 	while ((rv == SCARD_S_SUCCESS) || (rv == SCARD_E_TIMEOUT))
 	{




More information about the Pcsclite-cvs-commit mailing list