Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hotplug Events #2051

Merged
merged 3 commits into from Jun 9, 2020
Merged

Fix Hotplug Events #2051

merged 3 commits into from Jun 9, 2020

Conversation

frankmorgner
Copy link
Member

Fixes #2021

Checklist
  • PKCS#11 module is tested
  • Windows minidriver is tested
  • macOS tokend is tested

By Jabuk Jelen

Fixes OpenSC#2021
@Jakuje
Copy link
Member

Jakuje commented Jun 5, 2020

Tested with one physical card reader with card and yubikey. Works much better now, but the yubikey insertion yields two events (or the state is not correctly updated after the reader insertion?) if I see right. The second call to C_WaitForSlotEvent after inserting yubikey returns immediately with event on slot 1, while the first call has event on different slot ID (hotplug ID?). Not sure if this is intentional or not.

Attaching PKCS11 trace:
yk_hotplug.log

fixes delayed notification for removed readers

closes OpenSC#2021
before 14e3962 sc_wait_for_event() only notified in case of a new
reader, but didn't add it to the internal list of readers. That's why
PKCS#11 needed to bail out early in this case (and the application had
to call C_WaitForSlotEvent a second time to actually get the related
slot). Since sc_wait_for_event() can now handle insertion correctly, we
can now immediately check (and reset) the events on the slots.
@frankmorgner
Copy link
Member Author

I've pushed a fix for detecting a new card twice. Could you please check again?

@Jakuje
Copy link
Member

Jakuje commented Jun 8, 2020

Looks good now. Weirdly enough, when I tried if it will detect insertion of empty reader, it did not, but given that empty reader is not useful for anything, I think it is fine. Hopefully it will not break anything else.

Tested also with opensc-notify, which looks like doing detecting the same events too.

@frankmorgner frankmorgner merged commit 36247d8 into OpenSC:master Jun 9, 2020
@frankmorgner frankmorgner deleted the hotplug branch June 21, 2021 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C_WaitForSlotEvent not returning.
2 participants