#!/bin/sh # fpenrol.sh -- enrol a finger with COVERAGE guidance. # # fpenrol.sh [finger_name] default right-middle-finger # # The first template on this device was enrolled from ten quick taps in # 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. 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 # stage passes, so the guidance tracks what the trustlet ACCEPTED rather than # 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, rolled LEFT" \ "centre, rolled RIGHT" \ "tip, rolled slightly left" \ "joint, rolled slightly right" \ "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/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 20 ]; then echo " accepted." echo ">>> sample $i/20: $(pos $i)" fi ;; *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" ;; esac done