summaryrefslogtreecommitdiff
path: root/src/device/usbd.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-07-19 18:08:04 +0700
committerhathach <[email protected]>2024-07-19 18:08:04 +0700
commit6fb6602a097b2d2e026f150d6fde387803606f88 (patch)
treeac566bc7aeaa907fe50d43fc234e64631a0144fb /src/device/usbd.c
parentbe18af823591389a12e246f65784646f93443882 (diff)
- add tud_cdc_n_ready() though not used
- usbd now change _usbd_dev.cfg_num before calling driver's open()
Diffstat (limited to 'src/device/usbd.c')
-rw-r--r--src/device/usbd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 4105a71a4..4e723c8b9 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -747,17 +747,23 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
_usbd_dev.speed = speed; // restore speed
}
+ _usbd_dev.cfg_num = cfg_num;
+
// Handle the new configuration and execute the corresponding callback
if ( cfg_num ) {
// switch to new configuration if not zero
- TU_ASSERT( process_set_config(rhport, cfg_num) );
+ if (!process_set_config(rhport, cfg_num)) {
+ TU_MESS_FAILED();
+ TU_BREAKPOINT();
+ _usbd_dev.cfg_num = 0;
+ return false;
+ }
if ( tud_mount_cb ) tud_mount_cb();
} else {
if ( tud_umount_cb ) tud_umount_cb();
}
}
- _usbd_dev.cfg_num = cfg_num;
tud_control_status(rhport, p_request);
}
break;