Skip to content

Commit

Permalink
reader-pscs: Set flag denoting change when reader is removed
Browse files Browse the repository at this point in the history
When removed reader is detected for the first time,
set SC_READER_CARD_CHANGED denoting change. Remove
the flag, when the condition is hit again.
  • Loading branch information
xhanulik committed Jun 15, 2023
1 parent f16e698 commit d8e661d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libopensc/reader-pcsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,13 @@ static int refresh_attributes(sc_reader_t *reader)
|| rv == (LONG)SCARD_E_NO_READERS_AVAILABLE
#endif
|| rv == (LONG)SCARD_E_SERVICE_STOPPED) {
reader->flags &= ~(SC_READER_CARD_PRESENT);
/* Set flag when state changes */
if (reader->flags & SC_READER_REMOVED) {
reader->flags &= ~SC_READER_CARD_CHANGED;
} else {
reader->flags |= SC_READER_CARD_CHANGED;
}
reader->flags &= ~SC_READER_CARD_PRESENT;
reader->flags |= SC_READER_REMOVED;
priv->gpriv->removed_reader = reader;
SC_FUNC_RETURN(reader->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
Expand Down

0 comments on commit d8e661d

Please sign in to comment.