NotImplementedError: Operation not supported or unimplemented on this platform #419
-
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 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The error message, the fact that it's coming from https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows |
Beta Was this translation helpful? Give feedback.
The error message, the fact that it's coming from
libusb_open
, and that you're dealing with a CP21xx device, suggest that your issue is caused by the need to install a libusb-compatible driver.https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows