Skip to content

Commit 2db0de2

Browse files
committed
update tinyusb core to 1763eede4839d0131cda077e2dd9631f315ce115
1 parent f06eb74 commit 2db0de2

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/class/cdc/cdc_host.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -443,19 +443,18 @@ bool tuh_cdc_set_control_line_state(uint8_t idx, uint16_t line_state, tuh_xfer_c
443443
return driver->set_control_line_state(p_cdc, line_state, complete_cb, user_data);
444444
}else {
445445
// blocking
446-
xfer_result_t result;
446+
xfer_result_t result = XFER_RESULT_INVALID;
447447
bool ret = driver->set_control_line_state(p_cdc, line_state, complete_cb, (uintptr_t) &result);
448448

449449
if (user_data) {
450450
// user_data is not NULL, return result via user_data
451451
*((xfer_result_t*) user_data) = result;
452452
}
453453

454-
if (result == XFER_RESULT_SUCCESS) {
455-
p_cdc->line_state = (uint8_t) line_state;
456-
}
454+
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
457455

458-
return ret;
456+
p_cdc->line_state = (uint8_t) line_state;
457+
return true;
459458
}
460459
}
461460

@@ -468,19 +467,18 @@ bool tuh_cdc_set_baudrate(uint8_t idx, uint32_t baudrate, tuh_xfer_cb_t complete
468467
return driver->set_baudrate(p_cdc, baudrate, complete_cb, user_data);
469468
}else {
470469
// blocking
471-
xfer_result_t result;
470+
xfer_result_t result = XFER_RESULT_INVALID;
472471
bool ret = driver->set_baudrate(p_cdc, baudrate, complete_cb, (uintptr_t) &result);
473472

474473
if (user_data) {
475474
// user_data is not NULL, return result via user_data
476475
*((xfer_result_t*) user_data) = result;
477476
}
478477

479-
if (result == XFER_RESULT_SUCCESS) {
480-
p_cdc->line_coding.bit_rate = baudrate;
481-
}
478+
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
482479

483-
return ret;
480+
p_cdc->line_coding.bit_rate = baudrate;
481+
return true;
484482
}
485483
}
486484

@@ -495,19 +493,18 @@ bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding,
495493
return acm_set_line_coding(p_cdc, line_coding, complete_cb, user_data);
496494
}else {
497495
// blocking
498-
xfer_result_t result;
496+
xfer_result_t result = XFER_RESULT_INVALID;
499497
bool ret = acm_set_line_coding(p_cdc, line_coding, complete_cb, (uintptr_t) &result);
500498

501499
if (user_data) {
502500
// user_data is not NULL, return result via user_data
503501
*((xfer_result_t*) user_data) = result;
504502
}
505503

506-
if (result == XFER_RESULT_SUCCESS) {
507-
p_cdc->line_coding = *line_coding;
508-
}
504+
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
509505

510-
return ret;
506+
p_cdc->line_coding = *line_coding;
507+
return true;
511508
}
512509
}
513510

src/class/cdc/cdc_host.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ bool tuh_cdc_read_clear (uint8_t idx);
138138
// - If complete_cb is provided, the function will return immediately and invoke
139139
// the callback when request is complete.
140140
// - If complete_cb is NULL, the function will block until request is complete.
141-
// In this case, user_data should be pointed to xfer_result_t to hold the transfer result.
141+
// - In this case, user_data should be pointed to xfer_result_t to hold the transfer result.
142+
// - The function will return true if transfer is successful, false otherwise.
142143
//--------------------------------------------------------------------+
143144

144145
// Request to Set Control Line State: DTR (bit 0), RTS (bit 1)

0 commit comments

Comments
 (0)