2014-05-21 14:08 GMT-03:00 Slavko Kocjancic <[email protected]>: > On 05/21/2014 05:27 PM, Wander Lairson Costa wrote: >> 2014-05-21 3:00 GMT-03:00 Slavko Kocjancic <[email protected]>: >>> On 05/21/2014 03:36 AM, Wander Lairson Costa wrote: >>>> 2014-05-20 13:26 GMT-03:00 Slavko Kocjancic <[email protected]>: >>>>> Hello... >>>>> >>>>> I'm new to python (and pyusb). >>>>> I try to port some VUSB device to work with python, but get at trouble >>>>> in beggining. I can't send bytes... >>>>> here is my example (stripped from manual...) >>>>> >>>>> import usb.core >>>>> import usb.util >>>>> >>>>> from array import * >>>>> dev = usb.core.find(idVendor=0x16c0, idProduct=0x05df) >>>>> if dev is None: >>>>> raise ValueError('Device not found') >>>>> dev.set_configuration() >>>>> >>>>> msg = 'test' >>>>> print dev.ctrl_transfer(32+128, 9, 0, 0, msg) >>>>> >>>> I guess the first argument should be just 32. >>> Well I want write. And bit 7 of first argument tells if this is write or >>> read. >>> and msg (at least by manual) behave as buffer for tx, and integer for >>> size in receive mode. >>> >> Yes, with this bit set, the request is an IN transfer, and the `msg` >> parameter is (wrongly) interpreted as the length of the transfer. > > I realized that when I wan't to read from device. I'm interpreted this > bit just opposite. But have other problem with win driver and take a lot > of time to discover what are wrong. At least it works now. > >
You can use the util.build_request_type function to avoid bit mistakes. -- Best Regards, Wander Lairson Costa ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ pyusb-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyusb-users
