I am trying to write to a PS3 controller using the following line (dev has been set properly).
dev.ctrl_transfer(0x40, CTRL_LOOPBACK_WRITE, 0, 0, msg)
I get an error that CTRL_LOOPBACK_WRITE is undefined. So, where is it defined? Or can I just get the value of it?
Thanks
I guess you found this control transfer example on the pyusb tutorial at http://pyusb.sourceforge.net/docs/1.0/tutorial.html. However, this is a rather hypothetical example, as the text explains: “In this example, it is assumed that our device implements two custom control requests that act as a loopback pipe”. So this is not a standard control request, and probably not a request supported by your PS3. In that case it would be up to the PS3 controller’s USB stack to define what the numeric value of CTRL_LOOPBACK_WRITE should be.
You can find an overview of the standard requests at http://www.beyondlogic.org/usbnutshell/usb6.shtml#StandardRequests, in addition there are class-specific standard requests.