From: Michel A. <mic...@vi...> - 2015-03-02 05:06:11
|
Hi, In my current project I must communicate through the USB bus with several micro controllers which are USB ready. I want to do this in Python running on Windows 7-64bits. PyUSB 1.0.0b2 is installed as well as libusb-win32 ( libusb-win32-devel-filter-1.2.6.0.exe was used without adding a filter for a particular device) The file libusb0.dll is present in C:\Windows\System32\ and the file libusb0.sys is present in C:\Windows\System32\drivers\. My test script is the following import os os.environ['PYUSB_DEBUG']='debug' os.environ['PYUSB_LOG_FILENAME']="D:\LOG_ERR_TEST.txt" import usb.core import usb.util dev = usb.core.find(find_all = True) And it produces the following error: Traceback (most recent call last): File "C:\Python34\Test PYUSB.py", line 13, in <module> dev = usb.core.find(find_all = True) File "C:\Python34\usb\core.py", line 1219, in find raise ValueError('No backend available') ValueError: No backend available The error log file goes like this: 2015-02-27 22:22:24,995 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:22:24,996 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:22:25,000 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:22:25,001 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:22:25,012 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-27 22:22:25,013 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-27 22:25:16,570 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:25:16,571 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:25:16,575 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:25:16,576 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:25:16,586 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-27 22:25:16,588 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-27 22:35:31,821 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:35:31,822 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:35:31,827 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:35:31,827 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:35:31,838 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-27 22:35:31,840 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-27 22:40:53,266 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:40:53,267 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:40:53,272 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:40:53,272 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:40:53,282 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide 2015-02-27 22:40:53,284 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-27 22:41:37,963 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:41:37,964 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:41:37,969 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:41:37,969 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-27 22:41:37,981 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-27 22:42:38,367 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-27 22:42:38,368 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-27 22:42:38,372 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-27 22:42:38,373 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-27 22:42:38,383 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide 2015-02-27 22:42:38,384 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-28 12:23:20,858 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-28 12:23:20,858 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-28 12:23:20,858 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-28 12:23:20,858 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-28 12:23:20,858 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-28 12:23:20,878 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend 2015-02-28 16:51:36,357 ERROR:usb.libloader:'Libusb 1' could not be found 2015-02-28 16:51:36,367 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend 2015-02-28 16:51:36,367 ERROR:usb.libloader:'OpenUSB library' could not be found 2015-02-28 16:51:36,367 ERROR:usb.backend.openusb:Error loading OpenUSB backend 2015-02-28 16:51:36,367 ERROR:usb.libloader:Libusb 0 (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded Traceback (most recent call last): File "C:\Python34\usb\libloader.py", line 116, in load_library return ctypes.CDLL(lib) File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 n'est pas une application Win32 valide (in English : "not a valid Win32 application") 2015-02-28 16:51:36,367 ERROR:usb.backend.libusb0:Error loading libusb 0.1 backend Can you help me solve this problem? Thanking you in advance Michel Allaire |
From: Xiaofan C. <xia...@gm...> - 2015-03-02 13:05:37
|
On Mon, Mar 2, 2015 at 1:06 PM, Michel Allaire <mic...@vi...> wrote: > 2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0 > (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded You probably want to delete this file and try again. C:\WinAVR-20100110\bin\libusb0.dll -- Xiaofan |
From: Michel A. <mic...@vi...> - 2015-03-02 18:40:25
|
Thank you for your fast response. Before receiving your response, I had tried this: I was working initially with Python 3.4.3 so I uninstalled it and installed version 2.7.9. Then the "No backend available" error disappeared. I uninstalled Python 2.27.9 and came back to Python 3.4.3 and still no error. Puzzling! But it seems that I can't access the list devices on the bus with the following script: import usb.core import usb.util list_dev = usb.core.find(find_all=True) n = 0 for dev in list_dev: n = n+1 print (n, " " , dev) Could it be because I did not specified any filter or .INF file since I want to scan the bus myself to connect to microcontrollers in a arbitrary number and USB ready Will this behavior also exists on my target operating system with will be Linux running on à Raspberry PI. Best regards Michel Allaire -----Message d'origine----- De : Xiaofan Chen [mailto:xia...@gm...] Envoyé : 2 mars 2015 08:06 À : pyu...@li... Objet : Re: [pyusb-users] No backend available with windows 7 On Mon, Mar 2, 2015 at 1:06 PM, Michel Allaire <mic...@vi...> wrote: > 2015-02-27 22:41:37,979 ERROR:usb.libloader:Libusb 0 > (C:\WinAVR-20100110\bin\libusb0.dll) could not be loaded You probably want to delete this file and try again. C:\WinAVR-20100110\bin\libusb0.dll -- Xiaofan ---------------------------------------------------------------------------- -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ pyusb-users mailing list pyu...@li... https://lists.sourceforge.net/lists/listinfo/pyusb-users |
From: Xiaofan C. <xia...@gm...> - 2015-03-03 01:20:13
|
On Tue, Mar 3, 2015 at 2:40 AM, Michel Allaire <mic...@vi...> wrote: > But it seems that I can't access the list devices on the bus with the > following script: > > import usb.core > import usb.util > > list_dev = usb.core.find(find_all=True) > n = 0 > for dev in list_dev: > n = n+1 > print (n, " " , dev) > > > Could it be because I did not specified any filter or .INF file since I want > to scan the bus myself to connect to microcontrollers in a arbitrary number > and USB ready Yes. If you use libusb-win32 under Windows, you have to have one supported device with libusb0.sys driver. If you use libusb-1.0 backend (libusb Windows backend), then you do not need to have a device with a supported driver (eg WinUSB) to find the device, but then you need to have such a device if you want to do more than that (read/write endpoint, etc). > Will this behavior also exists on my target operating system with will be > Linux running on à Raspberry PI. No. Linux is different since libusb uses usbfs under Linux (you do need to detach non-usbfs driver first). -- Xiaofan |
From: Michel A. <mic...@vi...> - 2015-03-04 02:22:07
|
Thank you very much and my best regards Michel Allaire -----Message d'origine----- De : Xiaofan Chen [mailto:xia...@gm...] Envoyé : 2 mars 2015 20:20 À : pyu...@li... Objet : Re: [pyusb-users] No backend available with windows 7 On Tue, Mar 3, 2015 at 2:40 AM, Michel Allaire <mic...@vi...> wrote: > But it seems that I can't access the list devices on the bus with the > following script: > > import usb.core > import usb.util > > list_dev = usb.core.find(find_all=True) n = 0 for dev in list_dev: > n = n+1 > print (n, " " , dev) > > > Could it be because I did not specified any filter or .INF file since > I want to scan the bus myself to connect to microcontrollers in a > arbitrary number and USB ready Yes. If you use libusb-win32 under Windows, you have to have one supported device with libusb0.sys driver. If you use libusb-1.0 backend (libusb Windows backend), then you do not need to have a device with a supported driver (eg WinUSB) to find the device, but then you need to have such a device if you want to do more than that (read/write endpoint, etc). > Will this behavior also exists on my target operating system with will > be Linux running on à Raspberry PI. No. Linux is different since libusb uses usbfs under Linux (you do need to detach non-usbfs driver first). -- Xiaofan ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ pyusb-users mailing list pyu...@li... https://lists.sourceforge.net/lists/listinfo/pyusb-users |