diff --git a/packaging/fpenrol.sh b/packaging/fpenrol.sh new file mode 100755 index 0000000..3bf46f8 --- /dev/null +++ b/packaging/fpenrol.sh @@ -0,0 +1,48 @@ +#!/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. +# +# 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 +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" \ + "tip, rolled slightly left" \ + "joint, rolled slightly right" \ + "centre, pressed a little firmer" +echo "enrolling $F with position guidance -- 10 samples" +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)" +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 + echo " accepted." + echo ">>> sample $i/10: $(pos $i)" + fi ;; + *enroll-retry-scan*) echo " not accepted -- same position, press flatter and firmer" ;; + *enroll-completed*) echo; echo "COMPLETED." ;; + *enroll-failed*) echo; echo "FAILED." ;; + *) printf '%s\n' "$line" ;; + esac +done