Discussion:
[pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4
igor bezenchuk
2016-01-07 08:01:07 UTC
Permalink
Hi All,I am trying to setup Libusb(1.0) and Pyusb(3.4) with on windows 10(ver 10.0.10240) and can't make it work. I tried these steps to install libusb:
1. installing libusb0.1_win322.following this steps from mailing list:This can seem confusing, however when you are on 64-bit Windows,
MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and
(for running 32-bit applications that use libusb)
MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64I used this code:import usb.core
import usb.util

# find our device
dev = usb.core.find(find_all=True)print(dev)with both cases I managed to get handle to dev which printed out: "generator object device_iter at 0x...".I can't see all my system USB devices What can I do to make it work?
Tormod Volden
2016-01-07 12:01:32 UTC
Permalink
On Thu, Jan 7, 2016 at 9:01 AM, igor bezenchuk wrote:
> Hi All,
> I am trying to setup Libusb(1.0) and Pyusb(3.4) with on windows 10(ver
> 10.0.10240) and can't make it work. I tried these steps to install libusb:
>
> 1. installing libusb0.1_win32

libusb0.1? What exactly did you install? Filename of download /
installer, and from where?

> 2.following this steps from mailing list:
>
> This can seem confusing, however when you are on 64-bit Windows,
> MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and
> (for running 32-bit applications that use libusb)
> MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64
>
> I used this code:

libusb ships with an example executable called "listdevs.exe". Does it
list all your devices? Unless you have libusb working, there is no
need to try pyusb yet.

Regards,
Tormod

------------------------------------------------------------------------------
igor bezenchuk
2016-01-07 12:27:20 UTC
Permalink
I used libusb from libusb.info. here is the link I download it from:http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download
it's libusb1.0.20 for windows binaries
with listdev.exe it's working, here it my output:0b95:1790 (bus 2, device 2) path: 258086:15b6 (bus 1, device 1)0403:6010 (bus 2, device 4) path: 6045e:0750 (bus 2, device 5) path: 14.1045e:0750 (bus 2, device 5) path: 14.10403:6010 (bus 2, device 4) path: 60781:5580 (bus 1, device 2) path: 30557:7000 (bus 2, device 3) path: 148086:a12f (bus 2, device 1)
so apparently libusb does work and manage to display USB devices properly.
> Date: Thu, 7 Jan 2016 13:01:32 +0100
> From: ***@gmail.com
> To: pyusb-***@lists.sourceforge.net
> Subject: Re: [pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4
>
> On Thu, Jan 7, 2016 at 9:01 AM, igor bezenchuk wrote:
> > Hi All,
> > I am trying to setup Libusb(1.0) and Pyusb(3.4) with on windows 10(ver
> > 10.0.10240) and can't make it work. I tried these steps to install libusb:
> >
> > 1. installing libusb0.1_win32
>
> libusb0.1? What exactly did you install? Filename of download /
> installer, and from where?
>
> > 2.following this steps from mailing list:
> >
> > This can seem confusing, however when you are on 64-bit Windows,
> > MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and
> > (for running 32-bit applications that use libusb)
> > MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64
> >
> > I used this code:
>
> libusb ships with an example executable called "listdevs.exe". Does it
> list all your devices? Unless you have libusb working, there is no
> need to try pyusb yet.
>
> Regards,
> Tormod
>
> ------------------------------------------------------------------------------
> _______________________________________________
> pyusb-users mailing list
> pyusb-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
Tormod Volden
2016-01-07 15:26:47 UTC
Permalink
On Thu, Jan 7, 2016 at 1:27 PM, igor bezenchuk wrote:
> I used libusb from libusb.info. here is the link I download it from:
> http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download
>
> it's libusb1.0.20 for windows binaries
>
> with listdev.exe it's working, here it my output:
> 0b95:1790 (bus 2, device 2) path: 25
> 8086:15b6 (bus 1, device 1)
> 0403:6010 (bus 2, device 4) path: 6
> 045e:0750 (bus 2, device 5) path: 14.1
> 045e:0750 (bus 2, device 5) path: 14.1
> 0403:6010 (bus 2, device 4) path: 6
> 0781:5580 (bus 1, device 2) path: 3
> 0557:7000 (bus 2, device 3) path: 14
> 8086:a12f (bus 2, device 1)
>
> so apparently libusb does work and manage to display USB devices properly.

And when you use usb.core.find() to select your device, it returns
None? When you use find_all=True, how many (and which, if you can
tell) devices are in the returned list?

Tormod

------------------------------------------------------------------------------
igor bezenchuk
2016-01-08 15:38:28 UTC
Permalink
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (D64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import usb.core>>> dev=usb.core.find(find_all=True)>>> print(dev)<generator object device_iter at 0x00000000030EEE58>
looks like it dosn't return any device found(other than Generator Object, which I am not sure what it is exactly) I tried it on more than one machine with similar conditions(windows 10 and windows 8.1 both with libusb 1.0.20 and pyusb1 and python 3.4.
> Date: Thu, 7 Jan 2016 16:26:47 +0100
> From: ***@gmail.com
> To: pyusb-***@lists.sourceforge.net
> Subject: Re: [pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4
>
> On Thu, Jan 7, 2016 at 1:27 PM, igor bezenchuk wrote:
> > I used libusb from libusb.info. here is the link I download it from:
> > http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download
> >
> > it's libusb1.0.20 for windows binaries
> >
> > with listdev.exe it's working, here it my output:
> > 0b95:1790 (bus 2, device 2) path: 25
> > 8086:15b6 (bus 1, device 1)
> > 0403:6010 (bus 2, device 4) path: 6
> > 045e:0750 (bus 2, device 5) path: 14.1
> > 045e:0750 (bus 2, device 5) path: 14.1
> > 0403:6010 (bus 2, device 4) path: 6
> > 0781:5580 (bus 1, device 2) path: 3
> > 0557:7000 (bus 2, device 3) path: 14
> > 8086:a12f (bus 2, device 1)
> >
> > so apparently libusb does work and manage to display USB devices properly.
>
> And when you use usb.core.find() to select your device, it returns
> None? When you use find_all=True, how many (and which, if you can
> tell) devices are in the returned list?
>
> Tormod
>
> ------------------------------------------------------------------------------
> _______________________________________________
> pyusb-users mailing list
> pyusb-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
Tormod Volden
2016-01-08 17:07:14 UTC
Permalink
On Fri, Jan 8, 2016 at 4:38 PM, igor bezenchuk wrote:
>
> Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit
> (
> D64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import usb.core
>>>> dev=usb.core.find(find_all=True)
>>>> print(dev)
> <generator object device_iter at 0x00000000030EEE58>
>
> looks like it dosn't return any device found(other than Generator Object,
> which I am not sure what it is exactly) I tried it on more than one machine
> with similar conditions(windows 10 and windows 8.1 both with libusb 1.0.20
> and pyusb1 and python 3.4.

find_all=True returns a list of devices (please see e.g.
https://github.com/walac/pyusb/blob/master/docs/tutorial.rst)

You must iterate through the list:
devices = usb.core.find(find_all=True)
for dev in devices:
print (dev.idProduct, dev.idVendor)

Probably you want to just find your device, and not all. It is all
explained in the tutorial.

Tormod

------------------------------------------------------------------------------
igor bezenchuk
2016-01-08 17:56:17 UTC
Permalink
I tried to run this price of code to check if usblib1 is getting detected by pyusb:

import osos.environ['PYUSB_DEBUG'] = 'debug'import usb.coreusb.core.find()
and this is the output:OSError: [WinError 193] %1 is not a valid Win32 application2016-01-08 19:51:45,676 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend2016-01-08 19:51:45,679 ERROR:usb.libloader:'OpenUSB library' could not be found2016-01-08 19:51:45,679 ERROR:usb.backend.openusb:Error loading OpenUSB backend2016-01-08 19:51:45,689 INFO:usb.core:find(): using backend "usb.backend.libusb0"2016-01-08 19:51:45,689 DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
looks like pyusb dosn't see libusb1
> Date: Fri, 8 Jan 2016 18:07:14 +0100
> From: ***@gmail.com
> To: pyusb-***@lists.sourceforge.net
> Subject: Re: [pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4
>
> On Fri, Jan 8, 2016 at 4:38 PM, igor bezenchuk wrote:
> >
> > Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit
> > (
> > D64)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> import usb.core
> >>>> dev=usb.core.find(find_all=True)
> >>>> print(dev)
> > <generator object device_iter at 0x00000000030EEE58>
> >
> > looks like it dosn't return any device found(other than Generator Object,
> > which I am not sure what it is exactly) I tried it on more than one machine
> > with similar conditions(windows 10 and windows 8.1 both with libusb 1.0.20
> > and pyusb1 and python 3.4.
>
> find_all=True returns a list of devices (please see e.g.
> https://github.com/walac/pyusb/blob/master/docs/tutorial.rst)
>
> You must iterate through the list:
> devices = usb.core.find(find_all=True)
> for dev in devices:
> print (dev.idProduct, dev.idVendor)
>
> Probably you want to just find your device, and not all. It is all
> explained in the tutorial.
>
> Tormod
>
> ------------------------------------------------------------------------------
> _______________________________________________
> pyusb-users mailing list
> pyusb-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
igor bezenchuk
2016-01-09 12:41:57 UTC
Permalink
Thanks !!I did added libusb-1.0.lib to lib folder in Python directory and then Python was able to use libusb1 backend with Pyusb.then I added for loop as Tormond has suggested and it worked.

From: ***@hotmail.com
To: pyusb-***@lists.sourceforge.net
Date: Fri, 8 Jan 2016 19:56:17 +0200
Subject: Re: [pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4




I tried to run this price of code to check if usblib1 is getting detected by pyusb:

import osos.environ['PYUSB_DEBUG'] = 'debug'import usb.coreusb.core.find()
and this is the output:OSError: [WinError 193] %1 is not a valid Win32 application2016-01-08 19:51:45,676 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend2016-01-08 19:51:45,679 ERROR:usb.libloader:'OpenUSB library' could not be found2016-01-08 19:51:45,679 ERROR:usb.backend.openusb:Error loading OpenUSB backend2016-01-08 19:51:45,689 INFO:usb.core:find(): using backend "usb.backend.libusb0"2016-01-08 19:51:45,689 DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
looks like pyusb dosn't see libusb1
> Date: Fri, 8 Jan 2016 18:07:14 +0100
> From: ***@gmail.com
> To: pyusb-***@lists.sourceforge.net
> Subject: Re: [pyusb-users] LibUSB and PyUSB on Windows 10 and python 3.4
>
> On Fri, Jan 8, 2016 at 4:38 PM, igor bezenchuk wrote:
> >
> > Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit
> > (
> > D64)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> import usb.core
> >>>> dev=usb.core.find(find_all=True)
> >>>> print(dev)
> > <generator object device_iter at 0x00000000030EEE58>
> >
> > looks like it dosn't return any device found(other than Generator Object,
> > which I am not sure what it is exactly) I tried it on more than one machine
> > with similar conditions(windows 10 and windows 8.1 both with libusb 1.0.20
> > and pyusb1 and python 3.4.
>
> find_all=True returns a list of devices (please see e.g.
> https://github.com/walac/pyusb/blob/master/docs/tutorial.rst)
>
> You must iterate through the list:
> devices = usb.core.find(find_all=True)
> for dev in devices:
> print (dev.idProduct, dev.idVendor)
>
> Probably you want to just find your device, and not all. It is all
> explained in the tutorial.
>
> Tormod
>
> ------------------------------------------------------------------------------
> _______________________________________________
> pyusb-users mailing list
> pyusb-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users


------------------------------------------------------------------------------
Loading...