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

Add UVC for video gadget #12

Merged
merged 10 commits into from
Dec 5, 2024
Merged

Add UVC for video gadget #12

merged 10 commits into from
Dec 5, 2024

Conversation

tuna-f1sh
Copy link
Contributor

@tuna-f1sh tuna-f1sh commented Dec 4, 2024

Here's the UVC gadget support.

I think the API makes sense for gadget creation. The UVC is a little different from the others in that it requires a userspace application to support even enumeration.

I tested with https://gitlab.freedesktop.org/camera/uvc-gadget. Creating the gadget then running uvc-gadget uvc.usb-gadget0-0 (where 'uvc.usb-gadget0-0' is the function dir) will enumerate with my macOS host - without the application it won't. One can open a camera application and open the device. The default just shows a test pattern but can pass -i image or -s dir for slideshow.

Screenshot 2024-12-04 at 14 37 14

Would be cool to make a Rust version of uvc-gadget but think it's beyond the scope of this crate or at least this PR since it would almost certainly add a few extra dependencies. It feels like more of a separate bin crate or perhaps workspace crate. Will explore.

Copy link
Owner

@surban surban left a comment

Choose a reason for hiding this comment

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

Looks good. Only some minor changes required.

src/function/video.rs Outdated Show resolved Hide resolved
src/function/video.rs Outdated Show resolved Hide resolved
src/function/video.rs Show resolved Hide resolved
@surban surban self-assigned this Dec 5, 2024
@surban surban added the enhancement New feature or request label Dec 5, 2024
/// Create a subdirectory and its parent directories.
pub fn create_dir_all(&self, name: impl AsRef<Path>) -> Result<()> {
let path = self.property_path(name)?;
log::debug!("creating directorys {}", path.display());
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
log::debug!("creating directorys {}", path.display());
log::debug!("creating directories {}", path.display());

@surban surban merged commit 2557284 into surban:master Dec 5, 2024
1 check passed
@surban
Copy link
Owner

surban commented Dec 6, 2024

Thanks! Seems to have been quite the effort to implement all these settings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants