SYNOPSIS
-
#include <opensc.h>
int sc_wait_for_event(sc_reader_t *readers[], int slots[], size_t numslots,
unsigned int event_mask,
int *reader, unsigned int *event, int timeout);
DESCRIPTION
This function blocks until an event occurs on any of the readers/slots specified. The readers and slots fields list the readers and respective slots to be watched. num_slots holds the total number of slots passed. The event_mask parameter specifies the types of events to wait for. This may be a combination of the following flags:
SC_EVENT_CARD_REMOVED
- A card was removed from the reader/slot.
SC_EVENT_CARD_INSERTED
- A card was inserted into the reader/slot.
On returning, the reader parameter holds the reader which generated an event, and event holds the event flag, as in event_mask.
The timeout parameter may be used to specify the maximum amount of time to wait for an event, in milliseconds. This may be set to -1 to wait forever.
RETURN VALUE
Returns 0 if successful, 1 if a timeout occurred, or a negative value in case of error.