Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-15 Thread Xiaofan Chen
On Thu, Apr 15, 2010 at 6:54 AM, Wander Lairson
wander.lair...@gmail.com wrote:

 And there are quite often problem like this: first run works and
 then 2nd run got time out. Typically the issue only happens
 under Linux. It is mostly related to set_interface command response.

 In this case, it is under Windows. So maybe the issue is different.

 I guess so. I will upgrade test firmware to version 2.6a and check it again.

 Thank you for the information.

BTW, the test firmware from libusbdotnet may be a good start point as well.
You can use the control transfer for the test mode. It has been updated
to V2.6a.
http://libusbdotnet.svn.sourceforge.net/viewvc/libusbdotnet/trunk/stage/Benchmark/Firmware/

Another simpler testing firmware can be the generic WinUSB
example from Jan Axelson.
http://www.lvr.com/winusb.htm
http://www.microchip.com/forums/fb.aspx?m=487447 (updates to use 2.6a)
http://www.microchip.com/forums/fb.aspx?m=475777 (libusb 1.0 test code)


-- 
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-14 Thread Xiaofan Chen
On Wed, Apr 14, 2010 at 10:24 PM, Wander Lairson
wander.lair...@gmail.com wrote:

 Deeper investigation showed that it is caused by calling
 set_configuration twice when device is connected. Example:

 import usb.core
 d = usb.core.find(idVendor=0xfffe)
 d.set_configuration()
 d.write(1, '0123456789')
 d.read(0x81, 10)

 The first time after connecting the device you run this script, it
 works fine, but next tries cause timeout error. If you disconnect and
 connect the device again, it works again. I suspect this is a test
 firmware bug. Keep investigating...


You seem to have two test firmware, one for PIC, one for ARM.
I only tried the PIC. You are basing your PIC firmware on the
old V1.x stack which may have some issues.
http://www.microchip.com/forums/tm.aspx?m=275422

And there are quite often problem like this: first run works and
then 2nd run got time out. Typically the issue only happens
under Linux. It is mostly related to set_interface command response.

In this case, it is under Windows. So maybe the issue is different.

-- 
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-09 Thread Wander Lairson
2010/4/8 Xiaofan Chen xiaof...@gmail.com:
 On Thu, Apr 8, 2010 at 10:01 PM, Xiaofan Chen xiaof...@gmail.com wrote:
 Ah, this may be the case. I need to ask again in the libusb mailing
 list. The MSVC solution generates stdcall. And I believe if they
 are different, then Pete will need to change the MinGW/Cygwin
 build to use stdcall.


 Indeed this is a problem.
 http://old.nabble.com/Calling-convention-of-the-libusb-1.0-Windows-snapshots-td28179386.html

 In my opinion, both should match and it seems to me using
 stdcall is the way to go.

 Wander: what is your opinion as the pyusb developer?

As a library developer, I understand that calling convention is part
of the API interface, and it should be explicit in the header file. If
we are speaking on Windows, and we want to support as much clients as
possible, we should we __stdcall. Some environments just cannot handle
__cdecl (coff coff VB6).



 --
 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


--
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-08 Thread Wander Lairson
libusb-1.0 for mingw feels like was built with cdecl calling
convention. When I load it with WinDLL (stdcall), it fails, but
loading it with CDLL (cdecl), it works fine:


C:\Documents and Settings\wander.costapython
ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 from ctypes import CDLL, WinDLL
 c = CDLL('libusb-1.0.dll')
 c.libusb_init(None)
0
 c.libusb_exit(None)
9775361
 w = WinDLL('libusb-1.0.dll')
 w.libusb_init(None)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: Procedure probably called with too many arguments (4 bytes in excess
)


Just wondering if cdecl calling convention for mingw is right... If it
is, I must manage libusb10 backend to detect it is loading a mingw lib
and apply cdecl calling convention.

Wander

