Changeset 820d9bc in mainline for uspace/lib/usb/src/usb.c


Ignore:
Timestamp:
2017-11-22T13:54:05Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d42ba37
Parents:
64fea02
Message:

usb: move toggle resetting to libusbhost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/usb.c

    r64fea02 r820d9bc  
    119119}
    120120
    121 /** Check setup packet data for signs of toggle reset.
    122  *
    123  * @param[in] requst Setup requst data.
    124  *
    125  * @retval -1 No endpoints need reset.
    126  * @retval 0 All endpoints need reset.
    127  * @retval >0 Specified endpoint needs reset.
    128  *
    129  */
    130 toggle_reset_mode_t usb_request_get_toggle_reset_mode(
    131     const usb_device_request_setup_packet_t *request)
    132 {
    133         assert(request);
    134         switch (request->request)
    135         {
    136         /* Clear Feature ENPOINT_STALL */
    137         case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */
    138                 /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */
    139                 if ((request->request_type == 0x2) &&
    140                     (request->value == USB_FEATURE_ENDPOINT_HALT))
    141                         return RESET_EP;
    142                 break;
    143         case USB_DEVREQ_SET_CONFIGURATION:
    144         case USB_DEVREQ_SET_INTERFACE:
    145                 /* Recipient must be device, this resets all endpoints,
    146                  * In fact there should be no endpoints but EP 0 registered
    147                  * as different interfaces use different endpoints,
    148                  * unless you're changing configuration or alternative
    149                  * interface of an already setup device. */
    150                 if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST))
    151                         return RESET_ALL;
    152                 break;
    153         default:
    154                 break;
    155         }
    156 
    157         return RESET_NONE;
    158 }
    159 
    160121/**
    161122 * @}
Note: See TracChangeset for help on using the changeset viewer.