From f933d2a70a1843e357b9907a5d99688b8d5cbd11 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Thu, 3 Sep 2026 00:26:14 +0200 Subject: [PATCH] Adopt stock's enrolment-quality config: 20 samples, and thresholds that refuse a bad one Jorijn asked whether the sample count is ours to control and whether more samples would help. It is -- and the config dump says something more useful. Stock enrols with 20 samples, not the 10 we had guessed, but it also sets six keys we were leaving entirely to the trustlet's built-in defaults: min_enrolling_coverage_threshold 70 min_enrolling_quality_threshold 20 enroll_overlap_min_area 60 enroll_overlap_max_area 80 enable_duplicated_finger_checking on max_extral_enroll_low_quality 16 Those defaults accept anything, which is how ten quick taps in one position became a stored template. The overlap bounds are the mechanism that matters: a sample must overlap the previous one by 60 to 80 percent -- more means the finger did not move, less means a gap -- so the algorithm now refuses the same-spot sample instead of storing it. Sample count alone would have stored twenty near-duplicates rather than ten. Deliberately left out: min_identify_quality_threshold and min_identify_coverage_threshold. Those gate matching rather than enrolment and would reject exactly the landing frames the 1.5x detection threshold exists to catch. One group of variables at a time. fpenrol.sh grows to twenty positions, and its rejection message now says to move rather than to press harder, because the enforcement and the guidance finally agree on what a rejected sample means. --- implementations/main.cpp | 2 +- packaging/fpenrol.sh | 34 +++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/implementations/main.cpp b/implementations/main.cpp index 789b6b9..36c2a3c 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -77,7 +77,7 @@ bool g_verbose = false; // feels. A frame costs four QTEE round trips regardless; the gap on top is // pure delay. int g_frameGapMs = 40; -int g_samples = 10; // common.max_enrolling_samples, as shipped +int g_samples = 20; // common.max_enrolling_samples, stock's value std::string g_logDir = "/var/log/fingerprintd"; std::string g_stateDir = "/var/lib/fingerprintd"; int g_rescan = -1; // -1 = leave the config's value alone diff --git a/packaging/fpenrol.sh b/packaging/fpenrol.sh index 3bf46f8..a8739eb 100755 --- a/packaging/fpenrol.sh +++ b/packaging/fpenrol.sh @@ -7,7 +7,9 @@ # roughly one position, and it matches roughly one frame in seven -- against # 47-75% for the template the research harness enrolled. The algorithm was # given ten near-duplicate images of one spot, so it recognises that spot and -# little else. +# little else. It accepted them because our config set none of stock's +# enrolment-quality keys and the trustlet's own defaults accept anything; +# those keys are now set, so the algorithm enforces the spread too. # # This walks a different contact position per accepted sample. It reads # fprintd-enroll's per-stage output and prompts the next position as each @@ -15,32 +17,46 @@ # how many times you pressed. F=${1:-right-middle-finger} i=1 +# Twenty positions, stock's sample count. The config now enforces stock's +# coverage and overlap thresholds, so a sample that does not move enough from +# the last one is REFUSED by the algorithm rather than stored -- the guidance +# and the enforcement finally agree. set -- "centre of the pad" \ "slightly LEFT of centre" \ "slightly RIGHT of centre" \ "higher up, toward the TIP" \ "lower down, toward the JOINT" \ - "centre again, rolled LEFT" \ - "centre again, rolled RIGHT" \ + "centre, rolled LEFT" \ + "centre, rolled RIGHT" \ "tip, rolled slightly left" \ "joint, rolled slightly right" \ - "centre, pressed a little firmer" -echo "enrolling $F with position guidance -- 10 samples" + "centre, a little firmer" \ + "far LEFT edge of the pad" \ + "far RIGHT edge of the pad" \ + "very tip of the finger" \ + "well down toward the joint" \ + "upper left of the pad" \ + "upper right of the pad" \ + "lower left of the pad" \ + "lower right of the pad" \ + "centre, rolled hard left" \ + "centre, rolled hard right" +echo "enrolling $F with position guidance -- 20 samples (stock's count)" echo "press FLAT and firm, hold about a second, then LIFT fully." echo # The reader runs in a subshell, so `shift` there cannot advance the caller's # list. Index into it instead. pos() { eval "printf '%s' \"\$$1\""; } -echo ">>> sample 1/10: $(pos 1)" +echo ">>> sample 1/20: $(pos 1)" fprintd-enroll -f "$F" user 2>&1 | while IFS= read -r line; do case "$line" in *enroll-stage-passed*) i=$((i+1)) - if [ "$i" -le 10 ]; then + if [ "$i" -le 20 ]; then echo " accepted." - echo ">>> sample $i/10: $(pos $i)" + echo ">>> sample $i/20: $(pos $i)" fi ;; - *enroll-retry-scan*) echo " not accepted -- same position, press flatter and firmer" ;; + *enroll-retry-scan*) echo " REFUSED -- move further from the last position, or press flatter" ;; *enroll-completed*) echo; echo "COMPLETED." ;; *enroll-failed*) echo; echo "FAILED." ;; *) printf '%s\n' "$line" ;;