On Thu, Apr 1, 2010 at 9:17 PM, Wander Lairson <wander.lair...@gmail.com> wrote:
> Hello Xiaofan,
>
> I have heard about libusb windows backedn a few weeks ago, but I
> haven't updated the code to work with it yet.
> I hope do it soon...
>

Since libusb-1.0 Windows backend is API compatible
with libusb-1.0 under Linux, so I think it is already quite
close to work.

So I copied libusb-1.0.dll to c:\windows\system32 and then
changed a few lines in libusb10.py.

def _load_library():
    if sys.platform == 'win32':
        libname = ctypes.util.find_library('libusb-1.0')
    else:
        libname = ctypes.util.find_library('usb-1.0')
    if libname is None:
        raise OSError('USB library could not be found')
    return CDLL(libname)

It seems to built, but then the test program failed. I think this
is because the default libusb-1.0.dll is using stdcall calling convention.

c:\pyusb\pyusb>c:\Python26\python.exe setup.py install
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\usb
copying usb\core.py -> build\lib\usb
copying usb\legacy.py -> build\lib\usb
copying usb\util.py -> build\lib\usb
copying usb\_interop.py -> build\lib\usb
copying usb\__init__.py -> build\lib\usb
creating build\lib\usb\backend
copying usb\backend\libusb01.py -> build\lib\usb\backend
copying usb\backend\libusb10.py -> build\lib\usb\backend
copying usb\backend\openusb.py -> build\lib\usb\backend
copying usb\backend\__init__.py -> build\lib\usb\backend
running install_lib
copying build\lib\usb\backend\libusb10.py -> c:\Python26\Lib\site-packages\usb\b
ackend
byte-compiling c:\Python26\Lib\site-packages\usb\backend\libusb10.py to libusb10
.pyc
running install_egg_info
Removing c:\Python26\Lib\site-packages\PyUSB-1.0.0_a0-py2.6.egg-info
Writing c:\Python26\Lib\site-packages\PyUSB-1.0.0_a0-py2.6.egg-info

c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests>c:\Python26\python.exe testall.py
Exception ValueError: 'Procedure called with not enough arguments (4 bytes missi
ng) or wrong calling convention' in <bound method _Initializer.__del__ of <usb.b
ackend.libusb10._Initializer object at 0x028BBFF0>> ignored
Traceback (most recent call last):
  File "testall.py", line 43, in <module>
    suite.addTest(m.get_suite())
  File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py", line 23
3, in get_suite
    idProduct=devinfo.ID_PRODUCT)
  File "c:\Python26\lib\site-packages\usb\core.py", line 823, in find
    return _interop._next(device_iter(k, v))
  File "c:\Python26\lib\site-packages\usb\_interop.py", line 67, in _next
    return next(iter)
  File "c:\Python26\lib\site-packages\usb\core.py", line 791, in device_iter
    for dev in backend.enumerate_devices():
  File "c:\Python26\lib\site-packages\usb\backend\libusb10.py", line 385, in enu
merate_devices
    return _DevIterator()
  File "c:\Python26\lib\site-packages\usb\backend\libusb10.py", line 374, in __i
nit__
    byref(self.dev_list))
WindowsError: exception: access violation reading 0x00000000
Exception ValueError: 'Procedure called with not enough arguments (8 bytes missi
ng) or wrong calling convention' in <bound method _DevIterator.__del__ of <usb.b
ackend.libusb10._DevIterator object at 0x028CCA30>> ignored

-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to