On Fri, Jun 08, 2001 at 03:34:39PM +0100, Jerram, Simon wrote:
> Is there a decent specification available for this?  If not...
> 
> The Documentation for the URB API referrs to usb_control_msg
> as being a converter for the old API, and that it is a good 
> exapmle on how to use the URB one.  To an extent it is, 
> but simply looking at it without any documentation on how
> you're supposed to use it doesn't help.  The USB Programming
> guide is no help: it merely points to the routine with no
> indication of how it works, neither are any of the
> drivers I've looked at which are sparse on the code level
> documentaion and comments.

AFAIK there was no written documentation for the synchronous wrappers...
 
> OK.  
> 
> Now I want to send a control msg to which i expect a response.
> 
> I use usb_control_msg which completes OK.  But I can't tell where
> the response goes.  Isn't usb_control_msg supposed to be synchronous?

int usb_control_msg(struct usb_device *dev, unsigned int pipe, 
__u8 request,
__u8 requesttype,
__u16 value, 
__u16 index, 
void *data,      <----- this is the data after the setup stage, either
                        written or read (depends on the requesttype)
__u16 size,      <----- number of bytes you want to write/read after setup
int timeout)
 
Usually, you have only a setup stage, thus size and data can be 0, the setup
data is explicitely given with request*/value/index/size. When the
control_msg-call for a read completes successfully, you can expect your data
to be in data... 

You should use only kmalloc-ed memory for that, stack space/heap/etc is
unreliable and may fail in future kernels.

> Do I need to use usb_control_msg again with an appropriate buffer to 
> recieve the response?  Or does it get placed in a structure that 
> I should declared when I sent the control message?   Tracing this through
> puts me at a dead end: the wake_up point simply seems to return the funtion.

I hope that helps a bit....
-- 
         Georg Acher, [EMAIL PROTECTED]         
         http://www.in.tum.de/~acher/
          "Oh no, not again !" The bowl of petunias          

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to