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

Merge pull request #21028 from benpicco/usbus_cdc_ecm-netdev_new

usbus/cdc_ecm: port to netdev_new_api
This commit is contained in:
Marian Buschsieweke 2024-11-21 22:15:12 +00:00 committed by GitHub
commit 0054f6c478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -16,6 +16,7 @@ ifneq (,$(filter usbus_cdc_ecm,$(USEMODULE)))
USEMODULE += iolist
USEMODULE += fmt
USEMODULE += usbus_urb
USEMODULE += netdev_new_api
USEMODULE += netdev_eth
USEMODULE += luid
endif

View File

@ -62,6 +62,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
uint8_t *buf = cdcecm->data_in;
const iolist_t *iolist_start = iolist;
size_t len = iolist_size(iolist);
size_t res = len;
/* 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) {
@ -124,7 +125,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
cdcecm->tx_len = 0;
_signal_tx_xmit(cdcecm);
}
return len;
return res;
}
static int _recv(netdev_t *netdev, void *buf, size_t max_len, void *info)
@ -204,6 +205,14 @@ static void _isr(netdev_t *dev)
}
}
static int _confirm_send(netdev_t *netdev, void *info)
{
(void)netdev;
(void)info;
return -EOPNOTSUPP;
}
static const netdev_driver_t netdev_driver_cdcecm = {
.send = _send,
.recv = _recv,
@ -211,4 +220,5 @@ static const netdev_driver_t netdev_driver_cdcecm = {
.isr = _isr,
.get = _get,
.set = _set,
.confirm_send = _confirm_send,
};