Skip to content

Commit

Permalink
usb: device_next: limit CDC ACM OUT transfer size to the current MPS
Browse files Browse the repository at this point in the history
When the controller is connected to a full speed bus, regardless of
whether the controller supports high speed or not, the transfer size for
the bulk OUT endpoint should be equal to the MPS in the current
configuration.

Signed-off-by: Johann Fischer <[email protected]>
  • Loading branch information
jfischer-no committed Oct 2, 2024
1 parent 98ba81c commit 3304357
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions subsys/usb/device_next/class/usbd_cdc_acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ static void cdc_acm_rx_fifo_handler(struct k_work *work)
return;
}

/* Shrink the buffer size if operating on a full speed bus */
buf->size = MIN(cdc_acm_get_bulk_mps(c_data), buf->size);

ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
Expand Down

0 comments on commit 3304357

Please sign in to comment.