-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/tinyusb: add tinyUSB netdev driver #18903
Conversation
1b84d5d
to
ef78c85
Compare
ef78c85
to
0eb5cc9
Compare
Needs a rebase now, I'll try to give this a look soon. |
I just tested it on stm32f429i-disco, samr21-xpro and same54-xpro. |
Feels free to rebase. I've noticed a weird artifact in lsusb for RNDIS only (see UNRECOGNIZED):
|
In addition, |
These bytes are part of the interface descriptor as generated by the tinyUSB RNDIS Descriptor Template macro:
Either the macro is incorrect or the descriptor is not decoded correctly by the Linux kernel driver. I would tend to the latter. But either way, I'm afraid there's not much we can do to fix it. |
7a59200
to
24c84bf
Compare
I have rebased the PR to resolve the conflicts. I have also provided some small fixes. |
I'll re-test tonight. |
Please squash. |
Looks like TinyUSB changes the class/subclass/protocol trio because of Windows (probably for compatibility reason ?)
Linux is happy with Windows XP value but not with the default value. I guess there is nothing we can do on our side for this. |
24c84bf
to
ee8dcfe
Compare
RNDIS is primarily intended for use under Windows so I think we can accept the problem in Linux. |
I guess so. I'll give it a try on a Windows laptop tonight. |
@gschorcht |
I don't have any native Windows system. I tested it with my VirtualBox Windows 10. It seems to work.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
bors merge |
Build succeeded: |
Thanks for reviewing and testing. |
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 thetinyusb_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:
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
andtinyusb_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 :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):Testing procedure
Use a board that is supported by tinyUSB. Compile and flash the test application for each protocol:
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:Ping from and to the host.
Issues/PRs references
Depends on PR #18983