|USB_PIPE_RESET(9F)||Kernel Functions for Drivers||USB_PIPE_RESET(9F)|
#include <sys/usb/usba.h> void usb_pipe_reset(dev_info_t *dip, usb_pipe_handle_t pipe_handle, usb_flags_t usb_flags, void (*callback)(usb_pipe_handle_t cb_pipe_handle, usb_opaque_t arg, int rval, usb_cb_flags_t flags), usb_opaque_t callback_arg);
A pipe can be reset automatically when requests sent to the pipe have the USB_ATTRS_AUTOCLEARING attribute specified. Client drivers see an exception callback with the USB_CB_STALL_CLEARED callback flag set in such cases.
Stalls on pipes executing requests without the USB_ATTRS_AUTOCLEARING attribute set must be cleared by the client driver. The client driver is notified of the stall via an exception callback. The client driver must then call usb_pipe_reset() to clear the stall.
The usb_pipe_reset() function resets a pipe as follows:
1. Any polling activity is stopped if the pipe being reset is an interrupt or isochronous pipe.
2. All pending requests are removed from the pipe. An exception callback, if specified beforehand, is executed for each aborted request.
3. The pipe is reset to the idle state.
Requests to reset the default control pipe are not allowed. No action is taken on a pipe which is closing.
If USB_FLAGS_SLEEP is specified in flags, this function waits for the action to complete before calling the callback handler and returning. If not specified, this function queues the request and returns immediately, and the specified callback is called upon completion.
callback is the callback handler. It takes the following arguments:
USB_CB_NO_INFO — Callback was uneventful.
USB_CB_ASYNC_REQ_FAILED — Error starting asynchronous request.
Exception callback handlers of interrupt-IN and isochronous-IN requests which are terminated by these commands are called with a completion reason of USB_CR_STOPPED_POLLING.
Exception handlers of incomplete bulk requests are called with a completion reason of USB_CR_FLUSHED.
Exception handlers of unstarted requests are called with USB_CR_PIPE_RESET.
Note that messages mirroring the above errors are logged to the console logfile on error. This provides status for calls which could not otherwise provide status.
If the USB_CB_ASYNC_REQ_FAILED bit is clear in usb_cb_flags_t, the callback, if supplied, can block because it is executing in kernel context. Otherwise the callback cannot block. Please see usb_callback_flags(9S) for more information on callbacks.
void post_reset_handler( usb_pipe_handle_t, usb_opaque_t, int, usb_cb_flags_t); /* * Do an asynchronous reset on bulk_pipe. * Execute post_reset_handler when done. */ usb_pipe_reset(dip, bulk_pipe, 0, post_reset_handler, arg); /* Do a synchronous reset on bulk_pipe. */ usb_pipe_reset(dip, bulk_pipe, USB_FLAGS_SLEEP, NULL, NULL);
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|
|December 28, 2020||OmniOS|