[Pcsclite-git-commit] [pcsc-tools] 16/32: pcsc_scan: add the animation

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu May 4 15:44:48 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 aade0b9eeb1da7c27305577999944bdc510bb777
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sat Apr 8 14:57:12 2017 +0200

    pcsc_scan: add the animation
    
    use the spin_* function
---
 pcsc_scan.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pcsc_scan.c b/pcsc_scan.c
index 1c2cb89..7717d4a 100644
--- a/pcsc_scan.c
+++ b/pcsc_scan.c
@@ -315,6 +315,8 @@ get_readers:
 		nbReaders++;
 	}
 
+	spin_start();
+
 	/* Wait endlessly for all events in the list of readers
 	 * We only stop in case of an error
 	 */
@@ -327,18 +329,25 @@ get_readers:
 		{
 			if (rgReaderStates_t[nbReaders-1].dwEventState &
 					SCARD_STATE_CHANGED)
+			{
+				spin_suspend();
 				goto get_readers;
+			}
 		}
 		else
 		{
 			/* A new reader appeared? */
 			if ((SCardListReaders(hContext, NULL, NULL, &dwReaders)
 				== SCARD_S_SUCCESS) && (dwReaders != dwReadersOld))
+			{
+				spin_suspend();
 				goto get_readers;
+			}
 		}
 
 		if (rv != SCARD_E_TIMEOUT)
 		{
+			spin_suspend();
 			/* Timestamp the event as we get notified */
 			t = time(NULL);
 			printf("\n%s", ctime(&t));
@@ -365,6 +374,8 @@ get_readers:
 			 * above.
 			 */
 
+			spin_suspend();
+
 			/* Specify the current reader's number and name */
 			printf(" Reader %d: %s%s%s\n", current_reader,
 				magenta, rgReaderStates_t[current_reader].szReader,
@@ -453,8 +464,12 @@ get_readers:
 
 		rv = SCardGetStatusChange(hContext, TIMEOUT, rgReaderStates_t,
 			nbReaders);
+
+		spin_update();
 	} /* while */
 
+	spin_suspend();
+
 	/* A reader disappeared */
 	if (SCARD_E_UNKNOWN_READER == rv)
 		goto get_readers;

-- 
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