Re[2]: How to handle USB_ENDPOINT_XFER_BULK in gadget API?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanx,

for writing to device got it, in gmidi_complete function i successfully 
received the input 16-byte buffer . 
this buffer enter device via endpoint 01 OUT. 
now i have to read from device via endpoint 81. 
so sequence is:
BULK_WRITE to endpoint 01 with buffer 16 bytes 
BULK_READ  to endpoint 81 with buffer 16 bytes - getting back device answer.

in "complete" function i see only req->ep01_out call,
for 01 call i just setting req->status=OK and issuing the usb_ep_queue() again 
to indicate status of wrting ok

bute where to catch catch req->ep81_in ? i dont see call of "complete" function 
when hcd sends this request to device.


>Michal Nazarewicz <mina86@...> writes:
> 
> On Wed, 27 Apr 2011 22:04:24 +0200, baseplast <baseplast@...> wrote:
> > i looked inside gadget.h and found declaration usb_ep_queue
> > ---
> > usb_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_tgfp_flags)
> > ---
> > but i dint find any call for it in zero.c
> > however, i found it called inside gmidi.c that is close to my project.
> > as i realized, each time HCD sends request to my device, gmidi_setup
> > routine is called. But this routine related only to ep0 control
> > requests.
> 
> Yes, the setup callback is called for control requests only (my
> terminology may be wrong here).
> 
> > After creation of device, i made myendpoints enabled with
> >         err = usb_ep_enable(dev->in_ep, &bulk_in_desc);
> >         err = usb_ep_enable(dev->out_ep, &bulk_out_desc);
> >
> >         ep = dev->out_ep;
> >         req = alloc_ep_req(ep, buflen);
> >
> >         then i calling the
> >         err = usb_ep_queue(ep, req, GFP_ATOMIC);
> >
> > am i right ?
> >
> > in what handler do i need to call from in/out endpoints to
> > receive/send BULK data?
> 
> struct usb_request has a complete callback which you need to
> set which is called when the request is finished (for OUT
> endpoints that means data is available, for IN endpoints
> data has been sent to host), cancelled or failed.
> 
> Also, if you want to send data you must fill the buffer before
> calling usb_ep_queue().
> 




--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux