Add Linux support (x64) - #6
Conversation
The same Dart API runs on Linux desktop through the bundled libuvc backend. The linux/ plugin enumerates cameras via sysfs, opens the /dev/bus/usb node, and hands the fd to the existing uvc_wrap path; preview renders through FlPixelBufferTexture and deviceEvents comes from a netlink uevent monitor. libusb 1.0.29 and libjpeg-turbo 3.2.0 sources are vendored: libjpeg links static, libusb ships as a separate shared libusb1.0.so because it is LGPL and must remain replaceable. ABI: add uvc_get_preview_transform (both backends), keep the frame listener registered across preview stops, and exclude H.264 from the mode list on non-Android builds. H.264 preview and MP4 recording are not available on Linux yet.
Adds the Linux platform scaffold, hides the record button where recording is not available, saves captures to ~/Pictures, and points the native test bindings at the per-platform library name.
libuvc's install(EXPORT) rules were riding along with the app install, shipping libuvc.a plus cmake/pkgconfig metadata in bundle/lib. Part of the unreleased Linux support, so the changelog entry already covers it.
The Android-only 48KB iso transfer cap now applies to all Linux builds: the Pi 4's VL805 xhci mishandles large iso URBs (Transfer event TRB DMA ptr not part of current TD) and the stream dies at high resolutions. FFI_UVC_MAX_ISO_BYTES overrides the cap on desktop Linux for tuning. Part of the unreleased Linux support, so the changelog entry covers it.
💡 Codex ReviewLines 592 to 593 in 29ce4d2 The Linux attribution is added without replacing the existing Android-era license blocks: the newly added flutter_ffi_uvc/linux/flutter_ffi_uvc_plugin.cc Lines 517 to 518 in 29ce4d2 When ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The embedded libusb and libjpeg-turbo license copies were still the Android-prebuilt-era variants; NOTICES now carries the texts of the Linux-vendored sources (libusb 1.0.29, libjpeg-turbo 3.2.0) verbatim, per the license-notices sync rule.
A device unplugged while the uevent monitor was stopped left a stale entry in the known-device table, so its next attach on the same port was suppressed as a duplicate-interface event. Dedupe now compares the remembered deviceId, which changes with the replug's fresh devnum. Part of the unreleased Linux support, so the changelog entry covers it.
|
@codex review |
💡 Codex ReviewLines 37 to 38 in a1a53be When consumers target the newly registered Linux platform, the IDE-facing declarations in ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The dartdoc on the UvcCamera surface still described Android/Windows only: permission, enumeration, device events, and open semantics now cover Linux; startVideoRecording states it is unavailable on Linux; debugBmControls is Android and Linux (the libuvc backend implements it); supportedModes notes the Linux H.264 exclusion. README's debugBmControls note matches.
Platform mentions in the UvcCamera dartdoc now follow one rule: name a platform only where the caller must behave differently (capability gaps, permission flow, thrown errors), never to describe which native stack implements a member. Adds the missing Linux coverage under that rule: recording unavailability, debugBmControls availability, H.264 mode exclusion, device-node access. README's debugBmControls note matches.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20318c22d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Plugin dispose now stops the shared native session (uvc_close_device) before closing the USB fd it streams on, so transfer threads cannot touch a closed descriptor during engine teardown. Subscribing to deviceEvents seeds the known-device table from sysfs, so detach events also fire for cameras attached before the subscription that were never enumerated through listUsbDevices. Part of the unreleased Linux support, so the changelog entry covers it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57994ddb68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Seeding first left a gap: a camera attached after the sysfs scan but before the netlink socket bound was neither cached nor queued, so it produced no events at all. The socket now binds first and queues events during the scan; a device seen by both paths dedupes by deviceId. Part of the unreleased Linux support.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96d2aa95c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
target_link_options needs CMake 3.13; pass the link-time rpath-link flag through target_link_libraries instead, which accepts linker flags on every version this file declares support for. No behavior change: the built plugin's RUNPATH and the app link are identical.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c29a74ff71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Interface removals now only gather evidence: an uncached video-class interface removal records a placeholder (covering a device unplugged while the seed scan was still running), and the usb_device removal that ends the burst emits the detach using the cached identity plus the uevent environment. Emitting once per usb_device removal also removes the double-report risk of per-interface emission, and a device reset (interfaces recreated, devnum unchanged) now passes without a spurious detach/attach pair. Part of the unreleased Linux support.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex findings addressed:
|
The same Dart API now runs on Linux desktop through the bundled libuvc backend.
What
linux/plugin: sysfs enumeration, fd open through the existinguvc_wrappath,FlPixelBufferTexturepreview, netlink ueventdeviceEventslibusb1.0.so(LGPL)uvc_get_preview_transform); H.264 modes and recording are not available on Linux yetVerified