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

LIBUSB_ERROR_ACCESS from usb1 on Windows under unknown circumstances with CW Connect #386

Open
colinoflynn opened this issue Jan 22, 2022 · 0 comments

Comments

@colinoflynn
Copy link
Contributor

colinoflynn commented Jan 22, 2022

Have seen an issue on a specific Python install on Windows 11, with:

  • Python = Python 3.7.12
  • libusb1 = 2.0.1 (seems to happen with older versions as well)

Note on the exact same computer a different Python3 install (3.7.7) works perfectly. Unclear if this is install-specific or version-specific bug. Trying to connect causes a LIBUSB_ERROR_ACCESS exception. Running this as Administrator in Windows still has same result (and these errors are normally Unix permission issue, not Windows):

C:\Python\WPy64-37120\scripts>python
Python 3.7.12 (44db26267d0a, Oct 24 2021, 14:22:11)
[PyPy 7.3.7 with MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import chipwhisperer as cw
>>>> scope = cw.scope()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\dev\chipwhisperer\software\chipwhisperer\__init__.py", line 327, in scope
    scope_type = get_cw_type(**kwargs)
  File "c:\dev\chipwhisperer\software\chipwhisperer\common\utils\util.py", line 520, in get_cw_type
    device = cwusb.find(serial_number=sn, idProduct=possible_ids, hw_location=hw_location)
  File "c:\dev\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py", line 325, in find
    sns = ["{}:{}".format(dev.getProduct(), dev.getSerialNumber()) for dev in dev_list]
  File "c:\dev\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py", line 325, in <listcomp>
    sns = ["{}:{}".format(dev.getProduct(), dev.getSerialNumber()) for dev in dev_list]
  File "C:\Python\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\usb1\__init__.py", line 2004, in getProduct
    return self.open().getProduct()
  File "C:\Python\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\usb1\__init__.py", line 2056, in open
    mayRaiseUSBError(libusb1.libusb_open(self.device_p, byref(handle)))
  File "C:\Python\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\usb1\__init__.py", line 128, in mayRaiseUSBError
    __raiseUSBError(value)
  File "C:\Python\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\usb1\__init__.py", line 120, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3]

It seems to be triggered after so many calls to the USB device. Calling for example:

dev.getProduct()
dev.getProduct()

Will result in the first one working but second one failing. This can be seen by modifying the code in the get_possible_devices(). It doesn't seem to matter what the call is - for example calling dev.getSerialNumber() has same effect, first one works but second one fails.

Unclear if there is a fix - leaving issue open [for now - will close] in case anyone else runs into this so there is some hit for the search term!

@colinoflynn colinoflynn changed the title Issue with usb1 on Windows under unknown circumstances LIBUSB_ERROR_ACCESS from usb1 on Windows under unknown circumstances with CW Connect Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant