Merge pull request #12534 from bergzand/pr/usbus/cdcecm_early_exit_on_inactive

cdcecm: early exit on inactive usb interface
This commit is contained in:
Dylan Laduranty 2019-10-23 10:09:11 +02:00 committed by GitHub
commit 0bbb114ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,11 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
uint8_t *buf = cdcecm->ep_in->ep->buf; uint8_t *buf = cdcecm->ep_in->ep->buf;
const iolist_t *iolist_start = iolist; const iolist_t *iolist_start = iolist;
size_t len = iolist_size(iolist); size_t len = iolist_size(iolist);
/* interface with alternative function ID 1 is the interface containing the
* data endpoints, no sense trying to transmit data if it is not active */
if (cdcecm->active_iface != 1) {
return -ENOTCONN;
}
DEBUG("CDC_ECM_netdev: sending %u bytes\n", len); DEBUG("CDC_ECM_netdev: sending %u bytes\n", len);
/* load packet data into FIFO */ /* load packet data into FIFO */
size_t iol_offset = 0; size_t iol_offset = 0;