[Pcsclite-git-commit] [pcsc-tools] 14/32: pcsc_scan: remove timeout variable

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu May 4 15:44:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository pcsc-tools.

commit 583761bb85df0e0651d38fe7a99d5e17bfabfc57
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sat Apr 8 14:44:06 2017 +0200

    pcsc_scan: remove timeout variable
    
    The timeout is now always 1000 ms even if hot plug is supported.
    The idea is to add an animation every 1 second.
---
 pcsc_scan.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/pcsc_scan.c b/pcsc_scan.c
index 53fac9d..aa3b718 100644
--- a/pcsc_scan.c
+++ b/pcsc_scan.c
@@ -77,7 +77,6 @@ int main(int argc, char *argv[])
 	SCARD_READERSTATE *rgReaderStates_t = NULL;
 	SCARD_READERSTATE rgReaderStates[1];
 	DWORD dwReaders = 0, dwReadersOld;
-	DWORD timeout;
 	LPSTR mszReaders = NULL;
 	char *ptr, **readers = NULL;
 	int nbReaders, i;
@@ -156,13 +155,11 @@ int main(int argc, char *argv[])
 	rv = SCardGetStatusChange(hContext, 0, rgReaderStates, 1);
 	if (rgReaderStates[0].dwEventState & SCARD_STATE_UNKNOWN)
 	{
-		timeout = TIMEOUT;
-		printf("%sPlug'n play reader name not supported. Using polling every %ld ms.%s\n", magenta, timeout, color_end);
+		printf("%sPlug'n play reader name not supported. Using polling every %d ms.%s\n", magenta, TIMEOUT, color_end);
 		pnp = FALSE;
 	}
 	else
 	{
-		timeout = INFINITE;
 		printf("%sUsing reader plug'n play mechanism%s\n", magenta, color_end);
 	}
 
@@ -298,7 +295,7 @@ get_readers:
 	/* Wait endlessly for all events in the list of readers
 	 * We only stop in case of an error
 	 */
-	rv = SCardGetStatusChange(hContext, timeout, rgReaderStates_t, nbReaders);
+	rv = SCardGetStatusChange(hContext, TIMEOUT, rgReaderStates_t, nbReaders);
 	while ((rv == SCARD_S_SUCCESS) || (rv == SCARD_E_TIMEOUT))
 	{
 		time_t t;
@@ -431,7 +428,7 @@ get_readers:
 			}
 		} /* for */
 
-		rv = SCardGetStatusChange(hContext, timeout, rgReaderStates_t,
+		rv = SCardGetStatusChange(hContext, TIMEOUT, rgReaderStates_t,
 			nbReaders);
 	} /* while */
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/pcsc-tools.git



More information about the Pcsclite-cvs-commit mailing list