On Mon, Apr 19, 2010 at 5:22 PM, Xiaofan Chen <xiaof...@gmail.com> wrote: > > As a test, I delete pyusb 1.0 and then install pyusb-0.4.2. It does > seem to work.
The following is a simple test program for Microchip PICkit 2. It does seem to work. #!/usr/bin/env python import usb def opendevice(idVendor, idProduct): devices=[] for b in usb.busses(): for d in b.devices: if d.idVendor==idVendor and d.idProduct==idProduct: devices.append(d) if len(devices)==1: device=devices[0] return device elif not devices: raise "Device not found" else: raise "More than one device found" if __name__=="__main__": device=opendevice(0x04d8, 0x0033) packet_len=64 dh=device.open() dh.setConfiguration(1) print "set Configuration 1" dh.claimInterface(0) print "claim Interface 0" #dh.setAltInterface(0) # To get firmware version number print "Sending version command by USB interrupt write" dh.interruptWrite(0x01,"v"+(packet_len-1)*"Z",1000) print "Getting version command by USB interrupt write" r=dh.interruptRead(0x81,3,1000) print r [mc...@myfreebsd ~/Desktop/build/pyusb/tests]$ python testpk2.py set Configuration 1 claim Interface 0 Sending version command by USB interrupt write Getting version command by USB interrupt write (2, 32, 0) -- Xiaofan http://mcuee.blogspot.com ------------------------------------------------------------------------------ Download Intel® 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