@@ -708,8 +708,6 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
708
708
709
709
// Vendor request
710
710
if ( p_request -> bmRequestType_bit .type == TUSB_REQ_TYPE_VENDOR ) {
711
- TU_VERIFY (tud_vendor_control_xfer_cb );
712
-
713
711
usbd_control_set_complete_callback (tud_vendor_control_xfer_cb );
714
712
return tud_vendor_control_xfer_cb (rhport , CONTROL_STAGE_SETUP , p_request );
715
713
}
@@ -1060,25 +1058,23 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
1060
1058
1061
1059
switch (desc_type )
1062
1060
{
1063
- case TUSB_DESC_DEVICE :
1064
- {
1061
+ case TUSB_DESC_DEVICE : {
1065
1062
TU_LOG_USBD (" Device\r\n" );
1066
1063
1067
1064
void * desc_device = (void * ) (uintptr_t ) tud_descriptor_device_cb ();
1065
+ TU_ASSERT (desc_device );
1068
1066
1069
1067
// Only response with exactly 1 Packet if: not addressed and host requested more data than device descriptor has.
1070
1068
// This only happens with the very first get device descriptor and EP0 size = 8 or 16.
1071
1069
if ((CFG_TUD_ENDPOINT0_SIZE < sizeof (tusb_desc_device_t )) && !_usbd_dev .addressed &&
1072
- ((tusb_control_request_t const * ) p_request )-> wLength > sizeof (tusb_desc_device_t ))
1073
- {
1070
+ ((tusb_control_request_t const * ) p_request )-> wLength > sizeof (tusb_desc_device_t )) {
1074
1071
// Hack here: we modify the request length to prevent usbd_control response with zlp
1075
1072
// since we are responding with 1 packet & less data than wLength.
1076
1073
tusb_control_request_t mod_request = * p_request ;
1077
1074
mod_request .wLength = CFG_TUD_ENDPOINT0_SIZE ;
1078
1075
1079
1076
return tud_control_xfer (rhport , & mod_request , desc_device , CFG_TUD_ENDPOINT0_SIZE );
1080
- }else
1081
- {
1077
+ }else {
1082
1078
return tud_control_xfer (rhport , p_request , desc_device , sizeof (tusb_desc_device_t ));
1083
1079
}
1084
1080
}
0 commit comments