Fixing wrong callback placement

This commit is contained in:
Rocky04 2023-08-07 21:16:41 +02:00 committed by GitHub
parent 12ed867b5e
commit c959e65edd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -711,7 +711,16 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
}
// switch to new configuration if not zero
if ( cfg_num ) TU_ASSERT( process_set_config(rhport, cfg_num) );
if ( cfg_num )
{
TU_ASSERT( process_set_config(rhport, cfg_num) );
if ( tud_mount_cb ) tud_mount_cb();
}
else
{
if ( tud_umount_cb ) tud_umount_cb();
}
}
_usbd_dev.cfg_num = cfg_num;
@ -964,16 +973,6 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
TU_ASSERT(drv_id < TOTAL_DRIVER_COUNT);
}
// invoke callback
if (cfg_num)
{
if (tud_mount_cb) tud_mount_cb();
}
else
{
if (tud_umount_cb) tud_umount_cb();
}
return true;
}