-
Notifications
You must be signed in to change notification settings - Fork 110
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
Waits forever while calling hid.list_devices() #140
Comments
Hi. What OS are you running? Do you know what circumstances cause the problem of a device hanging to occur? Also, can you test the latest pre-release, |
Hi, |
Is this only occurring with a virtual HID driver, as in not an actual device? I'm trying to figure out here is this is something that actually happen unexpectedly or if you have to explicitly provoke it with a fake device. |
I've seen this issue with my device once about two months ago. Then I tried to make a test scenario with this fake virtual HID device. I was expecting that the library should do something when the connected HID device is not responding (As the windows hello webauthn.dll handles this situation somehow). For example, the security key is crashed (For some unknown or unreal reason), its driver failed, or something unexpected happens. |
Could you try modifying your fido2/hid/windows.py WinCtapHidConnection.init method to the following, and see if that makes a difference? from threading import Timer
class WinCtapHidConnection(CtapHidConnection):
def __init__(self, descriptor):
self.descriptor = descriptor
timer = Timer(1.0, kernel32.CancelSynchronousIo, [kernel32.GetCurrentThread()])
timer.start()
self.handle = kernel32.CreateFileA(
descriptor.path,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
None,
OPEN_EXISTING,
0,
None,
)
timer.cancel()
if self.handle == INVALID_HANDLE_VALUE:
raise WinError() |
No, it didn't help. |
Is there anything you can share with me that would help me be able to reproduce this on my end? Maybe I could set up the virtual HID device myself? |
There is a problem with the method list_devices() inside
fido2/hid/__init__.py
. It opens a connection to the fido security key HID device, and after a successful connection, it yields the device as the next found device. If the HID device has a problem and does not answer theopen_connection()
request, it waits forever. What I did to solve the problem was add a timeout to theopen_connection()
function call:I'm using the PyPI installed version of the library: fido2==0.9.3
The text was updated successfully, but these errors were encountered: