From a0c8e5b75a4c274074c918ecfed1d7fd920f4d2f Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Wed, 2 Sep 2026 23:35:20 +0200 Subject: [PATCH] Add fptrial.sh: a labelled verification protocol Thirteen real fprintd-verify runs produced four matches and nine misses and no rate, because nothing recorded which finger each run used. This script runs the protocol -- N quick taps with the enrolled finger, then N with a different one -- tells the user which finger and which tap they are on, and records the label and the wall-clock latency from prompt to client result per tap. The daemon's transcript has the frames; this has the labels. A loop change is measured against this, one variable at a time. --- packaging/fptrial.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packaging/fptrial.sh diff --git a/packaging/fptrial.sh b/packaging/fptrial.sh new file mode 100644 index 0000000..81eb405 --- /dev/null +++ b/packaging/fptrial.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# fptrial.sh -- a labelled verification protocol against fingerprintd. +# +# fptrial.sh [correct_taps] [wrong_taps] defaults 10 and 5 +# +# Runs fprintd-verify once per tap and tells you which finger to use before +# each one. The daemon's transcript records every frame; THIS records the label +# and the wall-clock time from "press now" to the client seeing a result, which +# is the latency a user feels. Unlabelled runs cannot be turned into a rate. +C=${1:-10}; W=${2:-5} +OUT=/tmp/fptrial-$(date +%Y%m%d-%H%M%S).log +now() { date +%s%N; } +run() { # $1 = label + printf '\n>>> %s -- press and LIFT (quick tap) ... ' "$1" + t0=$(now) + res=$(timeout 20 fprintd-verify user 2>&1 | grep -E 'Verify result' | tail -1) + t1=$(now) + ms=$(( (t1 - t0) / 1000000 )) + verdict=$(printf '%s' "$res" | grep -oE 'verify-(match|no-match|unknown-error)' || echo timeout) + printf '%s (%d ms)\n' "$verdict" "$ms" + printf '%s %s %d\n' "$1" "$verdict" "$ms" >> "$OUT" + sleep 1 +} +echo "labelled trial -> $OUT" +i=1; while [ $i -le $C ]; do run "CORRECT $i/$C"; i=$((i+1)); done +echo; echo "===== now switch to a DIFFERENT finger ====="; sleep 3 +i=1; while [ $i -le $W ]; do run "WRONG $i/$W"; i=$((i+1)); done +echo +echo "===== summary =====" +awk '$1=="CORRECT"{c++; if($3=="verify-match")cm++; ct+=$4} + $1=="WRONG" {w++; if($3=="verify-match")wm++; wt+=$4} + END{printf " correct finger: %d/%d matched (false negatives %d) mean %d ms\n", cm,c,c-cm,(c?ct/c:0); + printf " wrong finger: %d/%d matched (false ACCEPTS %d) mean %d ms\n", wm,w,wm,(w?wt/w:0)}' "$OUT" +echo " per-tap log: $OUT"