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

RFC: API Change: usb: Make users call usb_enable. Provide global status callback. #21419

Closed
eobalski opened this issue Dec 16, 2019 · 1 comment · Fixed by #20375
Closed

RFC: API Change: usb: Make users call usb_enable. Provide global status callback. #21419

eobalski opened this issue Dec 16, 2019 · 1 comment · Fixed by #20375
Labels
Breaking API Change Breaking changes to stable, public APIs RFC Request For Comments: want input from the community

Comments

@eobalski
Copy link
Collaborator

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.

@eobalski eobalski added RFC Request For Comments: want input from the community Breaking API Change Breaking changes to stable, public APIs labels Dec 16, 2019
@nordic-krch
Copy link
Contributor

Not sure if this is the case but if usb device can be seen as service requested and released asynchronously by multiple clients (classes) then you might want to keep your eye on onoff_service PR (#21090) which attempts to standardize such case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking API Change Breaking changes to stable, public APIs RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants