Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"crates/openlogi-inject",
"crates/openlogi-hidpp",
"crates/openlogi-hid",
"crates/openlogi-camera",
"crates/openlogi-assets",
"crates/openlogi-cli",
"crates/openlogi-agent-core",
Expand Down
32 changes: 31 additions & 1 deletion crates/openlogi-assets/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ pub struct Assignment {
/// `map_slot_name`-style consumers treat unknown names as "no hotspot".
#[serde(rename = "slotName", default)]
pub slot_name: String,
/// Camera depots ship marker-less settings-slot assignments (under the
/// `device_camera_image` entry, which no hotspot consumer reads); a
/// missing marker defaults to the origin rather than failing the file.
#[serde(default)]
pub marker: Point,
#[serde(default)]
pub label: Direction,
}

#[derive(Debug, Deserialize, Clone, Copy)]
#[derive(Debug, Deserialize, Clone, Copy, Default)]
pub struct Point {
pub x: f32,
pub y: f32,
Expand Down Expand Up @@ -145,4 +149,30 @@ mod tests {
assert_eq!((origin.width, origin.height), (3598, 1315));
assert_eq!(meta.images[0].assignments[0].slot_name, "");
}

/// Camera depots (StreamCam) list settings-slot assignments with no
/// `marker` under their `device_camera_image` entry. Parsing must not
/// fail wholesale, and `assignments()` must not surface them (it reads
/// only the `device_buttons_image` entry).
#[test]
fn camera_metadata_without_markers_parses() {
let json = r#"{
"images": [
{ "key": "device_image", "origin": { "width": 1280, "height": 800 } },
{
"key": "device_camera_image",
"origin": { "width": 396, "height": 396 },
"assignments": [
{ "slotId": "streamcam-0893_webcam_camera_settings",
"slotName": "SLOT_NAME_WEBCAM_CAMERA_SETTINGS",
"disableAssignmentClick": true }
]
}
]
}"#;
let meta: Metadata = serde_json::from_str(json).expect("camera schema must parse");
let origin = meta.origin().expect("origin survives");
assert_eq!((origin.width, origin.height), (1280, 800));
assert_eq!(meta.assignments().count(), 0);
}
}
47 changes: 47 additions & 0 deletions crates/openlogi-camera/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "openlogi-camera"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
authors.workspace = true
description = "Generic Logitech UVC webcam discovery for OpenLogi (AVFoundation on macOS, DirectShow on Windows)."
keywords = ["logitech", "uvc", "webcam", "camera", "avfoundation"]
categories = ["hardware-support"]

[dependencies]
serde = { workspace = true }
tracing = { workspace = true }

# AVFoundation (AVCaptureDevice) enumeration — same objc 0.2 toolchain the GUI's
# menu-bar / permission FFI uses, so it's already proven in this workspace.
[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2"
block = "0.1"

# DirectShow enumeration + IAMVideoProcAmp / IAMCameraControl UVC controls.
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Media_DirectShow",
"Win32_Media_MediaFoundation",
"Win32_System_Com",
"Win32_System_Com_StructuredStorage",
"Win32_System_Variant",
"Win32_System_Ole",
] }

# Mirrors [workspace.lints], but allows the legacy `cfg(cargo-clippy)` check the
# objc 0.2 macros emit (same as openlogi-gui / openlogi-hook). unsafe_code stays
# denied; the AVFoundation module opts in locally with #[expect(unsafe_code)].
[lints.rust]
unsafe_code = "deny"
unexpected_cfgs = { level = "allow", check-cfg = [] }

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
unwrap_used = "warn"
expect_used = "warn"
missing_errors_doc = "allow"
doc_markdown = "allow"
Loading
Loading