On Sat, Jul 30, 2011 at 10:24 AM, C Duff <duffman....@gmail.com> wrote: > Nope, didn't work. I've tried 1,7,8,64,1000 nothing seems to work - they all > give the same error. > I should have mentioned this in the first message but I'm running ubuntu > 11.04 64 with python 2.7, if that makes a difference.
Try the following, it should work. I tested this under Ubuntu 10.10 64bit with Python 2.6. The last reset command is necessary due to potential bugs (data toggle) of the Microchip USB Firmware Framework. ------------------------------------ #!/usr/bin/env python import usb.core import usb.util #find our device dev = usb.core.find(idVendor=0x04D8, idProduct=0x0204) #was it found? if dev is None: raise ValueError('Device not found') #set the active configuration. with no args we use first config. dev.set_configuration() #turn light on print "Toggle LED by sending Toggle_LED command" dev.write(1, [0x080], 0, 1000) print "Sending read switch command" dev.write(1,[0x081],0,1000) s=dev.read(0x81,64,0,5000) print "Echo read switch command 0x81" print s[0] print "Read switch status, 1 means not pressed, 0 means pressed" print s[1] dev.reset() ------------------------------------ mcuee@ubuntu64:~/Desktop/build/pyusb/tutorial$ python testmchp_libusb1.py Toggle LED by sending Toggle_LED command Sending read switch command Echo read switch command 0x81 129 Read switch status, 1 means not pressed, 0 means pressed 1 mcuee@ubuntu64:~/Desktop/build/pyusb/tutorial$ python testmchp_libusb1.py Toggle LED by sending Toggle_LED command Sending read switch command Echo read switch command 0x81 129 Read switch status, 1 means not pressed, 0 means pressed 0 -- Xiaofan ------------------------------------------------------------------------------ Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users