-
Notifications
You must be signed in to change notification settings - Fork 3k
Add USBCDC_ECM class #9443
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
Add USBCDC_ECM class #9443
Conversation
af98aa8
to
84b6c2c
Compare
@juhaylinen, thank you for your changes. |
FYI @mikter |
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.
If read and write are implemented can linux then use this class to provide an internet connection over USB?
|
||
_bulk_buf_size = read_finish(_bulk_out); | ||
|
||
read_start(_bulk_out, _bulk_buf, MAX_PACKET_SIZE_BULK); |
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.
Without being able to receive data the functionality of this device is quite limited.
if (setup->bmRequestType.Type == CLASS_TYPE) { | ||
//printf("In USBCallback_request: CLASS specific Request: %02x\n", setup->bRequest); | ||
switch (setup->bRequest) { | ||
case SET_ETHERNET_MULTICAST_FILTERS: |
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.
Should these be forwarded to the user of this call as a callback? Alternatively, if this class took in a an EMAC
phy then you could call the appropriate functions. @kjbracey-arm what are your thoughts on this?
void _bulk_in_callback(); | ||
void _bulk_out_callback(); | ||
bool _notify_network_connection(uint8_t value); | ||
bool _notify_connection_speed_change(uint32_t up, uint32_t down); |
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.
_notify_network_connection
and _notify_connection_speed_change
are private and I don't see them being used anywhere in this class. Is this dead code?
usb/device/USBCDC_ECM/USBCDC_ECM.cpp
Outdated
|
||
const uint8_t *USBCDC_ECM::string_iconfiguration_desc() | ||
{ | ||
static uint8_t string_imac_addr[26] = {0}; |
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.
This array should probably be a member of the class rather than static.
usb/device/USBCDC_ECM/USBCDC_ECM.cpp
Outdated
return NULL; | ||
} | ||
|
||
static const uint8_t configDescriptor[] = { |
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.
This array should probably be a member of the class rather than static. Also the local static initialization will cause mutexes to be used in interrupt context.
@c1728p9 Mind taking another look? New commit looks like it resolved old comments. |
091b0e7
to
e23e57d
Compare
e583636
to
1c11290
Compare
@c1728p9 I have addressed the changes requested. Please review. |
@c1728p9 Please rereview. |
Hi @juhaylinen, to progress this further you'll need to create documentation on how to use this containing an API reference along with one or more examples on how to use this. For reference the documentation for all the existing USB classes can be found at https://github.com/ARMmbed/mbed-os-5-docs/tree/development/docs/api/usb. Also from our email conversations it sounds like this only works on Linux. Is that correct? To be accepted as part of mbed-os this needs to work on Windows, Linux and OSX. Once these two points are addressed I'll mark this as approved. CC @cmonr |
Linux and OSX have native support for USBCDC_ECM. Windows seem to require 3rd party driver (Belcarra, Thesycon, etc.) for the CDC-ECM support. Is this OK? |
Hi @juhaylinen, if you provide instructions in the documentation on how to setup and use USBCDC_ECM on Windows with freely available 3rd party software it will be OK. |
@c1728p9 Any change getting this in 5.12 since only documentation is needed? |
Hi @juhaylinen I don't feel comfortable merging this without at least some preliminary docs/example. Without those I don't know how to test this on Windows. I'm also having a hard time seeing how users could easily make use of this in its current form, which docs would help to clarify. |
I also share @c1728p9 concern about lack of documentation. |
@c1728p9 Should this be retargeted to |
@cmonr yeah, this PR should be against master now. |
@juhaylinen Please rebase against master when possible. |
Add initial Ethernet over USB communication support using the ECM (Ethernet Control Model) subclass of USB CDC.
Replace static arrays used for iMAC and config descriptor with class members Minor coding style fixes
Fix build issues after rebase
Handle SET_ETHERNET_PACKET_FILTER request
@juhaylinen is this still waiting for docs and examples ? As per @c1728p9 and @cmonr comments ? |
LGTM, but this still needs docs, and replies to @c1728p9 comments. |
@adbridge Docs and examples are still missing. I have been busy with more urgent tasks and I'm not sure when I can continue with this. |
We will continue this work when our plans go forward. remaining part of work is planned to next release. For widows support it is quite clear it does not support it and we should not do anything more to add support for windows for this feature. perhaps link in documentation to places where to get windows support could be added. |
Windows support is an important aspect of this, as the a large number of mbed users are on Windows. It may be more appropriate to push USBCDC_ECM into its own repository rather than merge it into mbed-os. That way it doesn't set the expectation this has the support/compatibility of the existing USB classes. @bulislaw what do you think? |
@c1728p9 I don't understand your approach Windows does not support it we can't add support for windows as what ever we do it does not support it. Windows supports proprietary RNDIS protocol which this is not. Here is a link for different protocols https://usblan.belcarra.com/p/protocols.html Windows support can be added by external companies and you can find driver for windows that will support ECM. https://usblan.belcarra.com/2015/12/usblan-for-windows-10.html @paspik @AnttiKauppila any idea how to continue this as requirement as we can't make all the different USB ethernet protocols |
I don't like the idea of not adding support for all 3 platforms. If there's a way of making it work on Windows, external drivers, we should be exploring it. If there are issues with our corporate setup we need to either figure out why is that (and work with IT to remove it) or request non-IT managed windows (VM?) to complete setup and testing. Also we'll need the requested docs before bringing it to master. |
@juhaylinen Besides one platform lacking, can we at least get the rest completed? @c1728p9 will soon move from USB, it would be nice to have this completed (even if parked on feature branch). Please talk to him this week. |
No more work has been planned for this. What do you think is missing if we exclude windows support? |
@bulislaw do you have an update to the windows support topic? |
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.
Good arguments were raised during offline discussions. Specifically:
- Feature branch maintenance is expensive
- By pushing it to master we will add value
- Mbed OS promise is around development on 3 OSs, not feature support
- Feature can be used on OSs with standard ECM support, proprietary drivers can be explored when Windows support will be required
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Docs PRs are there, I reviewed them. This should be ready for integration now. |
Description
Add initial Ethernet over USB communication support using
the ECM (Ethernet Control Model) subclass of USB CDC.
Pull request type
Reviewers
@c1728p9