From: vvyogi . <vv...@gm...> - 2013-10-02 10:52:14
|
This is the complete log Traceback (most recent call last): > File "myu.py", line 21, in <module> > dev.set_configuration() > File "C:\Python27\lib\site-packages\usb\core.py", line 547, in > set_configuration > self._ctx.managed_set_configuration(self, configuration) > File "C:\Python27\lib\site-packages\usb\core.py", line 92, in > managed_set_configuration > self.backend.set_configuration(self.handle, cfg.bConfigurationValue) > File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 503, > in set_configuration > _check(_lib.libusb_set_configuration(dev_handle, config_value)) > File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 403, > in _check > raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > usb.core.USBError: [Errno 2] Entity not found My code is as follows import usb.core > import usb.util > import sys > # find our device > dev = usb.core.find(idVendor=5824, idProduct=1503) > # was it found? > if dev is None: > raise ValueError('Device not found') > > print "VUSB Device Found" ## THE DEVICE GETS DETECTED > print dev.bNumConfigurations > print dev.bDeviceClass > print dev.bLength > > # set the active configuration. With no arguments, the first > # configuration will be the active one > > dev.set_configuration() > dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) My OS is Windows 7 32-bit, using python 2.7.3 and pyusb-1.0.0a2 In above code the Device gets detected, but fails at the point where 'set configuration' happens.. I tried equivalent code in C#(based on libUsbDotNet, which is also a wrapper on libusb), and it worked fine. Here is the c# code snippet for reference. MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); > // If the device is open and ready > if (MyUsbDevice == null) throw new Exception("Device Not > Found."); > // If this is a "whole" usb device (libusb-win32, linux > libusb) > // it will have an IUsbDevice interface. If not (WinUSB) > the > // variable will be null indicating this is an interface > of a > // device. > IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice; > > if (!ReferenceEquals(wholeUsbDevice, null)) > { > // This is a "whole" USB device. Before it can be > used, > // the desired configuration and interface must be > selected. > // Select config #1 > wholeUsbDevice.SetConfiguration(1); > // Claim interface #0. > wholeUsbDevice.ClaimInterface(0); > Console.WriteLine("\r\nMAc MAc!\r\n"); > } > > UsbSetupPacket setup = new UsbSetupPacket(0xC0, 0x01, 0, > 0, 128); > bool result = MyUsbDevice.ControlTransfer(ref setup, > buffer, 128, out ltt); > Console.WriteLine("Result = {0}", result); The only difference that I could find is that the c# code is doing 'CLAIM_INTERFACE', but that is done automatically by pyUsb. Other thing that comes to my mind is the USB_BACKEND being in use by pyUsb. I have not installed winUSB or OpenUSB. How do I check my currently active USB backend. what Is wrong with my python code? |
From: Wander L. C. <wan...@gm...> - 2013-10-02 12:16:09
|
2013/10/2 vvyogi . <vv...@gm...>: > This is the complete log > >> Traceback (most recent call last): >> File "myu.py", line 21, in <module> >> dev.set_configuration() >> File "C:\Python27\lib\site-packages\usb\core.py", line 547, in >> set_configuration >> self._ctx.managed_set_configuration(self, configuration) >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >> managed_set_configuration >> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 503, >> in set_configuration >> _check(_lib.libusb_set_configuration(dev_handle, config_value)) >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 403, >> in _check >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) >> usb.core.USBError: [Errno 2] Entity not found > set_configuration is faling here, but this you probably already know... > > My code is as follows > >> import usb.core >> import usb.util >> import sys >> # find our device >> dev = usb.core.find(idVendor=5824, idProduct=1503) >> # was it found? >> if dev is None: >> raise ValueError('Device not found') >> >> print "VUSB Device Found" ## THE DEVICE GETS DETECTED >> >> >> >> print dev.bNumConfigurations >> print dev.bDeviceClass >> print dev.bLength >> >> # set the active configuration. With no arguments, the first >> # configuration will be the active one >> >> dev.set_configuration() >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) > Your code looks fine, at least until the set_configuration call. > > > My OS is Windows 7 32-bit, using python 2.7.3 and pyusb-1.0.0a2 > In above code the Device gets detected, but fails at the point where 'set > configuration' happens.. > What about latest pyusb code from github? > I tried equivalent code in C#(based on libUsbDotNet, which is also a wrapper > on libusb), and it worked fine. > Here is the c# code snippet for reference. >> >> MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); >> // If the device is open and ready >> if (MyUsbDevice == null) throw new Exception("Device Not >> Found."); >> // If this is a "whole" usb device (libusb-win32, linux >> libusb) >> // it will have an IUsbDevice interface. If not (WinUSB) >> the >> // variable will be null indicating this is an interface >> of a >> // device. >> IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice; >> >> if (!ReferenceEquals(wholeUsbDevice, null)) >> { >> // This is a "whole" USB device. Before it can be >> used, >> // the desired configuration and interface must be >> selected. >> // Select config #1 >> wholeUsbDevice.SetConfiguration(1); >> // Claim interface #0. >> wholeUsbDevice.ClaimInterface(0); >> Console.WriteLine("\r\nMAc MAc!\r\n"); >> } >> >> UsbSetupPacket setup = new UsbSetupPacket(0xC0, 0x01, 0, >> 0, 128); >> bool result = MyUsbDevice.ControlTransfer(ref setup, >> buffer, 128, out ltt); >> Console.WriteLine("Result = {0}", result); > > > > The only difference that I could find is that the c# code is doing > 'CLAIM_INTERFACE', but that is done automatically by pyUsb. > Other thing that comes to my mind is the USB_BACKEND being in use by pyUsb. > I have not installed winUSB or OpenUSB. How do I check my currently active > USB backend. > what Is wrong with my python code? > Your PyUSB backend is libusb 1.0, libusbdotnet can use libusb-win32, WinUSB or libusb 1.0. AFAIK, libusb 1.0 production code can only use WinUSB right now. Do you know what backend is being used by libusbdotnet? Let's try to see what PyUSB is doing. Please, define the environment variable PYUSB_DEBUG_LEVEL=debug (for a2 release) or PYUSB_DEBUG=debug (for github HEAD), run your program again and post here the logs. -- Best Regards, Wander Lairson Costa |
From: Wander L. C. <wan...@gm...> - 2013-10-02 14:02:19
|
2013/10/2 vvyogi . <vv...@gm...> > > I installed pyUsb from the the master branch (github), and I wrote the following code >> >> >> import usb.core >> import usb.util >> import sys >> import os >> # find our device >> os.environ['PYUSB_DEBUG_LEVEL'] = 'debug' # IS THIS RIGHT WAY TO DO THE ENVIRONMENT VARIABLES >> os.environ['PYUSB_DEBUG'] = 'debug' >> You have to setup environment variables before importing usb stuff. That's because you aren't getting any log. >> dev = usb.core.find(idVendor=5824, idProduct=1503) >> # was it found? >> if dev is None: >> raise ValueError('Device not found') >> >> print "VUSB Device Found" >> print dev.bNumConfigurations >> print dev.bDeviceClass >> print dev.bLength >> # set the active configuration. With no arguments, the first >> # configuration will be the active one >> dev.set_configuration() >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) > > > This is the output: >> >> VUSB Device Found >> 1 >> 255 >> 18 >> >> Traceback (most recent call last): >> File "myu.py", line 24, in <module> >> dev.set_configuration() >> File "C:\Python27\lib\site-packages\usb\core.py", line 559, in set_configuration >> >> self._ctx.managed_set_configuration(self, configuration) >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in managed_set_configuration >> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 741, in set_configuration >> _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value)) >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 571, in _check >> >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) >> usb.core.USBError: [Errno 2] Entity not found > > > It seems almost same to the previous log. > As for the libUsbDotNet, I don't know how do I figure out its back-end. I ran a libUsbtest application that came with LibUSB-Win32 and Its snapshot is attached. > > > > Thanks and Regards > Vivek > > On Wed, Oct 2, 2013 at 5:45 PM, Wander Lairson Costa <wan...@gm...> wrote: >> >> 2013/10/2 vvyogi . <vv...@gm...>: >> > This is the complete log >> > >> >> Traceback (most recent call last): >> >> File "myu.py", line 21, in <module> >> >> dev.set_configuration() >> >> File "C:\Python27\lib\site-packages\usb\core.py", line 547, in >> >> set_configuration >> >> self._ctx.managed_set_configuration(self, configuration) >> >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >> >> managed_set_configuration >> >> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) >> >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 503, >> >> in set_configuration >> >> _check(_lib.libusb_set_configuration(dev_handle, config_value)) >> >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 403, >> >> in _check >> >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) >> >> usb.core.USBError: [Errno 2] Entity not found >> > >> >> set_configuration is faling here, but this you probably already know... >> >> > >> > My code is as follows >> > >> >> import usb.core >> >> import usb.util >> >> import sys >> >> # find our device >> >> dev = usb.core.find(idVendor=5824, idProduct=1503) >> >> # was it found? >> >> if dev is None: >> >> raise ValueError('Device not found') >> >> >> >> print "VUSB Device Found" ## THE DEVICE GETS DETECTED >> >> >> >> >> >> >> >> print dev.bNumConfigurations >> >> print dev.bDeviceClass >> >> print dev.bLength >> >> >> >> # set the active configuration. With no arguments, the first >> >> # configuration will be the active one >> >> >> >> dev.set_configuration() >> >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) >> > >> >> Your code looks fine, at least until the set_configuration call. >> >> > >> > >> > My OS is Windows 7 32-bit, using python 2.7.3 and pyusb-1.0.0a2 >> > In above code the Device gets detected, but fails at the point where 'set >> > configuration' happens.. >> > >> >> What about latest pyusb code from github? >> >> > I tried equivalent code in C#(based on libUsbDotNet, which is also a wrapper >> > on libusb), and it worked fine. >> > Here is the c# code snippet for reference. >> >> >> >> MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); >> >> // If the device is open and ready >> >> if (MyUsbDevice == null) throw new Exception("Device Not >> >> Found."); >> >> // If this is a "whole" usb device (libusb-win32, linux >> >> libusb) >> >> // it will have an IUsbDevice interface. If not (WinUSB) >> >> the >> >> // variable will be null indicating this is an interface >> >> of a >> >> // device. >> >> IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice; >> >> >> >> if (!ReferenceEquals(wholeUsbDevice, null)) >> >> { >> >> // This is a "whole" USB device. Before it can be >> >> used, >> >> // the desired configuration and interface must be >> >> selected. >> >> // Select config #1 >> >> wholeUsbDevice.SetConfiguration(1); >> >> // Claim interface #0. >> >> wholeUsbDevice.ClaimInterface(0); >> >> Console.WriteLine("\r\nMAc MAc!\r\n"); >> >> } >> >> >> >> UsbSetupPacket setup = new UsbSetupPacket(0xC0, 0x01, 0, >> >> 0, 128); >> >> bool result = MyUsbDevice.ControlTransfer(ref setup, >> >> buffer, 128, out ltt); >> >> Console.WriteLine("Result = {0}", result); >> > >> > >> > >> > The only difference that I could find is that the c# code is doing >> > 'CLAIM_INTERFACE', but that is done automatically by pyUsb. >> > Other thing that comes to my mind is the USB_BACKEND being in use by pyUsb. >> > I have not installed winUSB or OpenUSB. How do I check my currently active >> > USB backend. >> > what Is wrong with my python code? >> > >> >> Your PyUSB backend is libusb 1.0, libusbdotnet can use libusb-win32, >> WinUSB or libusb 1.0. AFAIK, libusb 1.0 production code can only use >> WinUSB right now. >> Do you know what backend is being used by libusbdotnet? >> >> Let's try to see what PyUSB is doing. Please, define the environment >> variable PYUSB_DEBUG_LEVEL=debug (for a2 release) or PYUSB_DEBUG=debug >> (for github HEAD), run your program again and post here the logs. >> >> >> -- >> Best Regards, >> Wander Lairson Costa >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from >> the latest Intel processors and coprocessors. See abstracts and register > >> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk >> _______________________________________________ >> pyusb-users mailing list >> pyu...@li... >> https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-02 14:13:29
|
Here is the detailed LOG: 2013-10-02 19:41:55,566 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL >> 'C:\openocd-0.7.0\bin\libusb-1.0.dll', handle 6b600000 at 18e44d0>) > > 2013-10-02 19:41:55,571 INFO:usb.core:find(): using backend >> "usb.backend.libusb1" > > 2013-10-02 19:41:55,571 >> DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x019496F0>) > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x01949790>) > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x01949750>) > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x019497B0>) > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x019496F0>) > > 2013-10-02 19:41:55,634 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x01949790>) > > 2013-10-02 19:41:55,635 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x01949750>) > > VUSB_HID Device Found > > 1 > > 255 > > 18 > > 2013-10-02 19:41:55,635 >> DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device >> object at 0x01949750>, 0) > > 2013-10-02 19:41:55,635 >> DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device >> object at 0x01949750>) > > 2013-10-02 19:41:55,637 >> DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle >> object at 0x01857970>, 1) > > Traceback (most recent call last): > > File "myu.py", line 24, in <module> > > dev.set_configuration() > > File "C:\Python27\lib\site-packages\usb\core.py", line 559, in >> set_configuration > > self._ctx.managed_set_configuration(self, configuration) > > File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >> managed_set_configuration > > self.backend.set_configuration(self.handle, cfg.bConfigurationValue) > > File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace > > return f(*args, **named_args) > > File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 741, >> in set_configuration > > _check(self.lib.libusb_set_configuration(dev_handle.handle, >> config_value)) > > File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 571, >> in _check > > raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > > usb.core.USBError: [Errno 2] Entity not found > > 2013-10-02 19:41:55,655 >> DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle >> object at 0x01857970>) > > 2013-10-02 19:41:55,657 DEBUG:usb.backend.libusb1:_LibUSB.__del__() > > On Wed, Oct 2, 2013 at 7:31 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/2 vvyogi . <vv...@gm...> > > > > I installed pyUsb from the the master branch (github), and I wrote the > following code > >> > >> > >> import usb.core > >> import usb.util > >> import sys > >> import os > >> # find our device > >> os.environ['PYUSB_DEBUG_LEVEL'] = 'debug' # IS THIS RIGHT WAY TO DO > THE ENVIRONMENT VARIABLES > >> os.environ['PYUSB_DEBUG'] = 'debug' > >> > > You have to setup environment variables before importing usb stuff. > That's because you aren't getting any log. > > >> dev = usb.core.find(idVendor=5824, idProduct=1503) > >> # was it found? > >> if dev is None: > >> raise ValueError('Device not found') > >> > >> print "VUSB Device Found" > >> print dev.bNumConfigurations > >> print dev.bDeviceClass > >> print dev.bLength > >> # set the active configuration. With no arguments, the first > >> # configuration will be the active one > >> dev.set_configuration() > >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) > > > > > > This is the output: > >> > >> VUSB Device Found > >> 1 > >> 255 > >> 18 > >> > >> Traceback (most recent call last): > >> File "myu.py", line 24, in <module> > >> dev.set_configuration() > >> File "C:\Python27\lib\site-packages\usb\core.py", line 559, in > set_configuration > >> > >> self._ctx.managed_set_configuration(self, configuration) > >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in > managed_set_configuration > >> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) > >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line > 741, in set_configuration > >> _check(self.lib.libusb_set_configuration(dev_handle.handle, > config_value)) > >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line > 571, in _check > >> > >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > >> usb.core.USBError: [Errno 2] Entity not found > > > > > > It seems almost same to the previous log. > > As for the libUsbDotNet, I don't know how do I figure out its back-end. > I ran a libUsbtest application that came with LibUSB-Win32 and Its snapshot > is attached. > > > > > > > > Thanks and Regards > > Vivek > > > > On Wed, Oct 2, 2013 at 5:45 PM, Wander Lairson Costa < > wan...@gm...> wrote: > >> > >> 2013/10/2 vvyogi . <vv...@gm...>: > >> > This is the complete log > >> > > >> >> Traceback (most recent call last): > >> >> File "myu.py", line 21, in <module> > >> >> dev.set_configuration() > >> >> File "C:\Python27\lib\site-packages\usb\core.py", line 547, in > >> >> set_configuration > >> >> self._ctx.managed_set_configuration(self, configuration) > >> >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in > >> >> managed_set_configuration > >> >> self.backend.set_configuration(self.handle, > cfg.bConfigurationValue) > >> >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line > 503, > >> >> in set_configuration > >> >> _check(_lib.libusb_set_configuration(dev_handle, config_value)) > >> >> File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line > 403, > >> >> in _check > >> >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > >> >> usb.core.USBError: [Errno 2] Entity not found > >> > > >> > >> set_configuration is faling here, but this you probably already know... > >> > >> > > >> > My code is as follows > >> > > >> >> import usb.core > >> >> import usb.util > >> >> import sys > >> >> # find our device > >> >> dev = usb.core.find(idVendor=5824, idProduct=1503) > >> >> # was it found? > >> >> if dev is None: > >> >> raise ValueError('Device not found') > >> >> > >> >> print "VUSB Device Found" ## THE DEVICE GETS DETECTED > >> >> > >> >> > >> >> > >> >> print dev.bNumConfigurations > >> >> print dev.bDeviceClass > >> >> print dev.bLength > >> >> > >> >> # set the active configuration. With no arguments, the first > >> >> # configuration will be the active one > >> >> > >> >> dev.set_configuration() > >> >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) > >> > > >> > >> Your code looks fine, at least until the set_configuration call. > >> > >> > > >> > > >> > My OS is Windows 7 32-bit, using python 2.7.3 and pyusb-1.0.0a2 > >> > In above code the Device gets detected, but fails at the point where > 'set > >> > configuration' happens.. > >> > > >> > >> What about latest pyusb code from github? > >> > >> > I tried equivalent code in C#(based on libUsbDotNet, which is also a > wrapper > >> > on libusb), and it worked fine. > >> > Here is the c# code snippet for reference. > >> >> > >> >> MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); > >> >> // If the device is open and ready > >> >> if (MyUsbDevice == null) throw new Exception("Device > Not > >> >> Found."); > >> >> // If this is a "whole" usb device (libusb-win32, > linux > >> >> libusb) > >> >> // it will have an IUsbDevice interface. If not > (WinUSB) > >> >> the > >> >> // variable will be null indicating this is an > interface > >> >> of a > >> >> // device. > >> >> IUsbDevice wholeUsbDevice = MyUsbDevice as > IUsbDevice; > >> >> > >> >> if (!ReferenceEquals(wholeUsbDevice, null)) > >> >> { > >> >> // This is a "whole" USB device. Before it can be > >> >> used, > >> >> // the desired configuration and interface must > be > >> >> selected. > >> >> // Select config #1 > >> >> wholeUsbDevice.SetConfiguration(1); > >> >> // Claim interface #0. > >> >> wholeUsbDevice.ClaimInterface(0); > >> >> Console.WriteLine("\r\nMAc MAc!\r\n"); > >> >> } > >> >> > >> >> UsbSetupPacket setup = new UsbSetupPacket(0xC0, > 0x01, 0, > >> >> 0, 128); > >> >> bool result = MyUsbDevice.ControlTransfer(ref setup, > >> >> buffer, 128, out ltt); > >> >> Console.WriteLine("Result = {0}", result); > >> > > >> > > >> > > >> > The only difference that I could find is that the c# code is doing > >> > 'CLAIM_INTERFACE', but that is done automatically by pyUsb. > >> > Other thing that comes to my mind is the USB_BACKEND being in use by > pyUsb. > >> > I have not installed winUSB or OpenUSB. How do I check my currently > active > >> > USB backend. > >> > what Is wrong with my python code? > >> > > >> > >> Your PyUSB backend is libusb 1.0, libusbdotnet can use libusb-win32, > >> WinUSB or libusb 1.0. AFAIK, libusb 1.0 production code can only use > >> WinUSB right now. > >> Do you know what backend is being used by libusbdotnet? > >> > >> Let's try to see what PyUSB is doing. Please, define the environment > >> variable PYUSB_DEBUG_LEVEL=debug (for a2 release) or PYUSB_DEBUG=debug > >> (for github HEAD), run your program again and post here the logs. > >> > >> > >> -- > >> Best Regards, > >> Wander Lairson Costa > >> > >> > ------------------------------------------------------------------------------ > >> October Webinars: Code for Performance > >> Free Intel webinars can help you accelerate application performance. > >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the > most from > >> the latest Intel processors and coprocessors. See abstracts and > register > > >> > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > >> _______________________________________________ > >> pyusb-users mailing list > >> pyu...@li... > >> https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > > > > > ------------------------------------------------------------------------------ > > October Webinars: Code for Performance > > Free Intel webinars can help you accelerate application performance. > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > > the latest Intel processors and coprocessors. See abstracts and register > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > > _______________________________________________ > > pyusb-users mailing list > > pyu...@li... > > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2013-10-02 14:30:03
|
2013/10/2 vvyogi . <vv...@gm...>: >>> >>> 2013-10-02 19:41:55,637 >>> DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle >>> object at 0x01857970>, 1) >>> Everything seems fine, could you try with libusb-win32 backend? If you uninstall libusb 1.0 and install libusbw-win32 you can get that. -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-02 15:32:59
|
> > Everything seems fine, could you try with libusb-win32 backend? If you > uninstall libusb 1.0 and install libusbw-win32 you can get that How do I do that ? Whats the procedure to switch the pyUSB backend. On Wed, Oct 2, 2013 at 7:59 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/2 vvyogi . <vv...@gm...>: > > >>> > >>> 2013-10-02 19:41:55,637 > >>> > DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle > >>> object at 0x01857970>, 1) > >>> > > Everything seems fine, could you try with libusb-win32 backend? If you > uninstall libusb 1.0 and install libusbw-win32 you can get that. > > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2013-10-02 16:15:03
|
2013/10/2 vvyogi . <vv...@gm...>: >> Everything seems fine, could you try with libusb-win32 backend? If you >> uninstall libusb 1.0 and install libusbw-win32 you can get that > > > How do I do that ? > Whats the procedure to switch the pyUSB backend. > Do you have libusb-win32 installed? If so, just do that: import usb.backend.libusb0 b = usb.backend.libusb0.get_backend() usb.core.find(backend=b, ...) -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-02 17:10:56
|
It throws ImportError ImportError: No module named libusb0 Does that means I don't have libusb-win32 installed on my PC. The package that I downloaded from sourceForge has follow Directory Structure: libusb-win32-bin-1.2.6.0 | |---> bin | | | |-->amd64(dir) | | | |-->ia64(dir) | | | |--> x86(dir) | | | | | |--> install-filter | | | | | |--> install-filter-win <------ This one does not lists the vid/pid of my device | | | | | |--> testlibusb.exe | | | | | |--> testlibusb-win.exe | | | |--> inf-wizard.exe <------ This one creates a inf/driver for my device and after installing the driver my c# app works. | | | -->examples(dir) | | |---> includes(dir) | | |--->lib(dir) | |-->bcc | |-->dynamic | |-->gcc | |-->msvc | |-->msvc_i64 | |-->msvc_x64 Tell me, what am I missing? On Wed, Oct 2, 2013 at 9:44 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/2 vvyogi . <vv...@gm...>: > >> Everything seems fine, could you try with libusb-win32 backend? If you > >> uninstall libusb 1.0 and install libusbw-win32 you can get that > > > > > > How do I do that ? > > Whats the procedure to switch the pyUSB backend. > > > > Do you have libusb-win32 installed? If so, just do that: > > import usb.backend.libusb0 > > b = usb.backend.libusb0.get_backend() > usb.core.find(backend=b, ...) > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2013-10-02 19:11:01
|
2013/10/2 vvyogi . <vv...@gm...>: > It throws ImportError >> >> ImportError: No module named libusb0 > > Does that means I don't have libusb-win32 installed on my PC. > > The package that I downloaded from sourceForge has follow Directory > Structure: > > libusb-win32-bin-1.2.6.0 > | > |---> bin > | | > | |-->amd64(dir) > | | > | |-->ia64(dir) > | | > | |--> x86(dir) > | | | > | | |--> install-filter > | | | > | | |--> install-filter-win <------ This one does not > lists the vid/pid of my device > | | | > | | |--> testlibusb.exe > | | | > | | |--> testlibusb-win.exe > | | > | |--> inf-wizard.exe <------ This one creates a > inf/driver for my device and after installing the driver my c# app works. > | > | > | -->examples(dir) > | > | > |---> includes(dir) > | > | > |--->lib(dir) > | > |-->bcc > | > |-->dynamic > | > |-->gcc > | > |-->msvc > | > |-->msvc_i64 > | > |-->msvc_x64 > > Tell me, what am I missing? > How did you install it? -- Best Regards, Wander Lairson Costa |
From: Vivek Y. <vv...@gm...> - 2013-10-02 19:19:10
|
I did installed the pyUsb via the usual python package installation method i.e. >python setup.py install As for the libusb, I didn't install any binary or any python setup for it. For the device(a vUsb device) I had to install the driver using the inf-wizard.exe available with libusb-win32 distribution. Thats all I did for the python end. For C# application I had to use reference to libUsbDotNet.dll Thanks and regards Vivek On 03-Oct-2013, at 12:40 AM, Wander Lairson Costa <wan...@gm...> wrote: > 2013/10/2 vvyogi . <vv...@gm...>: >> It throws ImportError >>> >>> ImportError: No module named libusb0 >> >> Does that means I don't have libusb-win32 installed on my PC. >> >> The package that I downloaded from sourceForge has follow Directory >> Structure: >> >> libusb-win32-bin-1.2.6.0 >> | >> |---> bin >> | | >> | |-->amd64(dir) >> | | >> | |-->ia64(dir) >> | | >> | |--> x86(dir) >> | | | >> | | |--> install-filter >> | | | >> | | |--> install-filter-win <------ This one does not >> lists the vid/pid of my device >> | | | >> | | |--> testlibusb.exe >> | | | >> | | |--> testlibusb-win.exe >> | | >> | |--> inf-wizard.exe <------ This one creates a >> inf/driver for my device and after installing the driver my c# app works. >> | >> | >> | -->examples(dir) >> | >> | >> |---> includes(dir) >> | >> | >> |--->lib(dir) >> | >> |-->bcc >> | >> |-->dynamic >> | >> |-->gcc >> | >> |-->msvc >> | >> |-->msvc_i64 >> | >> |-->msvc_x64 >> >> Tell me, what am I missing? >> > > How did you install it? > > -- > Best Regards, > Wander Lairson Costa > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users |
From: Wander L. C. <wan...@gm...> - 2013-10-02 20:12:06
|
2013/10/2 Vivek Yogi <vv...@gm...>: > I did installed the pyUsb via the usual python package installation method i.e. > >>python setup.py install > > As for the libusb, I didn't install any binary or any python setup for it. > > For the device(a vUsb device) I had to install the driver using the inf-wizard.exe available with libusb-win32 distribution. > > Thats all I did for the python end. > > For C# application I had to use reference to libUsbDotNet.dll > Python is not finding the libusb-win32.dll file, you could put it inside the python interpreter directory just for tests. -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-03 05:22:39
|
Python is not finding the libusb-win32.dll file, you could put it inside the python interpreter directory just for tests The directory *C:\Python27\DLLs* contains* libusb0.dll*, this same file is also there in *C:\Windows\System32* directory. I removed the *dll* from *C:\Python27\DLLs *and I ran my program, it gave the same error log( as if removing the *dll* made no difference). Does this means that pyUsb is using backend from system32(or I am looking at the wrong directory). 2013-10-03 10:32:16,684 INFO:usb.core:find(): using backend >> "usb.backend.libusb10" > > 2013-10-03 10:32:16,684 >> DEBUG:usb.backend.libusb10:_LibUSB.enumerate_devices() > > 2013-10-03 10:32:16,749 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841AF0>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B70>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B30>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B90>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841AF0>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B70>) > > 2013-10-03 10:32:16,750 >> DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B30>) > > 2013-10-03 10:32:16,752 >> DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device >> object at 0x01841B30>, 0) > > 2013-10-03 10:32:16,752 >> DEBUG:usb.backend.libusb10:_LibUSB.open_device(<usb.backend.libusb10._Device >> object at 0x01841B30>) > > 2013-10-03 10:32:16,752 >> DEBUG:usb.backend.libusb10:_LibUSB.set_configuration(c_void_p(31461336), 1) > > VUSB_HID Device Found > > 1 > > 255 > > 18 > > Traceback (most recent call last): > > File "myu.py", line 24, in <module> > > dev.set_configuration() > > File "C:\Python27\lib\site-packages\usb\core.py", line 547, in >> set_configuration > > self._ctx.managed_set_configuration(self, configuration) > > File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >> managed_set_configuration > > self.backend.set_configuration(self.handle, cfg.bConfigurationValue) > > File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace > > return f(*args, **named_args) > > File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 503, >> in set_configuration > > _check(_lib.libusb_set_configuration(dev_handle, config_value)) > > File "C:\Python27\lib\site-packages\usb\backend\libusb10.py", line 403, >> in _check > > raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > > usb.core.USBError: [Errno 2] Entity not found > > 2013-10-03 10:32:16,769 >> DEBUG:usb.backend.libusb10:_LibUSB.close_device(c_void_p(31461336)) > > Now about the libusb-win32.dll, I couldn't locate this dll. In the libusb-win32 distribution there i a *libusb0_x86.dll, *is this the required dll that I need to put in *C:\Python27\DLLs *? Kindly suggest where to look for the dll and where to put it ? Thanks and Regards Vivek On Thu, Oct 3, 2013 at 1:41 AM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/2 Vivek Yogi <vv...@gm...>: > > I did installed the pyUsb via the usual python package installation > method i.e. > > > >>python setup.py install > > > > As for the libusb, I didn't install any binary or any python setup for > it. > > > > For the device(a vUsb device) I had to install the driver using the > inf-wizard.exe available with libusb-win32 distribution. > > > > Thats all I did for the python end. > > > > For C# application I had to use reference to libUsbDotNet.dll > > > > Python is not finding the libusb-win32.dll file, you could put it > inside the python interpreter directory just for tests. > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2013-10-03 15:38:30
|
2013/10/3 vvyogi . <vv...@gm...>: >> Python is not finding the libusb-win32.dll file, you could put it >> >> inside the python interpreter directory just for tests > > > The directory C:\Python27\DLLs contains libusb0.dll, this same file is also > there in C:\Windows\System32 directory. > I removed the dll from C:\Python27\DLLs and I ran my program, it gave the > same error log( as if removing the dll made no difference). Does this means > that pyUsb is using backend from system32(or I am looking at the wrong > directory). libusb 1.0 has higher priority when detecting which backend to use. That's because I told you to force it through the *backend* find parameter. [snip] > > Now about the libusb-win32.dll, I couldn't locate this dll. > In the libusb-win32 distribution there i a libusb0_x86.dll, is this the > required dll that I need to put in C:\Python27\DLLs ? My bad, I told you the name of the dll was libusb-win32.dll, it is actually libusb0.dll. Sorry. > Kindly suggest where to look for the dll and where to put it ? > Try to put it in C:\Python27 -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-03 18:24:31
|
Try to put it in C:\Python27 > That made no difference. Out of curiosity, I removed the dll from System32 directory and yet pyUsb didn't complained anything. This inspires me to ask "Where exactly is pyUsb's backend? Which dll is it using?" And Finally, I wiped out the python distribution completely and tried with a fresh install. I installed only pyUSB( master branch from github ) Log seems to be changed: 2013-10-03 23:44:23,200 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL > 'C:\openocd-0.7.0\bin\libusb-1.0.dll', handle 6b600000 at 1804490>) > 2013-10-03 23:44:23,201 INFO:usb.core:find(): using backend > "usb.backend.libusb1" > 2013-10-03 23:44:23,203 > DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() > 2013-10-03 23:44:23,263 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A5630>) > 2013-10-03 23:44:23,263 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A56D0>) > 2013-10-03 23:44:23,263 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A5690>) > 2013-10-03 23:44:23,263 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A56F0>) > 2013-10-03 23:44:23,265 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A5630>) > 2013-10-03 23:44:23,265 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A56D0>) > 2013-10-03 23:44:23,265 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x018A5690>) > 2013-10-03 23:44:23,265 > DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device > object at 0x018A5690>, 0) > 2013-10-03 23:44:23,266 > DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device > object at 0x018A5690>) > 2013-10-03 23:44:23,266 > DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle > object at 0x01776930>, 1) > VUSB_HID Device Found > 1 > 255 > 18 > Traceback (most recent call last): > File "myu.py", line 24, in <module> > dev.set_configuration() > File "C:\Python27\lib\site-packages\usb\core.py", line 559, in > set_configuration > self._ctx.managed_set_configuration(self, configuration) > File "C:\Python27\lib\site-packages\usb\core.py", line 92, in > managed_set_configuration > self.backend.set_configuration(self.handle, cfg.bConfigurationValue) > File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace > return f(*args, **named_args) > File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 741, > in set_configuration > _check(self.lib.libusb_set_configuration(dev_handle.handle, > config_value)) > File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 571, > in _check > raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > usb.core.USBError: [Errno 2] Entity not found > 2013-10-03 23:44:23,285 > DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle > object at 0x01776930>) > 2013-10-03 23:44:23,285 DEBUG:usb.backend.libusb1:_LibUSB.__del__() The error code is same "*[Errno 2] Entity not found*" however, pyUsb seems to be using the libusb1 backend now. I don't really understand whats going on here. Is there anyway I can make it work? Thanks and Regards Vivek On Thu, Oct 3, 2013 at 9:07 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/3 vvyogi . <vv...@gm...>: > >> Python is not finding the libusb-win32.dll file, you could put it > >> > >> inside the python interpreter directory just for tests > > > > > > The directory C:\Python27\DLLs contains libusb0.dll, this same file is > also > > there in C:\Windows\System32 directory. > > I removed the dll from C:\Python27\DLLs and I ran my program, it gave the > > same error log( as if removing the dll made no difference). Does this > means > > that pyUsb is using backend from system32(or I am looking at the wrong > > directory). > > libusb 1.0 has higher priority when detecting which backend to use. > That's because I told you to force it through the *backend* find > parameter. > > [snip] > > > > > Now about the libusb-win32.dll, I couldn't locate this dll. > > In the libusb-win32 distribution there i a libusb0_x86.dll, is this the > > required dll that I need to put in C:\Python27\DLLs ? > > My bad, I told you the name of the dll was libusb-win32.dll, it is > actually libusb0.dll. Sorry. > > > Kindly suggest where to look for the dll and where to put it ? > > > > Try to put it in C:\Python27 > > > > > > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2013-10-03 18:30:03
|
2013/10/3 vvyogi . <vv...@gm...>: >> Try to put it in C:\Python27 > > That made no difference. > > Out of curiosity, I removed the dll from System32 directory and yet pyUsb > didn't complained anything. This inspires me to ask "Where exactly is > pyUsb's backend? Which dll is it using?" > > And Finally, I wiped out the python distribution completely and tried with a > fresh install. I installed only pyUSB( master branch from github ) Log seems > to be changed: > >> 2013-10-03 23:44:23,200 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL >> 'C:\openocd-0.7.0\bin\libusb-1.0.dll', handle 6b600000 at 1804490>) libusb 1.0 is loading from here 'C:\openocd-0.7.0\bin\libusb-1.0.dll'. To use libusb-win32, you either have to remove this file or force the backend. > > The error code is same "[Errno 2] Entity not found" however, pyUsb seems to > be using the libusb1 backend now. > > I don't really understand whats going on here. Is there anyway I can make it > work? > I am trying to isolate the problem. I suspect your C# code worked because in C# you were using libusb-win32, and that's because I asked you to give libusb-win32 a try. -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-03 18:33:18
|
Again, Out of curiosity I was browsing through the * "C:\Python27\Lib\site-packages" *directory, and there was backend subdirectory inside the usb directory. And it had 1. libusb0.py 2. libusb1.py 3. openusb.py I quickly ran this code( as suggested by you(Wander Liarson) earlier): import usb.backend.libusb0 > b = usb.backend.libusb0.get_backend() > dev = usb.core.find(backend=b, idVendor=5824, idProduct=1503) > # was it found? > if dev is None: > raise ValueError('Device not found') > > print "VUSB Device Found" > print dev.bNumConfigurations > print dev.bDeviceClass > print dev.bLength > # set the active configuration. With no arguments, the first > # configuration will be the active one > dev.set_configuration() > dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) AND ITS DONE ! Its finally WORKING ! Awesome. Thanks and Regards Vivek On Thu, Oct 3, 2013 at 11:54 PM, vvyogi . <vv...@gm...> wrote: > Try to put it in C:\Python27 >> > That made no difference. > > Out of curiosity, I removed the dll from System32 directory and yet pyUsb > didn't complained anything. This inspires me to ask "Where exactly is > pyUsb's backend? Which dll is it using?" > > And Finally, I wiped out the python distribution completely and tried with > a fresh install. I installed only pyUSB( master branch from github ) Log > seems to be changed: > > 2013-10-03 23:44:23,200 >> DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL >> 'C:\openocd-0.7.0\bin\libusb-1.0.dll', handle 6b600000 at 1804490>) >> 2013-10-03 23:44:23,201 INFO:usb.core:find(): using backend >> "usb.backend.libusb1" >> 2013-10-03 23:44:23,203 >> DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() >> 2013-10-03 23:44:23,263 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A5630>) >> 2013-10-03 23:44:23,263 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A56D0>) >> 2013-10-03 23:44:23,263 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A5690>) >> 2013-10-03 23:44:23,263 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A56F0>) >> 2013-10-03 23:44:23,265 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A5630>) >> 2013-10-03 23:44:23,265 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A56D0>) >> 2013-10-03 23:44:23,265 >> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >> object at 0x018A5690>) >> 2013-10-03 23:44:23,265 >> DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device >> object at 0x018A5690>, 0) >> 2013-10-03 23:44:23,266 >> DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device >> object at 0x018A5690>) >> 2013-10-03 23:44:23,266 >> DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle >> object at 0x01776930>, 1) >> >> VUSB_HID Device Found >> 1 >> 255 >> 18 >> Traceback (most recent call last): >> File "myu.py", line 24, in <module> >> dev.set_configuration() >> File "C:\Python27\lib\site-packages\usb\core.py", line 559, in >> set_configuration >> >> self._ctx.managed_set_configuration(self, configuration) >> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >> managed_set_configuration >> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) >> File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace >> return f(*args, **named_args) >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 741, >> in set_configuration >> _check(self.lib.libusb_set_configuration(dev_handle.handle, >> config_value)) >> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 571, >> in _check >> >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) >> usb.core.USBError: [Errno 2] Entity not found >> 2013-10-03 23:44:23,285 >> DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle >> object at 0x01776930>) >> 2013-10-03 23:44:23,285 DEBUG:usb.backend.libusb1:_LibUSB.__del__() > > > The error code is same "*[Errno 2] Entity not found*" however, pyUsb > seems to be using the libusb1 backend now. > > I don't really understand whats going on here. Is there anyway I can make > it work? > > Thanks and Regards > Vivek > > > On Thu, Oct 3, 2013 at 9:07 PM, Wander Lairson Costa < > wan...@gm...> wrote: > >> 2013/10/3 vvyogi . <vv...@gm...>: >> >> Python is not finding the libusb-win32.dll file, you could put it >> >> >> >> inside the python interpreter directory just for tests >> > >> > >> > The directory C:\Python27\DLLs contains libusb0.dll, this same file is >> also >> > there in C:\Windows\System32 directory. >> > I removed the dll from C:\Python27\DLLs and I ran my program, it gave >> the >> > same error log( as if removing the dll made no difference). Does this >> means >> > that pyUsb is using backend from system32(or I am looking at the wrong >> > directory). >> >> libusb 1.0 has higher priority when detecting which backend to use. >> That's because I told you to force it through the *backend* find >> parameter. >> >> [snip] >> >> > >> > Now about the libusb-win32.dll, I couldn't locate this dll. >> > In the libusb-win32 distribution there i a libusb0_x86.dll, is this the >> > required dll that I need to put in C:\Python27\DLLs ? >> >> My bad, I told you the name of the dll was libusb-win32.dll, it is >> actually libusb0.dll. Sorry. >> >> > Kindly suggest where to look for the dll and where to put it ? >> > >> >> Try to put it in C:\Python27 >> >> >> >> >> >> >> -- >> Best Regards, >> Wander Lairson Costa >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk >> _______________________________________________ >> pyusb-users mailing list >> pyu...@li... >> https://lists.sourceforge.net/lists/listinfo/pyusb-users >> > > |
From: vvyogi . <vv...@gm...> - 2013-10-03 18:38:57
|
libusb 1.0 is loading from here 'C:\openocd-0.7.0\bin\libusb-1.0.dll'. Aww man. I never looked at it that carefully. If you had not pointed that out, I wouldn't have tried myself to find the reason behind it not working. Lesson Learned: Debug Logs are IMPORTANT! and DESERVE A CONSCIOUS READ. Thanks a ton Vivek On Fri, Oct 4, 2013 at 12:03 AM, vvyogi . <vv...@gm...> wrote: > Again, Out of curiosity I was browsing through the * > "C:\Python27\Lib\site-packages" *directory, and there was backend > subdirectory inside the usb directory. And it had > 1. libusb0.py > 2. libusb1.py > 3. openusb.py > > I quickly ran this code( as suggested by you(Wander Liarson) earlier): > > import usb.backend.libusb0 >> b = usb.backend.libusb0.get_backend() >> dev = usb.core.find(backend=b, idVendor=5824, idProduct=1503) >> >> # was it found? >> if dev is None: >> raise ValueError('Device not found') >> >> print "VUSB Device Found" >> print dev.bNumConfigurations >> print dev.bDeviceClass >> print dev.bLength >> # set the active configuration. With no arguments, the first >> # configuration will be the active one >> dev.set_configuration() >> dev.ret = dev.ctrl_transfer(0xC0, 0x00, 0, 0, 128) >> > > AND ITS DONE ! > Its finally WORKING ! Awesome. > > > Thanks and Regards > Vivek > > > On Thu, Oct 3, 2013 at 11:54 PM, vvyogi . <vv...@gm...> wrote: > >> Try to put it in C:\Python27 >>> >> That made no difference. >> >> Out of curiosity, I removed the dll from System32 directory and yet pyUsb >> didn't complained anything. This inspires me to ask "Where exactly is >> pyUsb's backend? Which dll is it using?" >> >> And Finally, I wiped out the python distribution completely and tried >> with a fresh install. I installed only pyUSB( master branch from github ) >> Log seems to be changed: >> >> 2013-10-03 23:44:23,200 >>> DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL >>> 'C:\openocd-0.7.0\bin\libusb-1.0.dll', handle 6b600000 at 1804490>) >>> 2013-10-03 23:44:23,201 INFO:usb.core:find(): using backend >>> "usb.backend.libusb1" >>> 2013-10-03 23:44:23,203 >>> DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() >>> 2013-10-03 23:44:23,263 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A5630>) >>> 2013-10-03 23:44:23,263 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A56D0>) >>> 2013-10-03 23:44:23,263 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A5690>) >>> 2013-10-03 23:44:23,263 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A56F0>) >>> 2013-10-03 23:44:23,265 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A5630>) >>> 2013-10-03 23:44:23,265 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A56D0>) >>> 2013-10-03 23:44:23,265 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A5690>) >>> 2013-10-03 23:44:23,265 >>> DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device >>> object at 0x018A5690>, 0) >>> 2013-10-03 23:44:23,266 >>> DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device >>> object at 0x018A5690>) >>> 2013-10-03 23:44:23,266 >>> DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle >>> object at 0x01776930>, 1) >>> >>> VUSB_HID Device Found >>> 1 >>> 255 >>> 18 >>> Traceback (most recent call last): >>> File "myu.py", line 24, in <module> >>> dev.set_configuration() >>> File "C:\Python27\lib\site-packages\usb\core.py", line 559, in >>> set_configuration >>> >>> self._ctx.managed_set_configuration(self, configuration) >>> File "C:\Python27\lib\site-packages\usb\core.py", line 92, in >>> managed_set_configuration >>> self.backend.set_configuration(self.handle, cfg.bConfigurationValue) >>> File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in >>> do_trace >>> return f(*args, **named_args) >>> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 741, >>> in set_configuration >>> _check(self.lib.libusb_set_configuration(dev_handle.handle, >>> config_value)) >>> File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 571, >>> in _check >>> >>> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) >>> usb.core.USBError: [Errno 2] Entity not found >>> 2013-10-03 23:44:23,285 >>> DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle >>> object at 0x01776930>) >>> 2013-10-03 23:44:23,285 DEBUG:usb.backend.libusb1:_LibUSB.__del__() >> >> >> The error code is same "*[Errno 2] Entity not found*" however, pyUsb >> seems to be using the libusb1 backend now. >> >> I don't really understand whats going on here. Is there anyway I can make >> it work? >> >> Thanks and Regards >> Vivek >> >> >> On Thu, Oct 3, 2013 at 9:07 PM, Wander Lairson Costa < >> wan...@gm...> wrote: >> >>> 2013/10/3 vvyogi . <vv...@gm...>: >>> >> Python is not finding the libusb-win32.dll file, you could put it >>> >> >>> >> inside the python interpreter directory just for tests >>> > >>> > >>> > The directory C:\Python27\DLLs contains libusb0.dll, this same file is >>> also >>> > there in C:\Windows\System32 directory. >>> > I removed the dll from C:\Python27\DLLs and I ran my program, it gave >>> the >>> > same error log( as if removing the dll made no difference). Does this >>> means >>> > that pyUsb is using backend from system32(or I am looking at the wrong >>> > directory). >>> >>> libusb 1.0 has higher priority when detecting which backend to use. >>> That's because I told you to force it through the *backend* find >>> parameter. >>> >>> [snip] >>> >>> > >>> > Now about the libusb-win32.dll, I couldn't locate this dll. >>> > In the libusb-win32 distribution there i a libusb0_x86.dll, is this the >>> > required dll that I need to put in C:\Python27\DLLs ? >>> >>> My bad, I told you the name of the dll was libusb-win32.dll, it is >>> actually libusb0.dll. Sorry. >>> >>> > Kindly suggest where to look for the dll and where to put it ? >>> > >>> >>> Try to put it in C:\Python27 >>> >>> >>> >>> >>> >>> >>> -- >>> Best Regards, >>> Wander Lairson Costa >>> >>> >>> ------------------------------------------------------------------------------ >>> October Webinars: Code for Performance >>> Free Intel webinars can help you accelerate application performance. >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>> from >>> the latest Intel processors and coprocessors. See abstracts and register >>> > >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> pyusb-users mailing list >>> pyu...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyusb-users >>> >> >> > |
From: Wander L. C. <wan...@gm...> - 2013-10-04 12:20:57
|
2013/10/3 vvyogi . <vv...@gm...>: [snip] > > AND ITS DONE ! > Its finally WORKING ! Awesome. > Glad your code is working. Now we have four possibilities: 1) You found a bug in libusb 1.0 PyUSB backend. 2) You are using an old version of libusb 1.0 that has a known problem, and just updating it will fixes that. 3) You found an unkown bug in the libusb. 4) You have just a configuration problem with your libusb installation (I don't think so). You may just want to stop here as you got your code working or may want to go deeper and check what's going on. For the later option, I advice you to install the latest version of libusbx [1] and rewrite you test application in C. [1] http://libusbx.sourceforge.net/ -- Best Regards, Wander Lairson Costa |
From: vvyogi . <vv...@gm...> - 2013-10-09 11:46:34
|
> > You may just want to stop here For now, I will do this. For the later option, I advice you to install the latest version of libusbx > [1] and rewrite you test application in C. For now I'll put this to my TODO list. My code started working when I did 'uninstall' the complete python and all its packages. Then I have installed plain Python(2.7.3) and Pyusb(1.0.0a4), and as you can see the code its working right *after* switching the backend( *usb.backend.libusb0.get_backend() *). If you suggest me some minor experiment I can do that. Thanks and Regards Vivek PS: Sorry for the delayed response, I missed this last response. On Fri, Oct 4, 2013 at 5:50 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/10/3 vvyogi . <vv...@gm...>: > > [snip] > > > > > AND ITS DONE ! > > Its finally WORKING ! Awesome. > > > > Glad your code is working. Now we have four possibilities: > > 1) You found a bug in libusb 1.0 PyUSB backend. > 2) You are using an old version of libusb 1.0 that has a known > problem, and just updating it will fixes that. > 3) You found an unkown bug in the libusb. > 4) You have just a configuration problem with your libusb installation > (I don't think so). > > You may just want to stop here as you got your code working or may > want to go deeper and check what's going on. For the later option, I > advice you to install the latest version of libusbx [1] and rewrite > you test application in C. > > [1] http://libusbx.sourceforge.net/ > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |