From 8cd85472c51d51b9f7097f1ba75d51ca93fa2412 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 21 Nov 2024 19:14:16 +0100 Subject: [PATCH] usbus/cdc_ecm: port to netdev_new_api --- sys/usb/usbus/Makefile.dep | 1 + sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/usb/usbus/Makefile.dep b/sys/usb/usbus/Makefile.dep index a88de4efcb..9eda84cdaa 100644 --- a/sys/usb/usbus/Makefile.dep +++ b/sys/usb/usbus/Makefile.dep @@ -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 diff --git a/sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c b/sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c index 070352d017..aa1bb23c1a 100644 --- a/sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c +++ b/sys/usb/usbus/cdc/ecm/cdc_ecm_netdev.c @@ -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, };