sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c
/**
  * @brief  SCSI_Inquiry
  *         Process Inquiry command
  * @param  lun: Logical unit number
  * @param  params: Command parameters
  * @retval status
  */
@brief  SCSI_Inquiry
Process Inquiry command
@param  lun: Logical unit number
@param  params: Command parameters
@retval status
@brief SCSI_Inquiry Process Inquiry command @param lun : Logical unit number @param params : Command parameters @retval status
static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
  uint8_t *pPage;
  uint16_t len;
  USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  if (hmsc == NULL)
  {
    return -1;
  }
  if (hmsc->cbw.dDataLength == 0U)
  {
    SCSI_SenseCode(pdev, hmsc->cbw.bLUN, ILLEGAL_REQUEST, INVALID_CDB);
    return -1;
  }
  if ((params[1] & 0x01U) != 0U) 
  {
    if (params[2] == 0U) 
    {
      (void)SCSI_UpdateBotData(hmsc, MSC_Page00_Inquiry_Data, LENGTH_INQUIRY_PAGE00);
    }
    else if (params[2] == 0x80U) 
    {
      (void)SCSI_UpdateBotData(hmsc, MSC_Page80_Inquiry_Data, LENGTH_INQUIRY_PAGE80);
    }
    else 
    {
      SCSI_SenseCode(pdev, hmsc->cbw.bLUN, ILLEGAL_REQUEST,
                     INVALID_FIELED_IN_COMMAND);
      return -1;
    }
  }
  else
  {
    pPage = (uint8_t *) & ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN];
    len = (uint16_t)pPage[4] + 5U;
    if (params[4] <= len)
    {
      len = params[4];
    }
    (void)SCSI_UpdateBotData(hmsc, pPage, len);
  }
  return 0;
}
static int8_t SCSI_Inquiry ( USBD_HandleTypeDef * pdev , uint8_t lun , uint8_t * params ) { uint8_t * pPage ; uint16_t len ; USBD_MSC_BOT_HandleTypeDef * hmsc = ( USBD_MSC_BOT_HandleTypeDef * ) pdev -> pClassDataCmsit [ pdev -> classId ] ; if ( hmsc == NULL ) { return -1 ; } if ( hmsc -> cbw . dDataLength == 0U ) { SCSI_SenseCode ( pdev , hmsc -> cbw . bLUN , ILLEGAL_REQUEST , INVALID_CDB ) ; return -1 ; } if ( ( params [ 1 ] & 0x01U ) != 0U ) { if ( params [ 2 ] == 0U ) { ( void ) SCSI_UpdateBotData ( hmsc , MSC_Page00_Inquiry_Data , LENGTH_INQUIRY_PAGE00 ) ; } else if ( params [ 2 ] == 0x80U ) { ( void ) SCSI_UpdateBotData ( hmsc , MSC_Page80_Inquiry_Data , LENGTH_INQUIRY_PAGE80 ) ; } else { SCSI_SenseCode ( pdev , hmsc -> cbw . bLUN , ILLEGAL_REQUEST , INVALID_FIELED_IN_COMMAND ) ; return -1 ; } } else { pPage = ( uint8_t * ) & ( ( USBD_StorageTypeDef * ) pdev -> pUserData [ pdev -> classId ] ) -> pInquiry [ lun * STANDARD_INQUIRY_DATA_LEN ] ; len = ( uint16_t ) pPage [ 4 ] + 5U ; if ( params [ 4 ] <= len ) { len = params [ 4 ] ; } ( void ) SCSI_UpdateBotData ( hmsc , pPage , len ) ; } return 0 ; }
@brief  SCSI_Inquiry
         Process Inquiry command
 @param  lun: Logical unit number
 @param  params: Command parameters
 @retval status
@brief SCSI_Inquiry Process Inquiry command @param lun : Logical unit number @param params : Command parameters @retval status
/* Evpd is set */ /* Request for Supported Vital Product Data Pages*/ /* Request for VPD page 0x80 Unit Serial Number */ /* Request Not supported */