Project

General

Profile

Actions

Feature #7913

open

Urb completion callbacks specification required

Added by Alexey Khoroshilov almost 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
01/25/2017
Due date:
% Done:

0%

Estimated time:
Published in build:

Description

Brief description with some details missed.

  @complete: Completion handler. This URB is passed as the parameter to the
  completion function.  The completion function may then do what
  it likes with the URB, including resubmitting or freeing it.

  Completion Callbacks:

    The completion callback is made in_interrupt(), and one of the first
    things that a completion handler should do is check the status field.
    The status field is provided for all URBs.  It is used to report
    unlinked URBs, and status for all non-ISO transfers.  It should not
    be examined before the URB is returned to the completion handler.

    The context field is normally used to link URBs back to the relevant
    driver or request state.

    When the completion callback is invoked for non-isochronous URBs, the
    actual_length field tells how many bytes were transferred.  This field
    is updated even when the URB terminated with an error or was unlinked.

void usb_fill_control_urb() and Company {
urb->complete = complete_fn;
}
---------------------------------------------> Register URB completion process (urb, complete_fn)

int usb_submit_urb(struct urb *urb, gfp_t mem_flags)

  If the submission is successful, the complete() callback from the URB
  will be called exactly once, when the USB core and Host Controller Driver 
  (HCD) are finished with the URB.  When the completion function is called, 
  control of the URB is returned to the device driver which issued the
  request.  The completion handler may then immediately free or reuse that URB.

usb_submit_urb()
---------------------------------------------> Activate URB completion process(urb)

after that URB completion process can call completion callback (in_interrupt) once and deactivates itself
if completion callback did not call usb_submit_urb() to reactivate itself.

There can be several URB completion processes identified by 'urb*'.

Actions

Also available in: Atom PDF