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

[Backport v1.0] usb: device: gs_usb: convert dummy endpoint to fully functional OUT ep #64

Conversation

henrikbrixandersen
Copy link
Member

Convert the dummy endpoint to a fully functional bulk OUT endpoint in order to be compatible with gs_usb drivers selecting the first available IN/OUT endpoints for use, and introduce a Kconfig option for turning off gs_usb driver compatibility mode.

The Linux kernel gs_usb driver prior to kernel v6.12.5 uses hardcoded USB endpoint addresses 0x81 (bulk IN) and 0x02 (bulk OUT). The same assumption on USB endpoint addresses may be present in other drivers as well (e.g. python-can).

Depending on the capabilities of the USB device controller, the requested USB endpoint addresses may be rewritten by the Zephyr USB device stack at runtime. Enabling compatibility mode will include a second bulk OUT endpoint to ensure correct operation with gs_usb drivers using the hardcoded USB endpoint addresses described above.

It is safe to enable compatibility mode regardless of the driver being used, but the resulting firmware will require slightly more RAM and flash resources.

@henrikbrixandersen henrikbrixandersen added the Backport Issue or PR is a backport for a release branch label Dec 30, 2024
Convert the dummy endpoint to a fully functional bulk OUT endpoint in order
to be compatible with gs_usb drivers selecting the first available IN/OUT
endpoints for use.

Signed-off-by: Henrik Brix Andersen <[email protected]>
(cherry picked from commit 4024c25)
Introduce a Kconfig option for turning off gs_usb driver compatibility
mode.

The Linux kernel gs_usb driver prior to kernel v6.12.5 uses hardcoded USB
endpoint addresses 0x81 (bulk IN) and 0x02 (bulk OUT). The same assumption
on USB endpoint addresses may be present in other drivers as well
(e.g. python-can).

Depending on the capabilities of the USB device controller, the requested
USB endpoint addresses may be rewritten by the Zephyr USB device stack at
runtime. Enabling compatibility mode will include a second bulk OUT
endpoint to ensure correct operation with gs_usb drivers using the
hardcoded USB endpoint addresses described above.

It is safe to enable compatibility mode regardless of the driver being
used, but the resulting firmware will require slightly more RAM and flash
resources.

Signed-off-by: Henrik Brix Andersen <[email protected]>
(cherry picked from commit d078ed4)
@henrikbrixandersen henrikbrixandersen marked this pull request as ready for review December 31, 2024 10:10
@henrikbrixandersen henrikbrixandersen merged commit ffb297a into CANnectivity:v1.0-branch Dec 31, 2024
4 checks passed
@henrikbrixandersen henrikbrixandersen deleted the no-more-dummy-ep-v1_0 branch December 31, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Issue or PR is a backport for a release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant