Hi Tormod, ok thanks for your reply! Can I assume, that the address 0x40 is custom, too?
If I use following code, assert dev.ctrl_transfer(0x40, usb.util.CTRL_OUT, 0, 0, msg) == len(msg) ret = dev.ctrl_transfer(0x40, usb.util.CTRL_IN, 0, 0, len(msg)) I get the error message: "usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending control message failed, win error: A device attached to the system is not functioning." I programmed an example that shows me the Endpoints and its directions. The output is: EP 0x81 Direction: IN EP 0x1 Direction: OUT So, if I change the address like this: assert dev.ctrl_transfer(0x1, usb.util.CTRL_OUT, 0, 0, msg) == len(msg) ret = dev.ctrl_transfer(0x81, usb.util.CTRL_IN, 0, 0, len(msg)) I get following error message: "usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending control message failed, win error: The parameter is incorrect." Do you know what's wrong? Regards Stefano -------- Original-Nachricht -------- > Datum: Mon, 1 Oct 2012 13:09:35 +0200 > Von: Tormod Volden <lists.tor...@gmail.com> > An: pyusb-users@lists.sourceforge.net > Betreff: Re: [pyusb-users] ctrl_transfer: Example is not working > On Mon, Oct 1, 2012 at 9:27 AM, Stefano Di Martino wrote: > > Hi everyone, > > I'm testing PyUSB right now and tried this example: > > > >>>> 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 > > > > The problem is, that the variables CTRL_LOOPBACK_WRITE and > CTRL_LOOPBACK_READ aren't recognized. I have imported usb.core and usb.util, > but it > doesn't work. > > I looked for these variables in the PyUSB source code with file search, > but I didn't find them. > > I'm using the latest 1.0.0a3 pyUSB and libusb-win32. > > > > Thanks in advance for any suggestion. > > Stefano > > > > Hi Stefano, > > I believe this example is taken from > http://pyusb.sourceforge.net/docs/1.0/tutorial.html > The accompanying text says: "In this example, it is assumed that our > device implements two custom control requests that act as a loopback > pipe. What you write with the CTRL_LOOPBACK_WRITE message, you can > read with the CTRL_LOOPBACK_READ message." > > So unless you have a device which implements these custom control > requests, the example code will not work. And if you have such a > device, it is up to the device what the values of CTRL_LOOPBACK_WRITE > and CTRL_LOOPBACK_READ should be. > > Regards, > Tormod > > ------------------------------------------------------------------------------ > Got visibility? > Most devs has no idea what their production app looks like. > Find out how fast your code is with AppDynamics Lite. > http://ad.doubleclick.net/clk;262219671;13503038;y? > http://info.appdynamics.com/FreeJavaPerformanceDownload.html > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users ------------------------------------------------------------------------------ Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users