diff --git a/implementations/main.cpp b/implementations/main.cpp index 4671f44..e82bdf6 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -1106,9 +1106,15 @@ int Probe() { en::TouchTracker tracker; en::AuthTally tally; + // The reference frame loop is {QUERY, CAPTURE, REPORT, QUERY, REPORT}. + // QUERY_EVENT_STATUS returns its answer in rc -- 5 while an event is + // pending, 0 once REPORT_EVENT has consumed it -- and the trailing + // query is not decoration: without it the trustlet's event state is + // never acknowledged, and after the first verdict every later frame + // answers "not identified yet" forever. for (int i = 0; i < g_frames; i++) { std::vector q(0x10, std::byte{0}); - SendCommand(app, ta::Cmd::QueryEventStatus, q); + auto q0 = SendCommand(app, ta::Cmd::QueryEventStatus, q); std::vector cap(ta::CaptureDeclaredLen); ta::BuildCapturePayload(cap); @@ -1148,8 +1154,12 @@ int Probe() { return std::string("?"); }()); } - std::println(" frame {:2}/{}: metric={:<4}{}{}", i + 1, g_frames, c.metric, - finger ? " FINGER" : " ", verdicts); + // Acknowledge the event state before the next frame. + auto q1 = SendCommand(app, ta::Cmd::QueryEventStatus, q); + + std::println(" frame {:2}/{}: metric={:<4}{} evst {}->{}{}", i + 1, g_frames, + c.metric, finger ? " FINGER" : " ", + q0.invoked ? q0.rc : -999, q1.invoked ? q1.rc : -999, verdicts); std::this_thread::sleep_for(std::chrono::milliseconds(g_frameGapMs)); } // Only a terminal verdict is an attempt. Counting rescan frames as