Face unlock: say why a camera can't be used, list the cameras, pick one
CI / test (push) Canceled after 21m7s
CI / test (push) Canceled after 21m7s
"no camera at PATH" now says why (not there or a broken link, permission denied, not a V4L2 device, a metadata node rather than the picture node, OpenCV couldn't start it or it gives no picture: another app using it) and lists the cameras found (VIDIOC_QUERYCAP on /dev/v4l/by-id/* and /dev/video*). New commands: `chandra-face cameras`, `chandra-face set-camera PATH` (root, edits device in face.conf after checking it is a capture node). The Face unlock window shows the cameras found with a Use button (one password), then opens again. just install prints NOT READY with the reason when the configured camera can't be used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
This commit is contained in:
7 files changed
+251
-9
No files matched your search
@@ -16,6 +16,7 @@ pub(all) enum FaceHit {
|
||||
Snap
|
||||
DropSnap(Int)
|
||||
ToggleFace(String)
|
||||
UseCamera(String)
|
||||
Apply
|
||||
Cancel
|
||||
} derive(Eq)
|
||||
@@ -50,6 +51,7 @@ fn ChandraCompositor::face_window_activate(self : ChandraCompositor, h : FaceHit
|
||||
Snap => f.snap()
|
||||
DropSnap(i) => f.drop_snap(i)
|
||||
ToggleFace(id) => f.toggle_remove(id)
|
||||
UseCamera(path) => f.use_camera(path)
|
||||
Apply => f.apply()
|
||||
Cancel => f.cancel_window()
|
||||
}
|
||||
@@ -195,6 +197,28 @@ fn ChandraCompositor::face_window_ops(self : ChandraCompositor) -> Array[@scene.
|
||||
my = my + fs + 3
|
||||
}
|
||||
y = y + bh.max(msg_lines.length() * (fs + 3)) + 14
|
||||
// The configured camera can't be used: the ones that can, to pick from (saved as root).
|
||||
if win.ended && win.cameras.length() > 0 {
|
||||
body.push(@scene.DrawOp::Text(pad, y + 8, "Cameras here", fs - 2, p.foreground_muted, @scene.TextAlign::Left, true))
|
||||
y = y + 20
|
||||
let rh = 34
|
||||
for c in win.cameras {
|
||||
let (path, name, why) = c
|
||||
let bw = @renderer.text_width("Use", fs - 1, false, false) + 32
|
||||
let br = @scene.Rect::new(pad + inner - bw, y + 3, bw, rh - 6)
|
||||
let title = if name != "" { name } else { path }
|
||||
body.push(@scene.DrawOp::Text(pad, y + rh / 2 - 7, title, fs - 1, if why == "" { p.foreground } else { p.foreground_muted }, @scene.TextAlign::Left, why == ""))
|
||||
let sub = if why == "" { path } else { path + ": " + why }
|
||||
let sub_lines = wrap_text(sub, fs - 3, false, false, inner - bw - 12)
|
||||
body.push(@scene.DrawOp::Text(pad, y + rh / 2 + 9, sub_lines[0], fs - 3, p.foreground_muted, @scene.TextAlign::Left, false))
|
||||
if why == "" {
|
||||
auth_button(br, "Use", false, false, hover == Some(UseCamera(path)), true, p, fs - 1, rad, body)
|
||||
hits.push((br, UseCamera(path)))
|
||||
}
|
||||
y = y + rh + 4
|
||||
}
|
||||
y = y + 8
|
||||
}
|
||||
// The snaps: click one to drop it.
|
||||
if win.snaps.length() > 0 {
|
||||
body.push(@scene.DrawOp::Text(pad, y + 8, "New pictures (click one to drop it)", fs - 2, p.foreground_muted, @scene.TextAlign::Left, true))
|
||||
|
||||
Reference in new issue
Block a user