Skip to content
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

usb: device_next: prevent ECHO on Linux Kernel based host #82815

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jfischer-no
Copy link
Collaborator

@jfischer-no jfischer-no commented Dec 10, 2024

This is similar to the approach implemented for the legacy CDC ACM class
commit 0127d00
("usb: device: cdc_acm: Use ZLP to detect initial host read")
but it uses Set Line Coding request to detect client activity on the
host side.

Cherry-picked from #80985

Fix "warning: 'cdc_acm_send_notification' defined but not used"
when Kconfig option UART_USE_RUNTIME_CONFIGURE is not used and
properly handle enqueue error.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This is similar to the approach implemented for the legacy CDC ACM class
commit 0127d00
("usb: device: cdc_acm: Use ZLP to detect initial host read")
but it uses Set Line Coding request to detect client activity on the
host side.

Suggested-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
@jfischer-no jfischer-no added area: USB Universal Serial Bus Experimental Experimental features not enabled by default labels Dec 10, 2024
Copy link
Contributor

@tmon-nordic tmon-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't really work. Set line coding is in no way required. Please just replicate the ZLP handling as this is the only approach that is guaranteed to work.

Note that some applications may actually want to have the echo. The ZLP is transparent to any application using the tty layer and allows the best possible indication to class implementation that host actually started to read the data on IN endpoint.

@jfischer-no
Copy link
Collaborator Author

This won't really work. Set line coding is in no way required.

That works very well, and not just once. And if there is no line coding request then it is not a Linux host.

Please just replicate the ZLP handling as this is the only approach that is guaranteed to work.

Yes, that it how it is implemented.

@tmon-nordic
Copy link
Contributor

That works very well, and not just once. And if there is no line coding request then it is not a Linux host.

The original implementation is completely independent of any control transfers. Your spin-off is depending on Set Line Coding. This is essentially different. Please remove the Set Line Coding dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Experimental Experimental features not enabled by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants