-
Notifications
You must be signed in to change notification settings - Fork 709
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
C_WaitForSlotEvent not returning. #2021
Comments
Can you reproduce this with |
I can reproduce it with this tool. But I also found a sequence where card insertion was detected with C_WaitForSlotEvent but then removal was not possible to detect. The trick was to first detect a card using C_GetSlotList and then detect the empty slot also using C_GetSlotList. After this when continuing with C_WaitForSlotEvent the card insertion was detected but later it was not possible to detect removal. Anyway here is a sequence that is always failing and must work:
In the revision before information about the card is printed at step 7. |
I just tested with current master and it seems to work fine for me. Could you share also complete opensc debug logs of opensc? In your trace, I can see that the |
C_WaitForSlotEvent is called but since it is not returning nothing is printed in the log. I had to stop my application with ctrl-C . |
If it would be blocked inside of
Thanks. |
Here you got the logs for the test described here #2021 (comment) : The spy is not printing anything until a function returns. I also did same test with the 2c26b73 commit removed from the master branch with the following result: You can get the my fixed master from my repository https://github.com/larssilven/OpenSC . Just do: |
Comparing the debug logs I collected from the test, the main problem is in From my understanding, it is because the new code newly stores |
This patch makes your use case working:
Can you check it works fine for you too? But neither current master nor with this patch I am able to get reader (yubikey) hotplug working. |
It is working as it should with the patch applied, both with "pkcs11-tool --test-hotplug" and my application. Thank you! |
It will probably need some more work to have also the reader hotplug events working (for example for yubikey). This was just the minimal patch "revert" to unbreak card hotplug as it was working before. I am not sure what was the intention of this part of the code. @frankmorgner ? I can probably have a better look into that, but not sure when. |
By Jabuk Jelen Fixes OpenSC#2021
fixes delayed notification for removed readers closes OpenSC#2021
I've created #2051 with the suggested fix. I remember that I've copied the part in question from the existing code without completely retracing its effect. I've additionally verified I've also noticed that hotplug events were propagated delayed (if not waiting infinitely). I've fixed that as well in the PR... I'll try to check on Windows once CI finishes. |
fixes delayed notification for removed readers closes OpenSC#2021
fixes delayed notification for removed readers closes #2021
Problem Description
C_WaitForSlotEvent is not returning when a card is inserted or removed since commit 2c26b73 to the master branch.
Proposed Resolution
Fix the bug.
Steps to reproduce
Call C_WaitForSlotEvent with the slot ID of a reader without a card.
The function will not return when a card is inserted.
Logs
PKCS#11 spy logs before and after the commit referenced above.
Version before the commit:
0.20.0-215-g7893d286.log
The commited version:
0.20.0-216-g2c26b739.log
The text was updated successfully, but these errors were encountered: