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

USBError not returning error #11

Open
skyice78 opened this issue Sep 8, 2020 · 2 comments
Open

USBError not returning error #11

skyice78 opened this issue Sep 8, 2020 · 2 comments

Comments

@skyice78
Copy link

skyice78 commented Sep 8, 2020

"get_packet" module not returning exception with USBError in window 10(libusb-win32 devices) environment when usb connection lost. ex.errno return empty during the exception and it get treat as regular TimooutError(). Do not see the same issue in linux environment. The temporary get around I implement was adding below code to "def get_pcaket(self, deadline):"

starttime=time.monotocis() right before timeout = max(int((deadline-starttime)*1000),0)

adding below code to the except usb.core.USBError as ex:
endtime=time.monotonic()
ret_time=(endtime-starttime)*1000

then capture the error using ret_time at

if ex.errno ==19 or ex.errno ==32 or ret_time==0:

this temporary solution allow the code to catch if the USB connection was unplugged accidentally. Looking forward for permanent solution. Thanks!!

@samuelsadok
Copy link
Owner

The Python implementation of Fibre will very soon be replaced by a C/C++ implementation and a thin Python wrapper that binds to the compiled library.

I will check if the new implementation still suffers problems with unplug events on Windows.

@skyice78
Copy link
Author

skyice78 commented Oct 4, 2020

Thanks!!

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

No branches or pull requests

2 participants