RFC: API Change: usb: Make users call usb_enable. Provide global status callback. #21419
Labels
Breaking API Change
Breaking changes to stable, public APIs
RFC
Request For Comments: want input from the community
Introduction
Users should have a possibility to call usb_enable when they wants to (like its done for bluetooth). Currently usb is auto enabled on system boot up which may lead to errors (explained later).
USB status codes should refer to USB device as a whole not to a particular class as it is done now (HID).
Problem description
It is possible that usb is enabled before the class specific init function is called. If that happen usb hardware may start to produce events that will be dropped because class is not initialized yet.
Until now users were able to view the internal USB driver status codes only by using HID class. In fact usb status is global per a device not per function/class.
Proposed change
Make users responsible for calling usb_enable and decide whenever hardware should start to work.
Provide global status callback which will indicate the status of USB.
Detailed
To solve above problems I propose:
Delete usb_enable() from usb_device_init() which is called on system boot up.
Add a callback parameter to usb_enable(). If user wants to monitor the status of USB he could use this callback.
Proposed change (Detailed)
Please look to #20375 PR.
Dependencies
Users that use USB will have to update their applications and call usb_enable() by themselves as it will be removed from system boot up initialization.
The text was updated successfully, but these errors were encountered: