cdcecm: early exit on inactive usb interface
This adds an early exit when the usb interface with the data endpoints is not activated. This prevents the cdc_ecm_netdev code from attempting to send the PDU when the USB device is not yet initialized or activated by a host.
This commit is contained in:
parent
d49c48368a
commit
45745579bc
@ -59,6 +59,11 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
|
||||
uint8_t *buf = cdcecm->ep_in->ep->buf;
|
||||
const iolist_t *iolist_start = 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);
|
||||
/* load packet data into FIFO */
|
||||
size_t iol_offset = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user