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: obtain configuration descriptor's bmAttributes and bMaxPower from DT #19545

Closed
jfischer-no opened this issue Oct 2, 2019 · 9 comments
Closed
Assignees
Labels
area: Boards area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features

Comments

@jfischer-no
Copy link
Collaborator

jfischer-no commented Oct 2, 2019

Currently configuration descriptor's bmAttributes and bMaxPower is hardcoded to SelfPowered and MaxPower of 100mA. Where SelfPowered applies to most boards in the tree except boards like pca10059 for example.

Both SelfPowered and MaxPower should be derived from DT because they are hardware properties.
Note: SelfPowered can not be changed at runtime because there is no API for.

@jfischer-no jfischer-no added Enhancement Changes/Updates/Additions to existing features area: Boards area: USB Universal Serial Bus labels Oct 2, 2019
@jfischer-no jfischer-no self-assigned this Oct 2, 2019
@StefJar
Copy link

StefJar commented Oct 21, 2019

any news on that feature implementation?

@StefJar
Copy link

StefJar commented Nov 4, 2019

@galak any news regarding that feature?

@solsbarry
Copy link
Contributor

I also would like this feature. I tired creating a second usb descriptor which is easy enough. But whether the Host even asks for anything but the first descriptor is host dependent. On my host, the first descriptor is used if it can be, so this is not a solution.
All you need to do I think, is make a new kconfig option called CONFIG_USB_MAX_POWER in zephyr/subsys/usb/Kconfig
The defualt could be 0x32
Then in usb_descriptor.c
do .bMaxPower = CONFIG_USB_MAX_POWER;

and something similar for bmAttributes

@solsbarry
Copy link
Contributor

I provided a fix like I described above. I realize the original request asked for a way to configure this at runtime, and my fix is only at build time. But I am not sure there is a practical reason to reconfigure at runtime. But maybe there is.

@jfischer-no
Copy link
Collaborator Author

Where is this "original request" you talking about?

@solsbarry
Copy link
Contributor

solsbarry commented Dec 17, 2019

@jfischer-phytec-iot I meant your request. But now reading your post closer, I see you were just stating there is no API not asking for one. Sorry for any confusion.

@jfischer-no
Copy link
Collaborator Author

This issue suggests to use device tree not Kconfig. But with #20375, Kconfig could probably be a good solution too.

@StefJar
Copy link

StefJar commented Dec 18, 2019

I put a request for that some time ago
#19544

@jfischer-no
Copy link
Collaborator Author

resolved by #21461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

4 participants