Skip to content

Commit

Permalink
cdc_ecm: Update max supported transfer size after reset
Browse files Browse the repository at this point in the history
  • Loading branch information
bergzand committed Mar 31, 2023
1 parent a98f6fa commit 58e2624
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions sys/usb/usbus/cdc/ecm/cdc_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 58e2624

Please sign in to comment.