-
Couldn't load subscription status.
- Fork 8.1k
UVC: move application decision to the application #93192
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
UVC: move application decision to the application #93192
Conversation
|
This is not ready for review, will be properly split in individual commits, and "un-drafted" when ready... |
|
Force-push:
Windows, Linux, MacOSX, Android are now expected to all work. Tested with nRF52840-DK: Tested with Arduino Nicla Vision: |
f1cb80e to
f5328dd
Compare
|
Force-push:
|
|
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.
Needs rebase.
|
Force-push: applying review suggestions
|
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.
LGTM. Thanks.
7ef196b to
bc63264
Compare
|
nRF52840 with nRF52840 with Here on FRDM-MCXN947 with |
bc63264 to
042a6e7
Compare
042a6e7 to
f4d49e7
Compare
|
Force-push:
[EDIT: sonarcubecloud says that variables used only in |
When running out of descriptor, return an error instead of ignoring it. The application need to make sure to adjust the Kconfig macros to have enough descriptors for all formats to add. Signed-off-by: Josuah Demangeon <[email protected]>
Make use of the recently merged fmt->size to know the maximum size of the frame to be allocated, which works for both compressed and uncompressed video. Signed-off-by: Josuah Demangeon <[email protected]>
The UVC class was deciding itself which formats were sent to the host. Remove this logic out of the UVC class and introduce uvc_add_format() to give the application the freedom of which format to list. Signed-off-by: Josuah Demangeon <[email protected]>
The UVC class now lets the application select the format list sent to the host. Leverage this in the sample to filter out any format that is not expected to work (buffer too big, rarely supported formats). Signed-off-by: Josuah Demangeon <[email protected]>
Add USB UVC device's new uvc_add_format() function to the release note, and document the semantic changes of UVC APIs in the migration guide. Signed-off-by: Josuah Demangeon <[email protected]>
f4d49e7 to
d6d97c6
Compare
|
|
LGTM. Tested ok with PR#94562 on top of it via the STM32N6. |
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.
LGTM. Tested ok with PR#94562 on top of it via the STM32N6.
| desc->wWidth = sys_cpu_to_le16(w); | ||
| desc->wHeight = sys_cpu_to_le16(h); | ||
| desc->dwMaxVideoFrameBufferSize = sys_cpu_to_le32(max_size); | ||
| desc->dwMaxVideoFrameBufferSize = sys_cpu_to_le32(fmt.size); |
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.
Sorry nitpicking: for commit "usb: device_next: uvc: use fmt->size instead of computing it every time",
fmt.size is not already set. This gets fixed in a later commit but I would suggest that this commit still uses
desc->dwMaxVideoFrameBufferSize = sys_cpu_to_le32(MAX(p, w) * h);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.
I must have verified the final version of the file, but this fmt struct is local in this commit. Good catch for bissectability!
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.
It looks like this got merged. Since this got raised past-review and is in git history by now. One commit will have a runtime (not compile time) error unfortunately 😞
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.
I think I was too slow to react. Now it's merged. My bad.
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.
it's also very useful as a reminder of what I need to check the next time, so still useful :)




Dependency:
The USB class was doing arbitrary "best guess" choices about what pixel formats or resolutions to include (all of them, and min/max only when format are ranges).
uvc_add_format()to allow the application to push the exact format it wantsWhat is added in the sample is a matter of application choices, and trapping these choices in the UVC class prevented the samples to work without manual configuration on diverse platform.
MacOS support still not confirmed.
Linux, Windows, Android tested functional with the hardware I have.