sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
/**
  * @brief  USBD_StdItfReq
  *         Handle standard usb interface requests
  * @param  pdev: device instance
  * @param  req: usb request
  * @retval status
  */
@brief  USBD_StdItfReq
Handle standard usb interface requests
@param  pdev: device instance
@param  req: usb request
@retval status
@brief USBD_StdItfReq Handle standard usb interface requests @param pdev : device instance @param req : usb request @retval status
USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
  USBD_StatusTypeDef ret = USBD_OK;
  uint8_t idx;
  switch (req->bmRequest & USB_REQ_TYPE_MASK)
  {
    case USB_REQ_TYPE_CLASS:
    case USB_REQ_TYPE_VENDOR:
    case USB_REQ_TYPE_STANDARD:
      switch (pdev->dev_state)
      {
        case USBD_STATE_DEFAULT:
        case USBD_STATE_ADDRESSED:
        case USBD_STATE_CONFIGURED:
          if (LOBYTE(req->wIndex) <= USBD_MAX_NUM_INTERFACES)
          {
            idx = USBD_CoreFindIF(pdev, LOBYTE(req->wIndex));
            if (((uint8_t)idx != 0xFFU) && (idx < USBD_MAX_SUPPORTED_CLASS))
            {
              if (pdev->pClass[idx]->Setup != NULL)
              {
                pdev->classId = idx;
                ret = (USBD_StatusTypeDef)(pdev->pClass[idx]->Setup(pdev, req));
              }
              else
              {
                ret = USBD_FAIL;
              }
            }
            else
            {
              ret = USBD_FAIL;
            }
            if ((req->wLength == 0U) && (ret == USBD_OK))
            {
              (void)USBD_CtlSendStatus(pdev);
            }
          }
          else
          {
            USBD_CtlError(pdev, req);
          }
          break;
        default:
          USBD_CtlError(pdev, req);
          break;
      }
      break;
    default:
      USBD_CtlError(pdev, req);
      break;
  }
  return ret;
}
USBD_StatusTypeDef USBD_StdItfReq ( USBD_HandleTypeDef * pdev , USBD_SetupReqTypedef * req ) { USBD_StatusTypeDef ret = USBD_OK ; uint8_t idx ; switch ( req -> bmRequest & USB_REQ_TYPE_MASK ) { case USB_REQ_TYPE_CLASS : case USB_REQ_TYPE_VENDOR : case USB_REQ_TYPE_STANDARD : switch ( pdev -> dev_state ) { case USBD_STATE_DEFAULT : case USBD_STATE_ADDRESSED : case USBD_STATE_CONFIGURED : if ( LOBYTE ( req -> wIndex ) <= USBD_MAX_NUM_INTERFACES ) { idx = USBD_CoreFindIF ( pdev , LOBYTE ( req -> wIndex ) ) ; if ( ( ( uint8_t ) idx != 0xFFU ) && ( idx < USBD_MAX_SUPPORTED_CLASS ) ) { if ( pdev -> pClass [ idx ] -> Setup != NULL ) { pdev -> classId = idx ; ret = ( USBD_StatusTypeDef ) ( pdev -> pClass [ idx ] -> Setup ( pdev , req ) ) ; } else { ret = USBD_FAIL ; } } else { ret = USBD_FAIL ; } if ( ( req -> wLength == 0U ) && ( ret == USBD_OK ) ) { ( void ) USBD_CtlSendStatus ( pdev ) ; } } else { USBD_CtlError ( pdev , req ) ; } break ; default : USBD_CtlError ( pdev , req ) ; break ; } break ; default : USBD_CtlError ( pdev , req ) ; break ; } return ret ; }
@brief  USBD_StdItfReq
         Handle standard usb interface requests
 @param  pdev: device instance
 @param  req: usb request
 @retval status
@brief USBD_StdItfReq Handle standard usb interface requests @param pdev : device instance @param req : usb request @retval status
/* Get the class index relative to this interface */ /* Call the class data out function to manage the request */ /* should never reach this condition */ /* No relative interface found */