-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Draft
josuah
wants to merge
4
commits into
zephyrproject-rtos:main
Choose a base branch
from
tinyvision-ai-inc:pr_uvc_no_policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
UVC: move application decision to the application #93192
josuah
wants to merge
4
commits into
zephyrproject-rtos:main
from
tinyvision-ai-inc:pr_uvc_no_policy
+261
−168
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is not ready for review, will be properly split in individual commits, and "un-drafted" when ready... |
Some OSes like MacOS request only the UVC 1.1 probe/commit messages, and ignore the extra fields of the probe/commit struct: bUsage, bBitDepthLuma, bmSettings, bMaxNumberOfRefFramesPlus1, bmRateControlModes bmLayoutPerStream. Allow arbitrary size to safely be used by using a local `struct uvc_probe` and memcpy() the result from/to buffers. Given this is 48 bytes of temporary stack memory and control operation, performance and memory footprint are not observed. Signed-off-by: Josuah Demangeon <me@josuah.net>
In some cases, setup->wLength is shorter than the allocated buffer size. This lead to responses larger than what the host requested, which it rejected. Fix it by using the minimum between the allocated size, the struct size, and the wLength requested. Signed-off-by: Josuah Demangeon <me@josuah.net>
The UVC class was deciding the format list for itself, which does not allow the application to convert the format, or filter which formats to expose to thoe host. Remove this logic out of the UVC class and expose an extra API to add formats to the list. Signed-off-by: Josuah Demangeon <me@josuah.net>
The UVC class now allows the application to select the formats itself. Leverage this from the sample to filter out any format that is not expected to work (buffer too big) or less likely supported by the host when more standard formats are available. Signed-off-by: Josuah Demangeon <me@josuah.net>
Force-push:
Windows, Linux, MacOSX, Android are now expected to all work. Tested with nRF52840-DK:
Tested with Arduino Nicla Vision:
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: Samples
Samples
area: USB
Universal Serial Bus
area: Video
Video subsystem
Release Notes Required
Release notes required for this change
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.