USB glue: check mode before read (#44)

This commit is contained in:
Sergey Gavrilov 2023-07-21 22:19:20 +03:00 committed by GitHub
parent 09111b4241
commit a398f19353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -418,7 +418,11 @@ void usb_glue_cdc_send(const uint8_t* buf, size_t len, bool flush) {
}
size_t usb_glue_cdc_receive(uint8_t* buf, size_t len) {
return tud_cdc_n_read(BlackmagicCDCTypeUART, buf, len);
if(usb_device_type == USBDeviceTypeDualCDC) {
return tud_cdc_n_read(BlackmagicCDCTypeUART, buf, len);
} else {
return tud_cdc_n_read(DapCDCTypeUART, buf, len);
}
}
void usb_glue_gdb_send(const uint8_t* buf, size_t len, bool flush) {