From: Somsubhra T. <s_t...@re...> - 2018-06-29 12:17:58
|
I am very new to PyUSB and any help from PyUSB experts will be highly appreciated. My intention is to communicate with the CY7C67300 usb controller on XUPv5-lx110T (Xilinx) board. I have installed pyusb and libusb in win7-32bit machine using "pip install " command. I am using python2.7. I was following the tutorial written in "https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst". When I applied the following few lines in IDLE Python GUI, --------------------------------------------------------------- import usb.core import usb.util # find our device # dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001) dev = usb.core.find(find_all=True, bDeviceClass=7) print dev ---------------------------------------------------------------- I have got the following response : ======================= RESTART: E:\My_Python\test1.py ======================= I typed in the following in python prompt and got this response below: >>>dev.set_configuration() Traceback (most recent call last): File "", line 1, in dev.set_configuration() AttributeError: 'generator' object has no attribute 'set_configuration' This I confirmed using >>>print dir(dev) ['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__iter__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'close', 'gi_code', 'gi_frame', 'gi_running', 'next', 'send', 'throw'] Again I typed in the following and got a response: >>> usb.core.show_devices(verbose=True, find_all=True) Traceback (most recent call last): File "", line 1, in usb.core.show_devices(verbose=True, find_all=True) File "C:\Python27\lib\site-packages\usb\core.py", line 1287, in show_devices strings += "%s\n\n" % str(device) File "C:\Python27\lib\site-packages\usb\core.py", line 731, in __str__ configuration = self.get_active_configuration() File "C:\Python27\lib\site-packages\usb\core.py", line 875, in get_active_configuration return self._ctx.get_active_configuration(self) File "C:\Python27\lib\site-packages\usb\core.py", line 102, in wrapper return f(self, *args, **kwargs) File "C:\Python27\lib\site-packages\usb\core.py", line 236, in get_active_configuration self.managed_open() File "C:\Python27\lib\site-packages\usb\core.py", line 102, in wrapper return f(self, *args, **kwargs) File "C:\Python27\lib\site-packages\usb\core.py", line 120, in managed_open self.handle = self.backend.open_device(self.dev) File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 786, in open_device return _DeviceHandle(dev) File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 643, in __init__ _check(_lib.libusb_open(self.devid, byref(self.handle))) File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 593, in _check raise NotImplementedError(_strerror(ret)) NotImplementedError: Operation not supported or unimplemented on this platform >>> I have googled "NotImplementedError:.....", but did not understand much from the serach- results. I have checked the IBackend class in usb/backend/__init__.py file. All the usb host transaction functions in IBackend are implemented as _not_implemented(self.enumerate_devices) What am I missing out? Rgds, ST |