diff options
| author | hathach <[email protected]> | 2025-11-27 18:41:57 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-11-27 18:41:57 +0700 |
| commit | 9a9bf0fd7b5a005fd4701ab6cb5b1728ecc0baa2 (patch) | |
| tree | 4c67b1edfec639aac4f36b398da38ad267bd0dd7 /examples/device | |
| parent | f3dc2186aea9a472fe13ecab06464fbead50f0dd (diff) | |
change tud_vendor_rx_cb() behavior, buffer and bufsize only available when CFG_TUD_VENDOR_RX_BUFSIZE = 0
update vendor device to omit ep buf when dedicated hwfifo is supported
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/webusb_serial/src/main.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index 4fcddd724..50794bdba 100644 --- a/examples/device/webusb_serial/src/main.c +++ b/examples/device/webusb_serial/src/main.c @@ -211,15 +211,16 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ return false; } -void tud_vendor_rx_cb(uint8_t idx, const uint8_t *buffer, uint16_t bufsize) { +void tud_vendor_rx_cb(uint8_t idx, const uint8_t *buffer, uint32_t bufsize) { (void)idx; + (void)buffer; + (void)bufsize; -// since we used data without pulling it from RX FIFO, we need to discard number of items used -#if CFG_TUD_VENDOR_RX_BUFSIZE > 0 - tud_vendor_read_discard(bufsize); -#endif - - echo_all(buffer, bufsize); + while (tud_vendor_available()) { + uint8_t buf[64]; + const uint32_t count = tud_vendor_read(buf, sizeof(buf)); + echo_all(buf, count); + } } //--------------------------------------------------------------------+ |
