mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
0fb6a09598
18903: pkg/tinyusb: add tinyUSB netdev driver r=dylad a=gschorcht ### Contribution description This PR adds the tinyUSB netdev driver. The tinyUSB netdev driver is part of the tinyUSB package and is enabled by module `tinyusb_netdev`. It is available for boards that provide the `tinyusb_device` feature. **Please note** Since the tinyUSB package is distinct from (and incompatible with) the USB stack provided around USBUS in RIOT (see USB), the tinyUSB netdev driver cannot be used together with with any USBUS device class. The tinyUSB netdev driver uses Ethernet over USB and supports the following protocols: - CDC ECM (Ethernet Control Model) - CDC NCM (Network Control Model) - RNDIS (Microsoft Remote NDIS) While Linux and macOS support all these protocols, Microsoft Windows only supports the RNDIS protocol and since Windows version 11 also the CDC NCM protocol. macOS supports the RNDIS protocol since version 10.15 (Catalina). Which protocol is used is selected by the corresponding pseudomodules `tinyusb_class_net_cdc_ecm`, `tinyusb_class_net_cdc_ncm` and `tinyusb_class_net_rndis`. The CDC ECM protocol (`tinyusb_class_net_cdc_ecm`) and the RNDIS protocol (`tinyusb_class_net_rndis`) can be used simultaneously to support all operating systems, for example : ``` USEMODULE='tinyusb_netdev tinyusb_class_net_rndis tinyusb_class_net_cdc_ecm' \ BOARD=... make -C ... flash ``` In this case, the CDC ECM protocol is the default protocol and the RNDIS protocol the alternative protocol defined as second device configuration. The CDC NCM protocol cannot be used together with the CDC ECM or the RNDIS protocol. This PR includes PR #18983 for now to be compilable. Comparison with USBUS CDC ECM (`nucleo-f767zi` board): ``` text data bss dec hex filename 65916 596 18728 85240 14cf8 tests_pkg_tinyusb_netdev.elf ``` ``` text data bss dec hex filename 63120 544 15444 79108 13504 tests_usbus_cdc_ecm.elf ``` ### Testing procedure Use a board that is supported by tinyUSB. Compile and flash the test application for each protocol: 1. RNDIS ``` BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash ``` 2. CDC ECM ``` CLASS=tinyusb_class_net_cdc_ecm BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash ``` 3. CDC NCM ``` CLASS=tinyusb_class_net_cdc_ncm BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash ``` For each test, a network interface should be added on the host. Use command `ifconfig` on USB device and on the host and check that both have a link local address. In syslog there should be an output like the following: <details> ``` Nov 13 18:14:46 gunny8 kernel: [4611465.480025] usb 1-2.2: new full-speed USB device number 28 using xhci_hcd Nov 13 18:14:47 gunny8 kernel: [4611465.581641] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00 Nov 13 18:14:47 gunny8 kernel: [4611465.581646] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Nov 13 18:14:47 gunny8 kernel: [4611465.581650] usb 1-2.2: Product: nucleo-f767zi Nov 13 18:14:47 gunny8 kernel: [4611465.581653] usb 1-2.2: Manufacturer: RIOT-os.org Nov 13 18:14:47 gunny8 kernel: [4611465.581654] usb 1-2.2: SerialNumber: 6591620BCB270283 Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.1066] manager: (usb0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/528) Nov 13 18:14:47 gunny8 kernel: [4611465.594604] rndis_host 1-2.2:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-2.2, RNDIS device, fa:db:7c:1b:58:80 Nov 13 18:14:47 gunny8 mtp-probe: checking bus 1, device 28: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2" Nov 13 18:14:47 gunny8 mtp-probe: bus: 1, device: 28 was not an MTP device Nov 13 18:14:47 gunny8 systemd-udevd[17796]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable. Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 kernel: [4611465.643852] rndis_host 1-2.2:1.0 enp0s20f0u2u2: renamed from usb0 Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00001002 Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.1833] device (usb0): interface index 508 renamed iface from 'usb0' to 'enp0s20f0u2u2' Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.1 Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2037] device (enp0s20f0u2u2): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external') Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 vmnetBridge: Adding interface enp0s20f0u2u2 index:508 Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2075] device (enp0s20f0u2u2): carrier: link connected Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0 Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2129] settings: (enp0s20f0u2u2): created default wired connection 'Kabelgebundene Verbindung 2' Nov 13 18:14:47 gunny8 NetworkManager[24229]: <warn> [1668359687.2142] device (enp0s20f0u2u2): connectivity: "/proc/sys/net/ipv4/conf/enp0s20f0u2u2/rp_filter" is set to "1". This might break connectivity checking for IPv4 on this device Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2151] device (enp0s20f0u2u2): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed') Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2 Nov 13 18:14:47 gunny8 systemd-udevd[17796]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable. Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2403] policy: auto-activating connection 'Kabelgebundene Verbindung 2' (0b1ae45e-c76e-3efb-a2cd-138ca2b2a59c) Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2414] device (enp0s20f0u2u2): Activation: starting connection 'Kabelgebundene Verbindung 2' (0b1ae45e-c76e-3efb-a2cd-138ca2b2a59c) Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2419] device (enp0s20f0u2u2): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed') Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2429] device (enp0s20f0u2u2): state change: prepare -> config (reason 'none', sys-iface-state: 'managed') Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2440] device (enp0s20f0u2u2): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed') Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info> [1668359687.2445] dhcp4 (enp0s20f0u2u2): activation: beginning transaction (timeout in 45 seconds) Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043 Nov 13 18:14:47 gunny8 avahi-daemon[1464]: Joining mDNS multicast group on interface enp0s20f0u2u2.IPv6 with address fe80::dba4:adb8:9ffe:d93e. Nov 13 18:14:47 gunny8 avahi-daemon[1464]: New relevant interface enp0s20f0u2u2.IPv6 for mDNS. Nov 13 18:14:47 gunny8 avahi-daemon[1464]: Registering new address record for fe80::dba4:adb8:9ffe:d93e on enp0s20f0u2u2.*. Nov 13 18:14:47 gunny8 kernel: [4611465.895046] userif-1: sent link down event. Nov 13 18:14:47 gunny8 kernel: [4611465.895052] userif-1: sent link up event. ``` </details> Ping from and to the host. ### Issues/PRs references Depends on PR https://github.com/RIOT-OS/RIOT/pull/18983 Co-authored-by: Gunar Schorcht <gunar@schorcht.net> |
||
---|---|---|
.. | ||
ad7746 | ||
adcxx1c | ||
ads101x | ||
adt7310 | ||
adxl345 | ||
aip31068 | ||
apa102 | ||
apds99xx | ||
at | ||
at24cxxx | ||
at24mac | ||
at25xxx | ||
at30tse75x | ||
at86rf2xx | ||
at86rf215 | ||
ata8520e | ||
atwinc15x0 | ||
bh1750fvi | ||
bh1900nux | ||
bme680 | ||
bmp180 | ||
bmx055 | ||
bmx280 | ||
bq2429x | ||
can_trx | ||
cc1xxx_common | ||
cc110x | ||
cc2420 | ||
ccs811 | ||
cst816s | ||
dac_dds | ||
dcf77 | ||
dfplayer | ||
dht | ||
disp_dev | ||
dose | ||
ds18 | ||
ds75lx | ||
ds1307 | ||
ds3231 | ||
ds3234 | ||
dsp0401 | ||
dynamixel | ||
edbg_eui | ||
enc28j60 | ||
encx24j600 | ||
ethos | ||
feetech | ||
ft5x06 | ||
fxos8700 | ||
gp2y10xx | ||
grove_ledbar | ||
hd44780 | ||
hdc1000 | ||
hih6130 | ||
hm330x | ||
hmc5883l | ||
hsc | ||
hts221 | ||
ili9341 | ||
ina2xx | ||
ina3221 | ||
include | ||
io1_xplained | ||
ir_nec | ||
isl29020 | ||
isl29125 | ||
itg320x | ||
jc42 | ||
kw2xrf | ||
kw41zrf | ||
l3g4200d | ||
l3gxxxx | ||
lc709203f | ||
lcd | ||
lis2dh12 | ||
lis3dh | ||
lis3mdl | ||
lm75 | ||
lpd8808 | ||
lpsxxx | ||
lsm6dsl | ||
lsm303agr | ||
lsm303dlhc | ||
ltc4150 | ||
mag3110 | ||
matrix_keypad | ||
mcp47xx | ||
mcp2515 | ||
mfrc522 | ||
mhz19 | ||
mma8x5x | ||
mma7660 | ||
motor_driver | ||
mpl3115a2 | ||
mpu9x50 | ||
mq3 | ||
mrf24j40 | ||
mtd | ||
mtd_flashpage | ||
mtd_mapper | ||
mtd_mci | ||
mtd_sdcard | ||
mtd_spi_nor | ||
my9221 | ||
ncv7356 | ||
netdev | ||
netdev_ieee802154_submac | ||
nrf24l01p | ||
nrf24l01p_ng | ||
nvram | ||
nvram_spi | ||
opt3001 | ||
pca9633 | ||
pca9685 | ||
pcd8544 | ||
pcf857x | ||
periph_common | ||
ph_oem | ||
pir | ||
pn532 | ||
pulse_counter | ||
qmc5883l | ||
rgbled | ||
rn2xx3 | ||
rtt_rtc | ||
saul | ||
scd30 | ||
sdcard_spi | ||
sdp3x | ||
sds011 | ||
seesaw_soil | ||
servo | ||
sgp30 | ||
sht1x | ||
sht2x | ||
sht3x | ||
shtcx | ||
si70xx | ||
si114x | ||
si1133 | ||
slipdev | ||
sm_pwm_01c | ||
soft_spi | ||
soft_uart | ||
sps30 | ||
srf02 | ||
srf04 | ||
srf08 | ||
st7735 | ||
stmpe811 | ||
sx126x | ||
sx127x | ||
sx1280 | ||
tcs37727 | ||
tja1042 | ||
tmp00x | ||
touch_dev | ||
tps6274x | ||
tsl2561 | ||
tsl4531x | ||
uart_half_duplex | ||
usbdev_mock | ||
usbdev_synopsys_dwc2 | ||
vcnl40x0 | ||
veml6070 | ||
vl6180x | ||
w5100 | ||
ws281x | ||
xbee | ||
doc.txt | ||
Kconfig | ||
Kconfig.net | ||
Makefile | ||
Makefile.dep |