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: check MPS depending on USB speed and endpoint type (Fix Coverity issues #14977) #15147

Closed

Conversation

jfischer-no
Copy link
Collaborator

Check MPS depending on USB speed and endpoint type.

This is based on #14977 and #15140, for a discussion how it could be done.

@finikorg You can cherry-pick or rebase it as you wish.

finikorg added 4 commits April 3, 2019 10:39
Include to the callback parameters also alt_setting to be able to make
right choice for ECM.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Refactor code making set_endpoint() helper which check validity of
input parameters. At the moment FS USB is supported, for future we
also need to add HS part.

Fix bug with usb_set_configuration() always returning true.

Fixes zephyrproject-rtos#14954

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Use helper set_endpoint() for endpoint configuration.

Fixes zephyrproject-rtos#14957

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
@jfischer-no jfischer-no added bug The issue is a bug, or the PR is fixing a bug area: USB Universal Serial Bus RFC Request For Comments: want input from the community labels Apr 3, 2019
@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 3, 2019

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

Copy link
Collaborator

@finikorg finikorg left a comment

Choose a reason for hiding this comment

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

I think we can make simper, just

diff --git a/include/usb/usb_device.h b/include/usb/usb_device.h
index 9546bfad25..5ea2617888 100644
--- a/include/usb/usb_device.h
+++ b/include/usb/usb_device.h
@@ -74,6 +74,16 @@ extern "C" {
 
 #define MAX_PACKET_SIZE0    64        /**< maximum packet size for EP 0 */
 
+#if DT_USBHS_MAXIMUM_SPEED == USB_MAXIMUM_SPEED_HIGH_SPEED
+#define USB_MAX_BULK_MPS       512
+#define USB_MAX_INT_MPS                1024
+#define USB_MAX_ISO_MPS                1024
+#else /* For every other configuartions for now */
+#define USB_MAX_BULK_MPS       64
+#define USB_MAX_INT_MPS                64
+#define USB_MAX_ISO_MPS                1023
+#endif
+
 /*************************************************************************
  *  USB application interface
  **************************************************************************/

b441bba68a64a3ba8a6f389b4845b8878d632921

That DTS a bit screwed up, I think every board reinvent its own maximum speed definition.

Add maximum packet size for different endpoint types
and usb speed modes.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Check MPS depending on USB speed and endpoint type.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
@jfischer-no
Copy link
Collaborator Author

close it, I have an other fix in mind

@jfischer-no jfischer-no closed this Apr 5, 2019
@jfischer-no jfischer-no deleted the proposal-14977 branch September 19, 2019 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants