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

USBUS/cdc_ecm: register with netdev

This commit is contained in:
Benjamin Valentin 2022-09-16 13:22:42 +02:00
parent d8615675ec
commit aef967fdef
2 changed files with 5 additions and 3 deletions

View File

@ -331,6 +331,7 @@ typedef enum {
NETDEV_KW2XRF,
NETDEV_ESP_ETH,
NETDEV_ESP_WIFI,
NETDEV_CDC_ECM,
/* add more if needed */
} netdev_type_t;
/** @} */

View File

@ -22,10 +22,9 @@
#include "kernel_defines.h"
#include "iolist.h"
#include "luid.h"
#include "mutex.h"
#include "net/ethernet.h"
#include "net/eui48.h"
#include "net/eui_provider.h"
#include "net/netdev.h"
#include "net/netdev/eth.h"
#include "usb/usbus/cdc/ecm.h"
@ -53,6 +52,7 @@ static usbus_cdcecm_device_t *_netdev_to_cdcecm(netdev_t *netdev)
void cdcecm_netdev_setup(usbus_cdcecm_device_t *cdcecm)
{
cdcecm->netdev.driver = &netdev_driver_cdcecm;
netdev_register(&cdcecm->netdev, NETDEV_CDC_ECM, 0);
}
static int _send(netdev_t *netdev, const iolist_t *iolist)
@ -153,7 +153,8 @@ static int _init(netdev_t *netdev)
{
usbus_cdcecm_device_t *cdcecm = _netdev_to_cdcecm(netdev);
luid_get_eui48((eui48_t*)cdcecm->mac_netdev);
netdev_eui48_get(netdev, (eui48_t*)&cdcecm->mac_netdev);
return 0;
}