reader-pcsc: allow no attached reader for notification
Return an error only on OS X, where PnP notification is not supported.
This commit is contained in:
parent
b0a85a1497
commit
496e2afc9e
|
@ -1459,7 +1459,8 @@ static int pcsc_wait_for_event(sc_context_t *ctx, unsigned int event_mask, sc_re
|
||||||
rgReaderStates[i].dwCurrentState = SCARD_STATE_UNAWARE;
|
rgReaderStates[i].dwCurrentState = SCARD_STATE_UNAWARE;
|
||||||
rgReaderStates[i].dwEventState = SCARD_STATE_UNAWARE;
|
rgReaderStates[i].dwEventState = SCARD_STATE_UNAWARE;
|
||||||
}
|
}
|
||||||
#ifndef __APPLE__ /* OS X 10.6.2 does not support PnP notification */
|
#ifndef __APPLE__
|
||||||
|
/* OS X 10.6.2 - 10.12.6 do not support PnP notification */
|
||||||
if (event_mask & SC_EVENT_READER_ATTACHED) {
|
if (event_mask & SC_EVENT_READER_ATTACHED) {
|
||||||
rgReaderStates[i].szReader = "\\\\?PnP?\\Notification";
|
rgReaderStates[i].szReader = "\\\\?PnP?\\Notification";
|
||||||
rgReaderStates[i].dwCurrentState = SCARD_STATE_UNAWARE;
|
rgReaderStates[i].dwCurrentState = SCARD_STATE_UNAWARE;
|
||||||
|
@ -1492,12 +1493,14 @@ static int pcsc_wait_for_event(sc_context_t *ctx, unsigned int event_mask, sc_re
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
if (num_watch == 0) {
|
if (num_watch == 0) {
|
||||||
sc_log(ctx, "No readers available, PnP notification not supported");
|
sc_log(ctx, "No readers available, PnP notification not supported");
|
||||||
*event_reader = NULL;
|
*event_reader = NULL;
|
||||||
r = SC_ERROR_NO_READERS_FOUND;
|
r = SC_ERROR_NO_READERS_FOUND;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
rv = gpriv->SCardGetStatusChange(gpriv->pcsc_wait_ctx, 0, rgReaderStates, num_watch);
|
rv = gpriv->SCardGetStatusChange(gpriv->pcsc_wait_ctx, 0, rgReaderStates, num_watch);
|
||||||
if (rv != SCARD_S_SUCCESS) {
|
if (rv != SCARD_S_SUCCESS) {
|
||||||
|
|
Loading…
Reference in New Issue