Commit aade0b9e authored by Ludovic Rousseau's avatar Ludovic Rousseau

pcsc_scan: add the animation

use the spin_* function
parent 2921f884
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment