{"record":{"id":"044b8798f4330483","repo":"AprilNEA/OpenLogi","slug":"e","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/camera.rs","lineNumber":78,"sourceCode":"                        );\n                    }\n                    for (toggle, st) in &state.autos {\n                        println!(\n                            \"  {}: current={} default={}\",\n                            toggle.name(),\n                            st.current,\n                            st.default\n                        );\n                    }\n                }\n                Ok(_) => println!(\"  (no adjustable controls, or camera not found)\"),\n                Err(e) => println!(\"  {e}\"),\n            }\n        }\n        CameraCmd::Set { control, value } => {\n            let raw = control.to_ascii_lowercase();\n            if let Some(toggle) = AutoToggle::ALL.iter().find(|t| t.name() == raw) {\n                openlogi_camera::set_auto(&uid, *toggle, value != 0).map_err(|e| anyhow!(\"{e}\"))?;\n                println!(\"set {} = {}\", toggle.name(), value != 0);\n            } else {\n                let control = parse_control(&raw)?;\n                openlogi_camera::set_control(&uid, control, value).map_err(|e| anyhow!(\"{e}\"))?;\n                println!(\"set {} = {value}\", control.name());\n            }\n        }\n    }\n    Ok(())\n}\n\nfn parse_control(raw: &str) -> Result<CameraControl> {\n    CameraControl::ALL\n        .into_iter()\n        .find(|c| c.name() == raw)\n        .ok_or_else(|| {\n            let names: Vec<&str> = CameraControl::ALL\n                .iter()","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/camera.rs#L60-L96","documentation":"This error wraps any failure from `openlogi_camera::set_auto` when the CLI `camera set` command tries to change an auto-exposure-style toggle (e.g. auto-focus, auto-exposure) on a Logitech UVC camera. The underlying camera error message is passed through verbatim via `anyhow!(\"{e}\")`, so the displayed text comes from the camera crate, not this site. It exists to convert the camera crate's error type into the CLI's `anyhow::Result` chain.","triggerScenarios":"Running `openlogi camera set <auto-toggle-name> <0|1>` where `openlogi_camera::set_auto(&uid, toggle, bool)` returns Err — e.g. the camera is disconnected between enumeration and the set, the UVC control is not supported by the device, or the OS rejects the control write.","commonSituations":"Camera unplugged or asleep when the command runs; targeting a webcam that lacks the requested auto control; running without OS permission to access the camera device; a stale device UID from a previous enumeration.","solutions":["Re-run `openlogi camera list` (or equivalent) to confirm the camera UID is still valid and the device is present, then retry the set.","Check the camera's supported controls in the list output; the requested auto toggle may not exist on this model.","Verify the process has camera-device access permissions (macOS camera TCC, Linux udev/video-group access) and retry.","Read the wrapped `{e}` message — it names the underlying UVC failure; fix that condition directly."],"exampleFix":"// before: blind call, any failure surfaces here\nopenlogi_camera::set_auto(&uid, *toggle, value != 0).map_err(|e| anyhow!(\"{e}\"))?;\n// after: probe the control first and give a targeted message\nif !openlogi_camera::supports_auto(&uid, *toggle)? {\n    anyhow::bail!(\"camera {} does not support auto {}\", uid, toggle.name());\n}\nopenlogi_camera::set_auto(&uid, *toggle, value != 0).map_err(|e| anyhow!(\"set auto {}: {e}\", toggle.name()))?;","handlingStrategy":"try-catch","validationCode":"// confirm the camera and control exist before setting\nlet known = openlogi_camera::list_controls(&uid)?;\nif !known.iter().any(|c| c.is_auto_toggle(toggle)) {\n    eprintln!(\"camera {uid} lacks auto toggle {}\", toggle.name());\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match openlogi_camera::set_auto(&uid, toggle, on) {\n    Ok(()) => println!(\"set {} = {on}\", toggle.name()),\n    Err(e) if e.is_disconnected() => eprintln!(\"camera {uid} disappeared; re-enumerate and retry\"),\n    Err(e) => eprintln!(\"set auto {} failed: {e}\", toggle.name()),\n}","preventionTips":["List supported controls for the UID before every scripted set.","Re-enumerate the camera immediately before writes in scripts instead of caching UIDs.","Ensure camera access permissions are granted to the terminal/process.","Handle disconnects by re-running enumeration rather than retrying the stale UID."],"tags":["cli","camera","uvc","device-io"],"backgroundTag":"device-control-write-failed","analyzedSha":"e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8","analyzedAt":"2026-09-13T03:07:16.451Z","contentChangedAt":"2026-09-13T03:07:16.451Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}