2012/5/21 zz <z.zhangb...@gmail.com>: > Dear sir/madam > > When I am transmitting data by PyUSB ctrl_transfer () to EZ-USB FX2LP > microprocessor, it shows the error "Equipment connected to the system is not > functioning". Please help me to solve the problem. > > The purpose of the program is: to read data form a binary file, then > transmit the data to EZ-USB byte by byte, by ctrl_transfer () function. and > the code is as following. When running it, it can transmit several bytes of > data, but the number of times is random, and than it will shows the error > message: > usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending > control message failed, win error: Equipment connected to the system is not > functioning > > import usb.core > import binascii > import usb.util > import struct > import os > from os.path import getsize > > #file read > binfile=open('d:/digitalTest/display.bit', 'rb') > x=0 > y=os.path.getsize('d:/digitalTest/display.bit') > > #device find > dev = usb.core.find(idVendor=0x04B4, idProduct=0x1004) > dev.set_configuration() > > #write > while x<=y: > # binfile.seek(x) > a=binfile.read(1) > print 'a',type(a) > hexstr = binascii.b2a_hex(a) > print hexstr, type(hexstr),x > hexnum = int(hexstr,16) > print hexnum, type(hexnum),x > dev.ctrl_transfer(0x40, 0xaa, hexnum, 0,"",500) > x += 1 >
ctrl_transfer call seems wrong to me, please check the pydocs, I believe that "hexnum" argument should be in place of the "". -- Best Regards, Wander Lairson Costa ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users