2010/4/7 Xiaofan Chen xiaof...@gmail.com:
 For normal Windows Python 2.5 and 2.6, I have the same results.

 C:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsset PYUSB_DEBUG_LEVEL=debug

 C:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsc:\Python25\python.exe testall.py
 2010-04-07 11:17:04,351 DEBUG:usb.backend.libusb10:Error loading libusb 1.0 
 back
 end
 Traceback (most recent call last):
  File c:\Python25\Lib\site-packages\usb\backend\libusb10.py, line 558, in 
 get
 _backend
    _init = _Initializer()
  File c:\Python25\Lib\site-packages\usb\backend\libusb10.py, line 375, in 
 __i
 nit__
    _check(_lib.libusb_init(None))
 ValueError: Procedure probably called with too many arguments (4 bytes in 
 excess
 )
 Exception exceptions.ValueError: 'Procedure probably called with too many 
 argume
 nts (4 bytes in excess)' in bound method _Initializer.__del__ of 
 usb.backend.l
 ibusb10._Initializer object at 0x022CC170 ignored
 2010-04-07 11:17:04,407 DEBUG:usb.backend.openusb:Error loading OpenUSB 
 backend
 Traceback (most recent call last):
  File c:\Python25\Lib\site-packages\usb\backend\openusb.py, line 568, in 
 get_
 backend
    _lib = _load_library()
  File c:\Python25\Lib\site-packages\usb\backend\openusb.py, line 148, in 
 _loa
 d_library
    raise OSError('USB library could not be found')
 OSError: USB library could not be found
 2010-04-07 11:17:04,437 INFO:usb.core:Using backend usb.backend.libusb01
 2010-04-07 11:17:04,440 WARNING:usb.test:Test hardware not connected
 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:\Python25\Lib\site-packages\usb\core.py, line 835, in find
    return _interop._next(device_iter(k, v))
  File c:\Python25\Lib\site-packages\usb\_interop.py, line 61, in _next
    return iter.next()
  File c:\Python25\Lib\site-packages\usb\core.py, line 802, in device_iter
    for dev in backend.enumerate_devices():
  File c:\Python25\Lib\site-packages\usb\backend\libusb10.py, line 397, in 
 enu
 merate_devices
    return _DevIterator()
  File c:\Python25\Lib\site-packages\usb\backend\libusb10.py, line 386, in 
 __i
 nit__
    byref(self.dev_list))
 WindowsError: exception: access violation reading 0x
 Exception exceptions.ValueError: 'Procedure probably called with too many 
 argume
 nts (8 bytes in excess)' in bound method _DevIterator.__del__ of 
 usb.backend.l
 ibusb10._DevIterator object at 0x022CCDB0 ignored

 C:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsc:\Python26\python.exe testall.py
 2010-04-07 11:18:03,388 DEBUG:usb.backend.libusb10:Error loading libusb 1.0 
 back
 end
 Traceback (most recent call last):
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 558, in 
 get
 _backend
    _init = _Initializer()
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 375, in 
 __i
 nit__
    _check(_lib.libusb_init(None))
 ValueError: Procedure probably called with too many arguments (4 bytes in 
 excess
 )
 Exception ValueError: 'Procedure probably called with too many arguments (4 
 byte
 s in excess)' in bound method _Initializer.__del__ of 
 usb.backend.libusb10._In
 itializer object at 0x0270E7F0 ignored
 2010-04-07 11:18:03,424 DEBUG:usb.backend.openusb:Error loading OpenUSB 
 backend
 Traceback (most recent call last):
  File c:\Python26\lib\site-packages\usb\backend\openusb.py, line 568, in 
 get_
 backend
    _lib = _load_library()
  File c:\Python26\lib\site-packages\usb\backend\openusb.py, line 148, in 
 _loa
 d_library
    raise OSError('USB library could not be found')
 OSError: USB library could not be found
 2010-04-07 11:18:03,451 INFO:usb.core:Using backend usb.backend.libusb01
 2010-04-07 11:18:03,453 WARNING:usb.test:Test hardware not connected
 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 

Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-08 Thread Wander Lairson
2010/4/8 Xiaofan Chen xiaof...@gmail.com:
 On Thu, Apr 8, 2010 at 9:38 PM, Wander Lairson wander.lair...@gmail.com 
 wrote:
 libusb-1.0 for mingw feels like was built with cdecl calling
 convention. When I load it with WinDLL (stdcall), it fails, but
 loading it with CDLL (cdecl), it works fine:

 Just wondering if cdecl calling convention for mingw is right... If it
 is, I must manage libusb10 backend to detect it is loading a mingw lib
 and apply cdecl calling convention.


 Ah, this may be the case. I need to ask again in the libusb mailing
 list. The MSVC solution generates stdcall. And I believe if they
 are different, then Pete will need to change the MinGW/Cygwin
 build to use stdcall.

OK.


 Are you using the binary snapshots from the libusb website?
 http://www.libusb.org/wiki/windows_backend

Yes, I am.



 --
 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


--
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-08 Thread Xiaofan Chen
On Thu, Apr 8, 2010 at 8:08 AM, Wander Lairson wander.lair...@gmail.com wrote:
 I tried to manually interact with device using python command prompt,
 and it worked fine:

 C:\Projetos\pyusb\trunkpython
 ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
 Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 import usb.core
 d = usb.core.find(idVendor=0xfffe)
 d.write(1, teste)
 5
 d.read(5)
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: read() takes at least 3 arguments (2 given)
 d.read(0x81, 5)
 array('B', [116, 101, 115, 116, 101])
 exit()


I rebuild the DLL with MSVC2008 and it is now working fine when
using interactive Python.

c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testspython
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 import usb.core
 d=usb.core.find(idVendor=0xfffe)
 d.write(1,Hello)
5
 d.read(0x81,5)
array('B', [72, 101, 108, 108, 111])
 exit()

But there are a few errors for the tests.

c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsset PYUSB_DEBUG_LEVEL=5

c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testspython testall.py
2010-04-08 22:16:46,720 INFO:usb.test:Adding BackendTest(usb.backend.libusb10) t
o test suite...
2010-04-08 22:16:46,726 INFO:usb.test:Adding BackendTest(usb.backend.libusb01) t
o test suite...
2010-04-08 22:16:46,733 WARNING:usb.test:BackendTest(usb.backend.openusb) is not
 available
2010-04-08 22:16:46,861 INFO:usb.test:Adding DeviceTest(usb.backend.libusb10) to
 test suite...
2010-04-08 22:16:46,862 INFO:usb.test:Adding ConfigurationTest(usb.backend.libus
b10) to test suite...
2010-04-08 22:16:46,865 INFO:usb.test:Adding InterfaceTest(usb.backend.libusb10)
 to test suite...
2010-04-08 22:16:46,867 INFO:usb.test:Adding EndpointTest(usb.backend.libusb10)
to test suite...
2010-04-08 22:16:46,871 WARNING:usb.test:Test hardware not found for backend usb
.backend.libusb01
EF.E..E..
==
ERROR: runTest (test_backend.BackendTest)
--
Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 49, in
 runTest
self.test_open_device()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 119, i
n test_open_device
self.handle = self.backend.open_device(self.dev)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 427,
 in open_device
_check(_lib.libusb_open(dev.devid, byref(handle)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 344,
 in _check
raise USBError(_str_error[retval.value])
USBError: Access denied (insufficient permissions)

==
ERROR: runTest (test_integration.DeviceTest)
--
Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 59
, in runTest
self.test_write_read()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 12
0, in test_write_read
ret = utils.to_array(self.dev.read(ep[1], len(data)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 632, in read
self.__get_timeout(timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 461,
 in bulk_read
timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 549,
 in __read
timeout))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 344,
 in _check
raise USBError(_str_error[retval.value])
USBError: Operation timed out

==
ERROR: runTest (test_integration.EndpointTest)
--
Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 20
6, in runTest
self.test_write_read()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 22
1, in test_write_read
ret = utils.to_array(self.ep_in.read(len(data)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 281, in read
return self.device.read(self.bEndpointAddress, size, self.interface, timeout
)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 632, in read
self.__get_timeout(timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 461,
 in bulk_read
timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 549,
 in __read
timeout))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 344,
 in _check
raise USBError(_str_error[retval.value])

Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-08 Thread Wander Lairson
2010/4/8 Xiaofan Chen xiaof...@gmail.com:
 On Thu, Apr 8, 2010 at 8:08 AM, Wander Lairson wander.lair...@gmail.com 
 wrote:
 I tried to manually interact with device using python command prompt,
 and it worked fine:

 C:\Projetos\pyusb\trunkpython
 ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
 Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 import usb.core
 d = usb.core.find(idVendor=0xfffe)
 d.write(1, teste)
 5
 d.read(5)
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: read() takes at least 3 arguments (2 given)
 d.read(0x81, 5)
 array('B', [116, 101, 115, 116, 101])
 exit()


 I rebuild the DLL with MSVC2008 and it is now working fine when
 using interactive Python.

 c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testspython
 Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 import usb.core
 d=usb.core.find(idVendor=0xfffe)
 d.write(1,Hello)
 5
 d.read(0x81,5)
 array('B', [72, 101, 108, 108, 111])
 exit()

 But there are a few errors for the tests.

 c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsset PYUSB_DEBUG_LEVEL=5

 c:\cygwin\home\mcuee\mcu\pyusb\pyusb\testspython testall.py
 2010-04-08 22:16:46,720 INFO:usb.test:Adding 
 BackendTest(usb.backend.libusb10) t
 o test suite...
 2010-04-08 22:16:46,726 INFO:usb.test:Adding 
 BackendTest(usb.backend.libusb01) t
 o test suite...
 2010-04-08 22:16:46,733 WARNING:usb.test:BackendTest(usb.backend.openusb) is 
 not
  available
 2010-04-08 22:16:46,861 INFO:usb.test:Adding DeviceTest(usb.backend.libusb10) 
 to
  test suite...
 2010-04-08 22:16:46,862 INFO:usb.test:Adding 
 ConfigurationTest(usb.backend.libus
 b10) to test suite...
 2010-04-08 22:16:46,865 INFO:usb.test:Adding 
 InterfaceTest(usb.backend.libusb10)
  to test suite...
 2010-04-08 22:16:46,867 INFO:usb.test:Adding 
 EndpointTest(usb.backend.libusb10)
 to test suite...
 2010-04-08 22:16:46,871 WARNING:usb.test:Test hardware not found for backend 
 usb
 .backend.libusb01
 EF.E..E..
 ==
 ERROR: runTest (test_backend.BackendTest)
 --
 Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 49, 
 in
  runTest
    self.test_open_device()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 119, 
 i
 n test_open_device
    self.handle = self.backend.open_device(self.dev)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 
 427,
  in open_device
    _check(_lib.libusb_open(dev.devid, byref(handle)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 
 344,
  in _check
    raise USBError(_str_error[retval.value])
 USBError: Access denied (insufficient permissions)

I think this is caused because it is trying to opening the device
before an older object deletes it.
I will investigate it.


 ==
 ERROR: runTest (test_integration.DeviceTest)
 --
 Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 
 59
 , in runTest
    self.test_write_read()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 
 12
 0, in test_write_read
    ret = utils.to_array(self.dev.read(ep[1], len(data)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 632, in read
    self.__get_timeout(timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 
 461,
  in bulk_read
    timeout)
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 
 549,
  in __read
    timeout))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py, line 
 344,
  in _check
    raise USBError(_str_error[retval.value])
 USBError: Operation timed out


Maybe it is just a matter of a longer timeout value or is a
consequence of previous errors.

 ==
 ERROR: runTest (test_integration.EndpointTest)
 --
 Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 
 20
 6, in runTest
    self.test_write_read()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py, line 
 22
 1, in test_write_read
    ret = utils.to_array(self.ep_in.read(len(data)))
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 281, in read
    return self.device.read(self.bEndpointAddress, size, self.interface, 
 timeout
 )
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py, line 632, in read
    

Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-08 Thread Xiaofan Chen
On Thu, Apr 8, 2010 at 10:01 PM, Xiaofan Chen xiaof...@gmail.com wrote:
 Ah, this may be the case. I need to ask again in the libusb mailing
 list. The MSVC solution generates stdcall. And I believe if they
 are different, then Pete will need to change the MinGW/Cygwin
 build to use stdcall.


Indeed this is a problem.
http://old.nabble.com/Calling-convention-of-the-libusb-1.0-Windows-snapshots-td28179386.html

In my opinion, both should match and it seems to me using
stdcall is the way to go.

Wander: what is your opinion as the pyusb developer?


-- 
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-07 Thread Xiaofan Chen
On Thu, Apr 8, 2010 at 7:37 AM, Wander Lairson wander.lair...@gmail.com wrote:
 with libusb 1.0 built with Visual C++, it is hanging during the tests:

 C:\Projetos\pyusb\trunkcd tests

 C:\Projetos\pyusb\trunk\testspython testall.py
 2010-04-07 20:26:02,765 WARNING:usb.test:BackendTest(usb.backend.openusb) is 
 not
  available
 2010-04-07 20:26:02,905 WARNING:usb.test:Test hardware not found for backend 
 usb
 .backend.libusb01
 EF.


 Here is the call stack of python.exe process:
 http://img714.imageshack.us/img714/3227/stack.jpg



Just wondering what is the device driver you are using for this test? To
use the current libusb 1.0 Windows backend, you have to use the
WinUSB driver, and not libusb-win32 device driver.

After the WinUSB/HID backend, Pete will integrate the libusb-win32
device driver (libusb0.sys) backend.

-- 
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-07 Thread Wander Lairson
I tried to manually interact with device using python command prompt,
and it worked fine:

C:\Projetos\pyusb\trunkpython
ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 import usb.core
 d = usb.core.find(idVendor=0xfffe)
 d.write(1, teste)
5
 d.read(5)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: read() takes at least 3 arguments (2 given)
 d.read(0x81, 5)
array('B', [116, 101, 115, 116, 101])
 exit()

Although not showed above, it is using libusb 1.0, as libusb 0.1 would
fail to enumerate the device (it is not using libusb0.sys driver).
After that, I disconnected and reconnected the device, and the hanging
problem came back. I will investigate a bit further, and report any
news...

Wander

2010/4/7 Xiaofan Chen xiaof...@gmail.com:
 On Thu, Apr 8, 2010 at 7:55 AM, Wander Lairson wander.lair...@gmail.com 
 wrote:
 I am using WinUSB, but suddenly the problem stopped to occur, now I am
 having that access denied problem...


 I see. Now we have the same problem with native Python installation
 and libusb 1.0 Windows. I will say it is a strange problem but I am not
 a Python expert.


 --
 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


--
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-06 Thread Xiaofan Chen
On Tue, Apr 6, 2010 at 9:26 PM, Wander Lairson wander.lair...@gmail.com wrote:
 I added some preliminary log support to PyUSB at revision 56, it uses
 the logging module. Currently, you can define the environment variable
 PYUSB_DEBUG_LEVEL with the following values: critical, error, warning,
 information, debug. Running tests with debug defined, explain why
 get_backend failed with a stack trace. I hope this can help to find
 bugs. It is very raw and there are few messages yet.


Hmm, the error is rather strange.

C:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsc:\Python26\python.exe
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 import usb.core
 import usb.backend.libusb10
 a=usb.backend.libusb10.get_backend()
2010-04-06 21:58:36,944 DEBUG:usb.backend.libusb10:Error loading libusb 1.0 back
end
Traceback (most recent call last):
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 558, in get
_backend
_init = _Initializer()
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 375, in __i
nit__
_check(_lib.libusb_init(None))
ValueError: Procedure probably called with too many arguments (4 bytes in excess
)
Exception ValueError: 'Procedure probably called with too many arguments (4 byte
s in excess)' in bound method _Initializer.__del__ of usb.backend.libusb10._In
itializer object at 0x026A6910 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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-06 Thread Wander Lairson
I haven't cygwin environment here, so I tested against my default
Python installation and got it the same error. I guess we should test
it with python which comes with cygwin. I will try it on my home
machine.

Wander

2010/4/6 Xiaofan Chen xiaof...@gmail.com:
 On Tue, Apr 6, 2010 at 9:26 PM, Wander Lairson wander.lair...@gmail.com 
 wrote:
 I added some preliminary log support to PyUSB at revision 56, it uses
 the logging module. Currently, you can define the environment variable
 PYUSB_DEBUG_LEVEL with the following values: critical, error, warning,
 information, debug. Running tests with debug defined, explain why
 get_backend failed with a stack trace. I hope this can help to find
 bugs. It is very raw and there are few messages yet.


 Hmm, the error is rather strange.

 C:\cygwin\home\mcuee\mcu\pyusb\pyusb\testsc:\Python26\python.exe
 Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 import usb.core
 import usb.backend.libusb10
 a=usb.backend.libusb10.get_backend()
 2010-04-06 21:58:36,944 DEBUG:usb.backend.libusb10:Error loading libusb 1.0 
 back
 end
 Traceback (most recent call last):
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 558, in 
 get
 _backend
    _init = _Initializer()
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 375, in 
 __i
 nit__
    _check(_lib.libusb_init(None))
 ValueError: Procedure probably called with too many arguments (4 bytes in 
 excess
 )
 Exception ValueError: 'Procedure probably called with too many arguments (4 
 byte
 s in excess)' in bound method _Initializer.__del__ of 
 usb.backend.libusb10._In
 itializer object at 0x026A6910 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


--
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


Re: [pyusb-users] pyusb 1.0 with libusb 1.0 Windows Backend

2010-04-05 Thread Wander Lairson
2010/4/3 Xiaofan Chen xiaof...@gmail.com:
 On Sun, Apr 4, 2010 at 10:39 AM, Xiaofan Chen xiaof...@gmail.com wrote:
 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.

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.


 So I rebuild libusb-1.0.dll with cdecl calling convention.
 This time the test suite goes much further. I know this
 is not a proper fix since libusb-1.0.dll will be using
 stdcall calling convention. But this is just for testing.

I will fix that.


 The error is rather strange though.

 c:\pyusb\pyusb\testsc:\Python26\python.exe testall.py
 Adding BackendTest(usb.backend.libusb10) to test suite...
 Adding BackendTest(usb.backend.libusb01) to test suite...
 Adding DeviceTest(usb.backend.libusb10) to test suite...
 Adding ConfigurationTest(usb.backend.libusb10) to test suite...
 Adding InterfaceTest(usb.backend.libusb10) to test suite...
 Adding EndpointTest(usb.backend.libusb10) to test suite...
 EF...
 ==
 ERROR: runTest (test_backend.BackendTest)
 --
 Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 50, 
 in
  runTest
    self.test_open_device()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 120,
 in test_open_device
    self.handle = self.backend.open_device(self.dev)
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 415, in
 open_device
    _check(_lib.libusb_open(dev.devid, byref(handle)))
  File c:\Python26\lib\site-packages\usb\backend\libusb10.py, line 332, in
 _check
    raise USBError(_str_error[retval.value])
 USBError: Access denied (insufficient permissions)

 ==
 FAIL: runTest (test_backend.BackendTest)
 --
 Traceback (most recent call last):
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 45, 
 in
  runTest
    self.test_enumerate_devices()
  File c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py, line 68, 
 in
  test_enumerate_devices
    self.fail('PyUSB test device not found')
 AssertionError: PyUSB test device not found

When I port 1.0 windows backend, I will check. But maybe not in time
for alpha 0 release.


 --
 Ran 13 tests in 0.390s

 FAILED (failures=1, errors=1)

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

Thank you for all your effort testing PyUSB!! :)


 --
 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


--
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