-
Notifications
You must be signed in to change notification settings - Fork 8.3k
subsys: usb: host: Add USB Host Vendor specific serial class support #99173
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
base: main
Are you sure you want to change the base?
subsys: usb: host: Add USB Host Vendor specific serial class support #99173
Conversation
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]>
1b5bbd4 to
5c2f40a
Compare
|
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]>
5c2f40a to
37d1b8b
Compare
|



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]