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: gs_usb: convert dummy endpoint to fully functional OUT ep #61

Merged

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 self-assigned this Dec 30, 2024
@henrikbrixandersen henrikbrixandersen added the enhancement New feature or request label Dec 30, 2024
@henrikbrixandersen henrikbrixandersen marked this pull request as ready for review December 30, 2024 21:43
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]>
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]>
@henrikbrixandersen henrikbrixandersen merged commit d078ed4 into CANnectivity:main Dec 30, 2024
6 checks passed
@henrikbrixandersen henrikbrixandersen deleted the no-more-dummy-ep branch December 30, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant