| 
      
      
      From: Ray S. <ra...@bl...> - 2006-09-08 23:28:22
       | 
| I just tried to wrap libusb0.dll with ctypes' codegenerator, http://starship.python.net/crew/theller/ctypes/old/codegen.html >python C:\Python24\Lib\site-packages\ctypes\wrap\h2xml.py usb.h -o usb.xml -c OK >C:\Python24\Lib\site-packages\ctypes\wrap\xml2py.py usb.xml -l libusb0.dll -o usb.py which seems to go OK, mostly, but I get a zillion: # unresolved alias: AddPrintProcessor = AddPrintProcessorA # unresolved alias: VarUI2FromInt = VarUI2FromI4 ... What extra header do I need to allow the script to resolve these references in the dll? Is this a (also) question for ctypes-users? Ray Schumacher | 
| 
      
      
      From: Xiaofan C. <xia...@gm...> - 2006-09-11 23:06:05
       | 
| On 9/8/06, Ray Schumacher <ra...@bl...> wrote: > I just tried to wrap libusb0.dll with ctypes' codegenerator, > http://starship.python.net/crew/theller/ctypes/old/codegen.html > >python C:\Python24\Lib\site-packages\ctypes\wrap\h2xml.py usb.h -o usb.xml -c > Sorry I am not so sure what you want to achieve but you might want to look at the following two projects if you want to use libusb with Python. Both works under Linux/Windows/Mac OS X. 1) BITPIM libusb Python wrapper http://www.bitpim.org/pyxr/c/projects/bitpim/src/native/usb/usb.py.html Mark Rages is using it for the pyk project, a Python program to talk to PICkit 2 (a small USB programmer for Microchip PICs) under Linux. I've tried it under Windows and it works well. 2) PyUSB http://pyusb.berlios.de/ I've tested it with PICKit 2 and it works too. Regards, Xiaofan | 
| 
      
      
      From: Ray S. <ra...@bl...> - 2006-09-12 00:41:59
       | 
| At 04:06 PM 9/11/2006, you wrote: >On 9/8/06, Ray Schumacher <ra...@bl...> wrote: >> I just tried to wrap libusb0.dll with ctypes' codegenerator, >> http://starship.python.net/crew/theller/ctypes/old/codegen.html >> >python C:\Python24\Lib\site-packages\ctypes\wrap\h2xml.py usb.h -o usb.xml -c >> > >Sorry I am not so sure what you want to achieve but you might want to >look at the following two projects if you want to use libusb with Python. >Both works under Linux/Windows/Mac OS X. Hi Xiaofan, I've been trying pyusb, but getting some errors in the bulkreads, so I'm trying to work around it. I did just get codegenerator to wrap libusb0.dll, but have not written code for it yet. >1) BITPIM libusb Python wrapper >http://www.bitpim.org/pyxr/c/projects/bitpim/src/native/usb/usb.py.html > >Mark Rages is using it for the pyk project, a Python program to talk >to PICkit 2 (a small USB programmer for Microchip PICs) under Linux. >I've tried it under Windows and it works well. What/which did you use? I just downloaded from http://svn.sourceforge.net/viewvc/bitpim/releases/0.9.07/src/native/usb/ and got "ImportError: libusb not supported on win32" under Python >2) PyUSB >http://pyusb.berlios.de/ > >I've tested it with PICKit 2 and it works too. It mostly works for me, but for some odd bulkread data drop/error. Thanks, Ray | 
| 
      
      
      From: Xiaofan C. <xia...@gm...> - 2006-09-12 01:14:20
       | 
| On 9/11/06, Ray Schumacher <ra...@bl...> wrote: > I've been trying pyusb, but getting some errors in the bulkreads, > so I'm trying to work around it. > I did just get codegenerator to wrap libusb0.dll, but have not > written code for it yet. > > >1) BITPIM libusb Python wrapper > >http://www.bitpim.org/pyxr/c/projects/bitpim/src/native/usb/usb.py.html > > What/which did you use? > I just downloaded from > http://svn.sourceforge.net/viewvc/bitpim/releases/0.9.07/src/native/usb/ > and got "ImportError: libusb not supported on win32" under Python You need to build the wrapper dll by yourself. I've posted the binary packages in Microchip Forum. http://forum.microchip.com/tm.aspx?m=110205 Check out the pyk-0.4 binary. I have put the batch file (mybuild.bat) and the compiled wrapper dll (_libusb.dll) inside the zip archive. I am using Python 2.4/SWIG-1.3.24/libusb-win32 0.1.10.1 as well as MinGW. You probably need to build your own wrapper depending on your tools. > >2) PyUSB > >http://pyusb.berlios.de/ > > It mostly works for me, but for some odd bulkread data drop/error. The author (Wander Lairson) is very helpful, you can always contact him about the error. Lat time I found a minor bug and he helped to solve it. You can also use DebugView with and turn on debug option for libusb-win32. Last time Stephan Meyer helped me to find out one issue with bulkread. Checkout the libusb-win32 mailing list archive. It is a pity that I do not know much about host programming so that I do not really explore a bit deeper with PyUSB. Still I think using DebugView with libusb-win32 can be a nice tool for libusb-win32 application debugging (including pyusb and bitpim libusb wrapper). http://sourceforge.net/mailarchive/message.php?msg_id=13464331 Regards, Xiaofan | 
| 
      
      
      From: Ray S. <ra...@bl...> - 2006-09-12 21:18:14
       | 
| Hi Xiaofan, At 06:14 PM 9/11/2006, you wrote: >I've posted the binary packages in Microchip Forum. >http://forum.microchip.com/tm.aspx?m=110205 >Check out the pyk-0.4 binary. ... You probably need to build your own wrapper >depending on your tools. OK; I just used the .4 binary, and v0.10 of libusb_win32 >> >2) PyUSB >> >http://pyusb.berlios.de/ >> >> It mostly works for me, but for some odd bulkread data drop/error. > >The author (Wander Lairson) is very helpful, you can always contact >him about the error. Lat time I found a minor bug and he helped to solve it. Yes, he is quite helpful, he's testing pyusb .34 with libusb_win32 v0.12 (he indicated) >You can also use DebugView with and turn on debug option for libusb-win32. Nice, I've re-installed .34/0.10 with debug on My original code tells the device that it wants 2**8*64 samples fh.controlMsg(HOST2DEVICE, request=int(0x04), buffer=struct.pack("L",256), index=INTERFACE) and data always comes up an odd number short as I loop over ans += bulkRead(ADS1271EVMBULKIN, usbBlocks*64) The device thinks it's done, and I haven't gotten 16384 samples.... I tried your pyk-0.4 version of usb.py, but I haven't figured out how to do a usb_control_msg properly with it to send the device firmware its commands. I also have some pyrex based libusb code from the firmware author to look at now, so I'll keep trying. Thanks for the input! Ray |