1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cdc_ecm: Update max supported transfer size after reset

This commit is contained in:
Koen Zandberg 2023-03-31 14:28:39 +02:00
parent 8b41443913
commit 8044e578b5
No known key found for this signature in database
GPG Key ID: BA1718B37D79F51C
2 changed files with 7 additions and 1 deletions

View File

@ -336,6 +336,12 @@ static void _handle_reset(usbus_t *usbus, usbus_handler_t *handler)
{
usbus_cdcecm_device_t *cdcecm = (usbus_cdcecm_device_t *)handler;
/* Set the max packet size advertised to the host to something compatible with the enumerated
* size */
size_t maxpacketsize = usbus_max_bulk_endpoint_size(usbus);
cdcecm->ep_in->maxpacketsize = maxpacketsize;
cdcecm->ep_out->maxpacketsize = maxpacketsize;
DEBUG("CDC ECM: Reset\n");
_handle_in_complete(usbus, handler);
cdcecm->notif = USBUS_CDCECM_NOTIF_NONE;

View File

@ -71,7 +71,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
/* load packet data into FIFO */
size_t iol_offset = 0;
size_t usb_offset = 0;
size_t usb_remain = cdcecm->ep_in->ep->len;
size_t usb_remain = cdcecm->ep_in->maxpacketsize;
DEBUG("CDC_ECM_netdev: cur iol: %d\n", iolist->iol_len);
while (len) {
mutex_lock(&cdcecm->out_lock);