From cb15dfe6be6a1e39ea8bb77b2554e48cf35f57cb Mon Sep 17 00:00:00 2001 From: Martin Paljak Date: Tue, 7 Mar 2023 21:24:02 +0200 Subject: [PATCH] Ignore exclusively open readers --- src/main/java/pro/javacard/nfc4pc/NFC4PC.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/pro/javacard/nfc4pc/NFC4PC.java b/src/main/java/pro/javacard/nfc4pc/NFC4PC.java index 0d62410..bab739e 100644 --- a/src/main/java/pro/javacard/nfc4pc/NFC4PC.java +++ b/src/main/java/pro/javacard/nfc4pc/NFC4PC.java @@ -143,9 +143,11 @@ public void readerListChanged(List list) { Map newStates = new HashMap<>(); list.forEach(e -> newStates.put(e.getName(), e.isPresent())); - for (String n : newStates.keySet()) { - // TODO: ignore exclusive readers - if (newStates.get(n) && !readerStates.getOrDefault(n, false)) { + for (PCSCReader e : list) { + String n = e.getName(); + if (e.isExclusive()) { + log.debug("Ignoring exclusively in use reader \"{}\"", n); + } else if (newStates.get(n) && !readerStates.getOrDefault(n, false)) { log.debug("Detected change in reader \"{}\"", n); MainWrapper.tapCounter.incrementAndGet(); setTooltip();