Skip to content

uvc: improve standard compliance and MacOS compat #92320

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

josuah
Copy link
Contributor

@josuah josuah commented Jun 27, 2025

That also improve standard compliance:

If the parameter block is longer than is indicated in the wLength field, only the initial bytes of the parameter block are returned. -- https://www.usb.org/document-library/video-class-v15-document-set

cc @kartben who was interested in testing on this platform

@josuah josuah self-assigned this Jun 27, 2025
@josuah josuah added area: USB Universal Serial Bus area: Video Video subsystem labels Jun 27, 2025
@josuah josuah force-pushed the pr_fix_uvc_macos branch from 52aed03 to d2eedd9 Compare June 27, 2025 15:26
@josuah josuah force-pushed the pr_fix_uvc_macos branch from d2eedd9 to 2d1409c Compare July 15, 2025 16:14
@josuah
Copy link
Contributor Author

josuah commented Jul 15, 2025

Force-push:

  • rebase on top of v4.2.0-rc3 (main)

I could check that it fixes a bug, but another one appears after it.
More commits will address it.

@josuah
Copy link
Contributor Author

josuah commented Jul 18, 2025

Force-push:

  • Add another commit to cap the response to wLength

Mac OSX should now work however some extra changes are required to get most applications work out of the box:

@josuah josuah force-pushed the pr_fix_uvc_macos branch 2 times, most recently from 429c057 to ba50197 Compare July 19, 2025 08:15
@josuah josuah removed the area: Video Video subsystem label Jul 19, 2025
@josuah
Copy link
Contributor Author

josuah commented Jul 19, 2025

Force-push:

  • reworded the commit message

@josuah josuah marked this pull request as ready for review July 19, 2025 08:16
@josuah josuah changed the title usb: uvc: improve MacOS compatibility uvc: improve standard compliance and MacOS compat Jul 19, 2025
@josuah josuah removed their assignment Jul 19, 2025
@josuah josuah added this to the v4.2.1 milestone Jul 19, 2025
@kartben kartben removed this from the v4.2.1 milestone Jul 19, 2025
@kartben kartben added backport v4.2-branch Request backport to the v4.2-branch area: Video Video subsystem labels Jul 19, 2025
josuah added 2 commits July 20, 2025 10:48
Some OSes like MacOS use shorter UVC 1.1 probe/commit messages even when
UVC 1.5 is supported, without bUsage, bBitDepthLuma, bmSettings,
bMaxNumberOfRefFramesPlus1, bmRateControlModes bmLayoutPerStream.
Accept messages of arbitrary size to safely be processed, ignoring all
missing fields, improving standard compliance.

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>
@josuah josuah force-pushed the pr_fix_uvc_macos branch from ba50197 to ff18028 Compare July 20, 2025 10:49
@josuah
Copy link
Contributor Author

josuah commented Jul 20, 2025

Force-push:

  • Rebase on latest main to fix CI endless loop on one arch

Copy link

Copy link
Contributor

@tmon-nordic tmon-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "some cases" for wLength are generally related to alignment and granularity requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus area: Video Video subsystem backport v4.2-branch Request backport to the v4.2-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants