tinyusb/src/class/msc/msc_device.c
bool mscd_control_request(uint8_t rhport, tusb_control_request_t const * p_request)
{
  TU_ASSERT(p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS);

  switch ( p_request->bRequest )
  {
    case MSC_REQ_RESET:
      // TODO: Actually reset interface.
      usbd_control_status(rhport, p_request);
    break;

    case MSC_REQ_GET_MAX_LUN:
    {
      // returned MAX LUN is minus 1 by specs
      uint8_t maxlun = CFG_TUD_MSC_MAXLUN-1;
      usbd_control_xfer(rhport, p_request, &maxlun, 1);
    }
    break;

    default: return false; // stall unsupported request
  }

  return true;
}
// Handle class control request
// return false to stall control endpoint (e.g unsupported request)

Handle class control request
return false to stall control endpoint
Handle class control request return false to stall control endpoint
bool mscd_control_request(uint8_t rhport, tusb_control_request_t const * p_request)
{
  TU_ASSERT(p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS);
  switch ( p_request->bRequest )
  {
    case MSC_REQ_RESET:
      usbd_control_status(rhport, p_request);
    break;
    case MSC_REQ_GET_MAX_LUN:
    {
      uint8_t maxlun = CFG_TUD_MSC_MAXLUN-1;
      usbd_control_xfer(rhport, p_request, &maxlun, 1);
    }
    break;
    default: return false; 
  }
  return true;
}
bool mscd_control_request ( uint8_t rhport , tusb_control_request_t const * p_request ) { TU_ASSERT ( p_request -> bmRequestType_bit . type == TUSB_REQ_TYPE_CLASS ) ; switch ( p_request -> bRequest ) { case MSC_REQ_RESET : usbd_control_status ( rhport , p_request ) ; break ; case MSC_REQ_GET_MAX_LUN : { uint8_t maxlun = CFG_TUD_MSC_MAXLUN - 1 ; usbd_control_xfer ( rhport , p_request , & maxlun , 1 ) ; } break ; default : return false ; } return true ; }
Handle class control request
return false to stall control endpoint (e.g unsupported request)
Handle class control request return false to stall control endpoint ( e . g unsupported request )
// TODO: Actually reset interface.
 // returned MAX LUN is minus 1 by specs
 // stall unsupported request
