Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

NotImplementedError: Operation not supported or unimplemented on this platform #418

Closed
0hotpotman0 opened this issue Mar 25, 2022 · 1 comment
Labels

Comments

@0hotpotman0
Copy link

0hotpotman0 commented Mar 25, 2022

Hi

I run the pyusb(1.2.1 version) library on windows 10, the python version is 3.8.0, there got an error in function "ctrl_transfer()", my code is quite simple, via serial to transfer the address to the register via that function,

import time
import usb.core
import usb.util

#---------------------wIndex bit format------------------------#
#bit 7      6       5       4       3       2       1       0
#    1      1       1       1       GPIO.3  GPIO.2  GPIO.1  GPIO.0


#

PID = 0xea60
VID = 0x10c4

dev = usb.core.find(idVendor=VID, idProduct=PID)
if not dev:
        print("CP2104 was not found!")
        exit(1)
print("Yeeha! Found CP2104")

reqType = 0x41
bReq = 0xFF
wVal = 0x37E1

while True:

        wIndex = 0xffff
        print("toggling On")
        dev.ctrl_transfer(reqType, bReq, wVal, wIndex, [])
        time.sleep(1)
        print("toggling Off")
        wIndex = 0x00ff
        dev.ctrl_transfer(reqType, bReq, wVal, wIndex, [])
        time.sleep(1)

then I got the error as below:

Yeeha! Found CP2104
toggling On
Traceback (most recent call last):
  File "cp2102n_gpio_tset.py", line 29, in <module>
    dev.ctrl_transfer(reqType, bReq, wVal, wIndex, [])
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 1071, in ctrl_transfer
    self._ctx.managed_open()
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "C:\Users\Fenyi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\backend\libusb1.py", line 600, in _check
    raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform

It can find my port, but the function 'ctrl_transfer' look like does not support Windows, please help.

Best regards

@jonasmalacofilho
Copy link
Member

The error message, the fact that it's coming from libusb_open, and that you're dealing with a CP21xx device, suggests that your issue is the need to install a libusb-compatible driver.

https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows

@pyusb pyusb locked and limited conversation to collaborators Mar 25, 2022
@jonasmalacofilho jonasmalacofilho converted this issue into discussion #419 Mar 25, 2022
@mcuee mcuee added the question label Mar 29, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants