• R
    usb: gadget: composite: Allow function drivers to pause control transfers · 1b9ba000
    Roger Quadros 提交于
    Some USB function drivers (e.g. f_mass_storage.c) need to delay or defer the
    data/status stages of standard control requests like SET_CONFIGURATION or
    SET_INTERFACE till they are done with their bookkeeping and are actually ready
    for accepting new commands to their interface.
    
    They can now achieve this functionality by returning USB_GADGET_DELAYED_STATUS
    in their setup handlers (e.g. set_alt()). The composite framework will then
    defer completion of the control transfer by not completing the data/status stages.
    
    This ensures that the host does not send new packets to the interface till the
    function driver is ready to take them.
    
    When the function driver that requested for USB_GADGET_DELAYED_STATUS is done
    with its bookkeeping, it should signal the composite framework to continue with
    the data/status stages of the control transfer. It can do so by invoking
    the new API usb_composite_setup_continue(). This is where the control transfer's
    data/status stages are completed and host can initiate new transfers.
    
    The DELAYED_STATUS mechanism is currently only supported if the expected data phase
    is 0 bytes (i.e. w_length == 0). Since SET_CONFIGURATION and SET_INTERFACE are the
    only cases that will use this mechanism, this is not a limitation.
    Signed-off-by: NRoger Quadros <roger.quadros@nokia.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
    1b9ba000
composite.h 15.6 KB