Skip to content

Conversation

@Girinandha-M
Copy link

@Girinandha-M Girinandha-M commented Nov 10, 2025

Dependency:

Upstream Reference:

WIP subsys: usb: host: add vendor-specific serial class

Add USB vendor-specific serial host class driver that matches
devices by VID, PID.

This is not a standard CDC-ACM driver - it's for vendor-specific
serial devices that use bulk endpoints instead of CDC protocol.

This is draft PR, changes to be made.

Signed-off-by: Girinandha Manivelpandiyan [email protected]

Josuah Demangeon and others added 9 commits October 29, 2025 11:18
Add a "struct usbh_status" that contains a bitmask of flags to keep
track of the global state of the host context, like done for the
device_next implementation.

Signed-off-by: Josuah Demangeon <[email protected]>
Add a "struct usbh_class_api" for the host implementation, and move all
the function poitners to it. Add more fields to "struct usbh_class_data".

Signed-off-by: Josuah Demangeon <[email protected]>
Add API wrappers around the function pointers in struct usbh_class_api,
while also documenting the USB host class internal API.

Signed-off-by: Josuah Demangeon <[email protected]>
Add functions to probe/remove all classes as part of a new usbh_class.c
and a matching usbh_class.h. These functions are called from the function
usbh_init_device_intl() in usbh_core.c to initialize every class upon
connection of a device. Every class driver provide filters to match the
interfaces of the device.

Co-authored-by: Aiden Hu <[email protected]>
Signed-off-by: Josuah Demangeon <[email protected]>
Allocate extra room at the end of the USB descriptor buffer to ensure
that the device ends with `desc->bLength == 0`. For now, validating
`desc->bLength` from the device to ensure no access past the buffer
is still not done.

Signed-off-by: Josuah Demangeon <[email protected]>
This commit invokes usbh_class_remove_all() in the device removal
handler to clean up USB classes when a device is disconnected.

Signed-off-by: Santhosh Charles <[email protected]>
This patch adds NULL checks in usbh_desc_get_next_function()
to prevent invalid dereferencing. Return the descriptor when
the requested interface is found to prevent infinite loop.

Signed-off-by: Santhosh Charles <[email protected]>
This patch modifies the USB device int sequence to read the device
descriptor only after setting a valid device address.

Signed-off-by: Santhosh Charles <[email protected]>
add devicetree binding file for vendor class serial usb host
implementation for zephyr.

Signed-off-by: Girinandha Manivelpandiyan <[email protected]>
@Girinandha-M Girinandha-M changed the title upstream/usbh vendor serial subsys: usb: host: Add USB Host Vendor specific serial class support Nov 13, 2025
@Girinandha-M Girinandha-M force-pushed the upstream/usbh-vendor-serial branch from 1b5bbd4 to 5c2f40a Compare November 13, 2025 20:32
@josuah
Copy link
Contributor

josuah commented Nov 16, 2025

Hello @Girinandha-M, the fixes from #99334 got integrated into #94590.

If you wished to simplify your PR you may be able to switch to #94590.

Copy link
Contributor

Choose a reason for hiding this comment

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

While this is a simple and efficient API, there is an existing API in Zephyr for serial lines, which for instance USB CDC ACM supports, and which might be needed in the final version of this driver.

@jfischer-no @tmon-nordic
Should this be handled as a UART async API? As UART IRQ-based API? Custom one like now?

I think the goal is to get modem used, so both would work, I suppose something like this on top of it:
https://github.com/zephyrproject-rtos/zephyr/tree/3cf7b202780d788976e4bf3e46724e63d23f6bcc/drivers/modem

Copy link
Contributor

Choose a reason for hiding this comment

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

Implementing UART API would probably be the easiest solution to get higher-level things working on top of such USB serial port. I am not sure what design sacrifices would have to be made to support UART API though.

add support for the vendor specific serial support class
to the usb subsys. This implementation enable the usb host class support
the vendor specific devices for serial communication.

Signed-off-by: Girinandha Manivelpandiyan <[email protected]>
@Girinandha-M Girinandha-M force-pushed the upstream/usbh-vendor-serial branch from 5c2f40a to 37d1b8b Compare November 17, 2025 18:25
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants