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 . <vvy...@gmail.com> 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 <
> wander.lair...@gmail.com> wrote:
>
>> 2013/10/3 vvyogi . <vvy...@gmail.com>:
>> >> 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
>> pyusb-users@lists.sourceforge.net
>> 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
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to