Skip to content

Commit 26d05d7

Browse files
committed
fix issue with ftdi host driver with status bytes
add workflow_dispatch to all ci workflow
1 parent 625c27c commit 26d05d7

File tree

11 files changed

+37
-25
lines changed

11 files changed

+37
-25
lines changed

.github/workflows/build_aarch64.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build AArch64
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_arm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build ARM
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_esp.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build ESP
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_iar.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build IAR
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_msp430.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build MSP430
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_renesas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build Renesas
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_riscv.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build RISC-V
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/build_win_mac.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build Windows/MacOS
22

33
on:
4+
workflow_dispatch:
45
push:
56
paths:
67
- 'src/**'

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: CIFuzz
22
on:
3+
workflow_dispatch:
34
pull_request:
45
branches:
56
- master

src/class/cdc/cdc_host.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -550,50 +550,48 @@ void cdch_close(uint8_t daddr)
550550
}
551551
}
552552

553-
bool cdch_xfer_cb(uint8_t daddr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
554-
{
553+
bool cdch_xfer_cb(uint8_t daddr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes) {
555554
// TODO handle stall response, retry failed transfer ...
556555
TU_ASSERT(event == XFER_RESULT_SUCCESS);
557556

558557
uint8_t const idx = get_idx_by_ep_addr(daddr, ep_addr);
559558
cdch_interface_t * p_cdc = get_itf(idx);
560559
TU_ASSERT(p_cdc);
561560

562-
if ( ep_addr == p_cdc->stream.tx.ep_addr )
563-
{
561+
if ( ep_addr == p_cdc->stream.tx.ep_addr ) {
564562
// invoke tx complete callback to possibly refill tx fifo
565563
if (tuh_cdc_tx_complete_cb) tuh_cdc_tx_complete_cb(idx);
566564

567-
if ( 0 == tu_edpt_stream_write_xfer(&p_cdc->stream.tx) )
568-
{
565+
if ( 0 == tu_edpt_stream_write_xfer(&p_cdc->stream.tx) ) {
569566
// If there is no data left, a ZLP should be sent if:
570567
// - xferred_bytes is multiple of EP Packet size and not zero
571568
tu_edpt_stream_write_zlp_if_needed(&p_cdc->stream.tx, xferred_bytes);
572569
}
573570
}
574-
else if ( ep_addr == p_cdc->stream.rx.ep_addr )
575-
{
576-
tu_edpt_stream_read_xfer_complete(&p_cdc->stream.rx, xferred_bytes);
577-
571+
else if ( ep_addr == p_cdc->stream.rx.ep_addr ) {
578572
#if CFG_TUH_CDC_FTDI
579-
// FTDI reserve 2 bytes for status
580573
if (p_cdc->serial_drid == SERIAL_DRIVER_FTDI) {
581-
uint8_t status[2];
582-
tu_edpt_stream_read(&p_cdc->stream.rx, status, 2);
583-
(void) status; // TODO handle status
584-
}
574+
// FTDI reserve 2 bytes for status
575+
// FTDI status
576+
// uint8_t status[2] = {
577+
// p_cdc->stream.rx.ep_buf[0],
578+
// p_cdc->stream.rx.ep_buf[1]
579+
// };
580+
tu_edpt_stream_read_xfer_complete_offset(&p_cdc->stream.rx, xferred_bytes, 2);
581+
}else
585582
#endif
583+
{
584+
tu_edpt_stream_read_xfer_complete(&p_cdc->stream.rx, xferred_bytes);
585+
}
586586

587587
// invoke receive callback
588588
if (tuh_cdc_rx_cb) tuh_cdc_rx_cb(idx);
589589

590590
// prepare for next transfer if needed
591591
tu_edpt_stream_read_xfer(&p_cdc->stream.rx);
592-
}else if ( ep_addr == p_cdc->ep_notif )
593-
{
592+
}else if ( ep_addr == p_cdc->ep_notif ) {
594593
// TODO handle notification endpoint
595-
}else
596-
{
594+
}else {
597595
TU_ASSERT(false);
598596
}
599597

0 commit comments

Comments
 (0)