The pyusb tutorial has an example of using the control transfer functions.

http://pyusb.sourceforge.net/docs/1.0/tutorial.html

>>> msg = 'test'
>>> assert dev.ctrl_transfer(0x40, CTRL_LOOPBACK_WRITE, 0, 0, msg) == len(msg)
>>> ret = dev.ctrl_transfer(0x40, CTRL_LOOPBACK_READ, 0, 0, len(msg))
>>> sret = ''.join([chr(x) for x in ret])
>>> assert sret == msg


I was wondering if it would be better (or more efficient) to use some of
the array functions.
e.g.

>>> sret = ''.join(ret.tolist())

or

>>> sret = ret.tostring()


Any thoughts on this ??

Also, just out of curiosity, what is the advantage of returning/using an
array object rather than a string ??

Why is a string object used for WRITE instead of a string ??
The WRITE and READ transfers seem a little inconsistent in the object
written and returned.

Thanks, Brendan.


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to